Click here to Skip to main content
15,890,609 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: StretchBlt problem Pin
csrss2-Mar-11 7:02
csrss2-Mar-11 7:02 
QuestionRe: StretchBlt problem Pin
CPallini2-Mar-11 4:57
mveCPallini2-Mar-11 4:57 
GeneralRe: StretchBlt problem Pin
csrss2-Mar-11 5:14
csrss2-Mar-11 5:14 
AnswerRe: StretchBlt problem Pin
Chris Meech2-Mar-11 6:15
Chris Meech2-Mar-11 6:15 
GeneralRe: StretchBlt problem [Solved] Pin
csrss2-Mar-11 6:58
csrss2-Mar-11 6:58 
QuestionHow to calculate to get new pixel color by mix alpha value with r, g and b value [modified] Pin
Amrit Agr2-Mar-11 2:11
Amrit Agr2-Mar-11 2:11 
AnswerRe: How to calculate to get new pixel color by mix alpha value with r, g and b value Pin
«_Superman_»2-Mar-11 2:43
professional«_Superman_»2-Mar-11 2:43 
GeneralRe: How to calculate to get new pixel color by mix alpha value with r, g and b value Pin
Amrit Agr3-Mar-11 0:17
Amrit Agr3-Mar-11 0:17 
Hi, I want to use AlphaBlend() method to display transparent shadow. I requires some sort of calculation to mix color value from bitmap( for which I have to display shadow ) with other color( shadow color ).
I have referred caculation method from msdn it's not giving me proper result. I am giving the code. Pls help me out.

DWORD destRedColor   = 0;
DWORD destBlueColor  = 0;
DWORD destGreenColor = 0;
DWORD destAlphaColor = 0;
DWORD SrcRedColor     = 0;
DWORD SrcBlueColor    = 0;
DWORD SrcGreenColor   = 0;
DWORD SrcAlphaColor   = 0;
int src_const_alpha   = 0;

// After all the inits we can do the job : Replace Color
for ( int i = ( ( bm.bmWidth * bm.bmHeight ) - 1 ); i >= 0; --i )
 {
	COLORREF clrRef =  ptPixels[i]; //Bitmap pixel color taken with CreateDIBSection's void* lpBits;
	clrRef = COLORREF2RGB( clrRef );
        
        //taking alpha,red,green and blue values.
	DWORD redDest   = GetRValue( clrRef );
	DWORD greenDest = GetGValue( clrRef);
        DWORD blueDest  = GetBValue( clrRef);
	BYTE *ptrAlphaDest = reinterpret_cast<BYTE*>( &clrRef );
	DWORD alphaDest;
	alphaDest = ptrAlphaDest[0];

        //taking alpha,red,green and blue values.
	DWORD redSrc   = GetRValue( _cNewColor ); //Shadow Color ( of user's choice )
	DWORD greensrc = GetGValue( _cNewColor );
        DWORD blueSrc  = GetBValue( _cNewColor );
	BYTE *ptrAlphaSrc = reinterpret_cast<BYTE*>( &_cNewColor );
	DWORD alphaSrc;
	alphaSrc = ptrAlphaSrc[0];

	src_const_alpha  = int( m_intensity * 2.55 );
	SrcRedColor   = redSrc   * src_const_alpha / 255.0;
        SrcGreenColor = greensrc * src_const_alpha / 255.0;
	SrcBlueColor  = blueSrc  * src_const_alpha / 255.0;
	SrcAlphaColor = alphaSrc * src_const_alpha / 255.0;

        destRedColor   = SrcRedColor    + ( 1 - SrcAlphaColor ) * redDest;
	destGreenColor = SrcGreenColor  + ( 1 - SrcAlphaColor ) * greenDest;
	destBlueColor  = SrcBlueColor   + ( 1 - SrcAlphaColor ) * blueDest;
	destAlphaColor = SrcAlphaColor  + ( 1 - SrcAlphaColor ) * alphaDest;

	ptPixels[i]
	= (destAlphaColor << 24 ) |                       
	  (destRedColor   << 16 ) |  
	  (destGreenColor << 8  ) | 
	  (destBlueColor);
}

QuestionProblem with SetWindowExtEx() Pin
ashtwin2-Mar-11 1:30
ashtwin2-Mar-11 1:30 
AnswerRe: Problem with SetWindowExtEx() Pin
Luc Pattyn2-Mar-11 1:37
sitebuilderLuc Pattyn2-Mar-11 1:37 
QuestionReadFile overlapped i\o Pin
sawerr2-Mar-11 0:39
sawerr2-Mar-11 0:39 
AnswerRe: ReadFile overlapped i\o Pin
Luc Pattyn2-Mar-11 1:31
sitebuilderLuc Pattyn2-Mar-11 1:31 
AnswerRe: ReadFile overlapped i\o Pin
«_Superman_»2-Mar-11 2:57
professional«_Superman_»2-Mar-11 2:57 
AnswerRe: ReadFile overlapped i\o Pin
Richard MacCutchan2-Mar-11 3:05
mveRichard MacCutchan2-Mar-11 3:05 
GeneralRe: ReadFile overlapped i\o Pin
CPallini2-Mar-11 3:13
mveCPallini2-Mar-11 3:13 
GeneralRe: ReadFile overlapped i\o Pin
sawerr2-Mar-11 12:00
sawerr2-Mar-11 12:00 
Questionto filter valid memory leak using VLD in VS 8 Pin
skjaha1-Mar-11 21:46
skjaha1-Mar-11 21:46 
AnswerRe: to filter valid memory leak using VLD in VS 8 Pin
Niklas L2-Mar-11 1:12
Niklas L2-Mar-11 1:12 
AnswerRe: to filter valid memory leak using VLD in VS 8 Pin
«_Superman_»2-Mar-11 3:00
professional«_Superman_»2-Mar-11 3:00 
QuestionThere is a method to get m_hWnd of CComboBox ? Pin
mesajflaviu1-Mar-11 20:46
mesajflaviu1-Mar-11 20:46 
AnswerRe: There is a method to get m_hWnd of CComboBox ? Pin
Niklas L2-Mar-11 1:45
Niklas L2-Mar-11 1:45 
Questionhow do i convert unicode string to ansi format? Pin
yogish2931-Mar-11 18:08
yogish2931-Mar-11 18:08 
AnswerRe: how do i convert unicode string to ansi format? Pin
Hans Dietrich1-Mar-11 19:35
mentorHans Dietrich1-Mar-11 19:35 
AnswerRe: how do i convert unicode string to ansi format? [modified] Pin
Alain Rist1-Mar-11 20:46
Alain Rist1-Mar-11 20:46 
QuestionHow to "input" an outlined character in CRichEditView? Pin
zhong_min1-Mar-11 16:19
zhong_min1-Mar-11 16:19 

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.