Click here to Skip to main content
16,012,468 members
Home / Discussions / Graphics
   

Graphics

 
GeneralRe: Graphics Problem Pin
Pete O'Hanlon27-Mar-07 1:41
mvePete O'Hanlon27-Mar-07 1:41 
QuestionEqualizer Pin
Pafflik23-Mar-07 0:27
Pafflik23-Mar-07 0:27 
AnswerRe: Equalizer Pin
Christian Graus24-Mar-07 13:33
protectorChristian Graus24-Mar-07 13:33 
QuestionUpdateLayeredWindow() fails, GetLastError() == 0 Pin
klorin21-Mar-07 6:10
klorin21-Mar-07 6:10 
AnswerRe: UpdateLayeredWindow() fails, GetLastError() == 0 Pin
Jeff J Anderson27-Mar-07 17:31
Jeff J Anderson27-Mar-07 17:31 
GeneralC++ - Clearing the Alpha bits Pin
PJ Arends20-Mar-07 21:05
professionalPJ Arends20-Mar-07 21:05 
GeneralRe: C++ - Clearing the Alpha bits Pin
Michael Dunn20-Mar-07 21:20
sitebuilderMichael Dunn20-Mar-07 21:20 
GeneralRe: C++ - Clearing the Alpha bits Pin
PJ Arends20-Mar-07 21:53
professionalPJ Arends20-Mar-07 21:53 
D'Oh! | :doh:

Then my problem must be elsewhere.

// Load two bitmaps from resources
pja::CBitmap bmp1(IDB_BITMAP1);
pja::CBitmap bmp2(IDB_BITMAP2);

// create a monochrome bitmap the same size as the resource bitmaps
pja::CBitmap bmpbw = CreateBitmap(bmp1.Width(), bmp1.Height(), 1, 1, NULL);

ShowGraphic(bmp1);
ShowGraphic(bmp2);

// Create compatible device contexts, compatible with the display
pja::CCompatibleDC dc1;
pja::CCompatibleDC dc2;
pja::CCompatibleDC dcbw;

// Select the bitmaps into the device contexts
SelectObject(dc1, bmp1);
SelectObject(dc2, bmp2);
SelectObject(dcbw, bmpbw);

// Combine the two resource bitmaps using the DSxn ROP.
// Source bitmap is inverted then XORed with the destination bitmap
// This results in the destination bitmap having white pixels where the
// two bitmaps matched, and other colours where they are different
BitBlt(dc1, 0, 0, bmp1.Width(), bmp1.Height(), dc2, 0, 0, 0x00990066);
ShowGraphic(dc1);

// Copy the new bitmap onto the monochrome bitmap
// White stays white, rest turns black
SetBkColor(dc1, RGB(255, 255, 255));
BitBlt(dcbw, 0, 0, bmpbw.Width(), bmpbw.Height(), dc1, 0, 0, SRCCOPY);
ShowGraphic(bmpbw);

The final step does not work, the b&w bitmap is all black. If I change my display settings to 16 or 24 bit then this code works perfect. The only time it has a problem is with 32 bits, that is why I suspected the alpha bits as being the cause.

So Ok, same question but opposite. How to ensure all alpha bits are 0xFF if they are 0x00?



You may be right
I may be crazy
-- Billy Joel --


Within you lies the power for good, use it!!!

GeneralRe: C++ - Clearing the Alpha bits Pin
PJ Arends20-Mar-07 23:49
professionalPJ Arends20-Mar-07 23:49 
GeneralRe: C++ - Clearing the Alpha bits [ SOLVED ] Pin
PJ Arends23-Mar-07 18:00
professionalPJ Arends23-Mar-07 18:00 
QuestionClearing a partial area of a bitmap Pin
dadaruh16-Mar-07 3:20
dadaruh16-Mar-07 3:20 
AnswerRe: Clearing a partial area of a bitmap Pin
codemunkeh21-Mar-07 8:40
codemunkeh21-Mar-07 8:40 
Questionchange forms caption and border Pin
hamid_m14-Mar-07 23:37
hamid_m14-Mar-07 23:37 
GeneralRe: change forms caption and border Pin
prasad_som14-Mar-07 23:46
prasad_som14-Mar-07 23:46 
QuestionJPEG Extended ? Pin
Christian Graus10-Mar-07 7:12
protectorChristian Graus10-Mar-07 7:12 
QuestionRe: JPEG Extended ? Pin
Mark Salsbery10-Mar-07 7:16
Mark Salsbery10-Mar-07 7:16 
AnswerRe: JPEG Extended ? Pin
Christian Graus10-Mar-07 7:21
protectorChristian Graus10-Mar-07 7:21 
AnswerRe: JPEG Extended ? Pin
Christian Graus10-Mar-07 7:28
protectorChristian Graus10-Mar-07 7:28 
AnswerRe: JPEG Extended ? Pin
User 171649212-Mar-07 14:53
professionalUser 171649212-Mar-07 14:53 
GeneralRe: JPEG Extended ? Pin
Christian Graus27-Mar-07 2:51
protectorChristian Graus27-Mar-07 2:51 
QuestionDrawing in background thread Pin
Aaron Schaefer9-Mar-07 4:50
Aaron Schaefer9-Mar-07 4:50 
AnswerRe: Drawing in background thread Pin
Mark Salsbery9-Mar-07 6:32
Mark Salsbery9-Mar-07 6:32 
GeneralRe: Drawing in background thread Pin
Aaron Schaefer9-Mar-07 7:27
Aaron Schaefer9-Mar-07 7:27 
QuestionRe: Drawing in background thread Pin
Mark Salsbery9-Mar-07 12:11
Mark Salsbery9-Mar-07 12:11 
AnswerRe: Drawing in background thread Pin
Aaron Schaefer9-Mar-07 15:36
Aaron Schaefer9-Mar-07 15:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.