Click here to Skip to main content
15,903,203 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: TransparentBlt doesn't mask transparent color with 4-bit and 8-bit source bitmaps Pin
Richard MacCutchan2-Dec-09 12:01
mveRichard MacCutchan2-Dec-09 12:01 
GeneralRe: TransparentBlt doesn't mask transparent color with 4-bit and 8-bit source bitmaps Pin
Rozis2-Dec-09 12:33
Rozis2-Dec-09 12:33 
GeneralRe: TransparentBlt doesn't mask transparent color with 4-bit and 8-bit source bitmaps Pin
Richard MacCutchan2-Dec-09 13:07
mveRichard MacCutchan2-Dec-09 13:07 
GeneralUsing a palette Pin
sashoalm2-Dec-09 17:43
sashoalm2-Dec-09 17:43 
GeneralRe: Using a palette Pin
Richard MacCutchan2-Dec-09 23:43
mveRichard MacCutchan2-Dec-09 23:43 
GeneralRe: Using a palette Pin
Rozis4-Dec-09 1:33
Rozis4-Dec-09 1:33 
GeneralRe: Using a palette Pin
Richard MacCutchan4-Dec-09 23:17
mveRichard MacCutchan4-Dec-09 23:17 
AnswerRe: TransparentBlt doesn't mask transparent color with 4-bit and 8-bit source bitmaps Pin
Rozis2-Dec-09 12:15
Rozis2-Dec-09 12:15 
Maybe i can help you...

sashoalm wrote:
This problem might be because 256-color/16-color bitmaps don't use RGB values. May be they use palettes somehow.


Only 24-bit bitmaps use no colortable, each pixel is 3 bytes in memory being 8 bits for red, 8 for green and 8 for blue. Transparency is implemented as an extension on this: instead of 3 bytes it uses 4 bytes for a pixel (8 bits for transparency level called 'Alpha'). 256- and 16-color bitmaps use a colortable.

TransparentBlt() has 2 levels of transparency: global and per pixel. Global transparency will make all your pixels - for example - 50% transparent. This only works for 24- and 32-bits bitmaps.

Per pixel transparency uses the setting of the alpha. So a 32-bitmap is required. With this you can set the transparency per pixel. One thing to know is that pixel-transparency expects your values for RGB are 'pre-multified', meaning:

alpha:=.. // alpha holds the alpha of the pixel
factor:=alpha/255
r:=r*factor
g:=g*factor
b:=b*factor

I'm not sure what your problem exactly is but i bet the solution is to 'transform' the bitmaps to a 24-bit version. With CreatecDIbitmap() you can do this...

Rozis
Question[Message Deleted] Pin
vtech222-Dec-09 7:32
vtech222-Dec-09 7:32 
QuestionRe: Menu Program Pin
David Crow2-Dec-09 7:35
David Crow2-Dec-09 7:35 
Answer[Message Deleted] Pin
vtech222-Dec-09 7:39
vtech222-Dec-09 7:39 
QuestionRe: Menu Program. Pin
David Crow2-Dec-09 7:42
David Crow2-Dec-09 7:42 
AnswerRe: Menu Program. Pin
vtech222-Dec-09 7:44
vtech222-Dec-09 7:44 
QuestionRe: Menu Program. Pin
David Crow2-Dec-09 7:53
David Crow2-Dec-09 7:53 
GeneralRe: Menu Program. Pin
Richard MacCutchan2-Dec-09 8:28
mveRichard MacCutchan2-Dec-09 8:28 
General[Message Deleted] Pin
vtech222-Dec-09 8:32
vtech222-Dec-09 8:32 
GeneralRe: Menu Program. Pin
Tim Craig2-Dec-09 9:25
Tim Craig2-Dec-09 9:25 
GeneralRe: [Message Deleted] Pin
Richard MacCutchan2-Dec-09 12:36
mveRichard MacCutchan2-Dec-09 12:36 
QuestionPermanent horizontal Scrollbar in CListView Pin
gerens2-Dec-09 6:41
gerens2-Dec-09 6:41 
QuestionRe: Permanent horizontal Scrollbar in CListView Pin
David Crow2-Dec-09 7:32
David Crow2-Dec-09 7:32 
AnswerRe: Permanent horizontal Scrollbar in CListView Pin
loyal ginger2-Dec-09 9:00
loyal ginger2-Dec-09 9:00 
AnswerRe: Permanent horizontal Scrollbar in CListView Pin
gerens2-Dec-09 11:18
gerens2-Dec-09 11:18 
QuestionRe: Permanent horizontal Scrollbar in CListView Pin
David Crow2-Dec-09 17:37
David Crow2-Dec-09 17:37 
AnswerRe: Permanent horizontal Scrollbar in CListView Pin
gerens2-Dec-09 23:55
gerens2-Dec-09 23:55 
QuestionMessage between windows Pin
msr_codeproject2-Dec-09 6:02
msr_codeproject2-Dec-09 6:02 

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.