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

C / C++ / MFC

 
AnswerRe: Gdiplus: DrawImage not working Pin
leon de boer14-Jan-17 23:45
leon de boer14-Jan-17 23:45 
Can I first say you have no error checking at all in that code ... really bad programming practice

cairo_win32_surface_get_dc can fail and return NULL ... read the manual.
Why might there not be a win32 surface, well because you have to set a #define CAIRO_HAS_WIN32_SURFACE 1 in the cairo library .... again in the manual.

You code is totally reliant on srcHDC being valid ... Yet inexplicably you don't check it.

Secondly you probably want an alpha channel on the CIMage .. the create should be CreateEx
CImage image;
image.CreateEx(width, height, 32, BI_RGB, 0, 0);

Thirdly read TransparentBlt detail and if we do the Alpha channel it will then copy the source alpha onto the destination alpha ... is that Ok? If not you have to use AlphaBlend function.

Fourth check GDIPlus I seem to remember it had issues with Alpha channels.

Final comment is you seem to be making life difficult for yourself using 3 different systems for reasons that aren't clear. You are moving bitmap data around between systems for no real reason what you want can be done in any of the 3 systems and even natively on the Win32 API. You are even initializing the GDI plus system with a draw process ... like seriously please don't do it are you really hell bent on making the draw as slow as possible. Start the GDIPlus with the window or program and close it when done but not in a draw process ever.
In vino veritas

GeneralRe: Gdiplus: DrawImage not working Pin
Member 162132325-Jan-17 10:57
Member 162132325-Jan-17 10:57 
Questionwhat?where? Pin
Member 1294982214-Jan-17 1:54
Member 1294982214-Jan-17 1:54 
AnswerRe: what?where? Pin
Afzaal Ahmad Zeeshan14-Jan-17 2:59
professionalAfzaal Ahmad Zeeshan14-Jan-17 2:59 
AnswerRe: what?where? Pin
Patrice T14-Jan-17 16:03
mvePatrice T14-Jan-17 16:03 
AnswerRe: what?where? Pin
jeron116-Jan-17 5:15
jeron116-Jan-17 5:15 
GeneralRe: what?where? Pin
Daniel Pfeffer16-Jan-17 5:22
professionalDaniel Pfeffer16-Jan-17 5:22 
GeneralRe: what?where? Pin
NotPolitcallyCorrect16-Jan-17 9:20
NotPolitcallyCorrect16-Jan-17 9:20 
QuestionDisable a Tab on CPropertySheet Pin
Member 1294722612-Jan-17 4:58
Member 1294722612-Jan-17 4:58 
AnswerRe: Disable a Tab on CPropertySheet Pin
David Crow12-Jan-17 5:19
David Crow12-Jan-17 5:19 
GeneralRe: Disable a Tab on CPropertySheet Pin
Member 129472265-Feb-17 20:45
Member 129472265-Feb-17 20:45 
GeneralRe: Disable a Tab on CPropertySheet Pin
David Crow6-Feb-17 2:37
David Crow6-Feb-17 2:37 
QuestionVS2008 Debugger and CStrings - inconistent display Pin
charlieg9-Jan-17 9:17
charlieg9-Jan-17 9:17 
QuestionRe: VS2008 Debugger and CStrings - inconistent display Pin
David Crow9-Jan-17 10:19
David Crow9-Jan-17 10:19 
AnswerRe: VS2008 Debugger and CStrings - inconistent display Pin
charlieg9-Jan-17 10:47
charlieg9-Jan-17 10:47 
QuestionMultithreading question Pin
ForNow7-Jan-17 16:36
ForNow7-Jan-17 16:36 
AnswerRe: Multithreading question Pin
Daniel Pfeffer7-Jan-17 19:02
professionalDaniel Pfeffer7-Jan-17 19:02 
GeneralRe: Multithreading question Pin
harold aptroot7-Jan-17 19:52
harold aptroot7-Jan-17 19:52 
AnswerRe: Multithreading question Pin
Richard MacCutchan7-Jan-17 20:51
mveRichard MacCutchan7-Jan-17 20:51 
AnswerRe: Multithreading question Pin
leon de boer8-Jan-17 20:03
leon de boer8-Jan-17 20:03 
GeneralRe: Multithreading question Pin
Jon McKee8-Jan-17 20:58
professionalJon McKee8-Jan-17 20:58 
GeneralRe: Multithreading question Pin
ForNow8-Jan-17 22:30
ForNow8-Jan-17 22:30 
GeneralRe: Multithreading question Pin
leon de boer9-Jan-17 18:23
leon de boer9-Jan-17 18:23 
GeneralRe: Multithreading question Pin
ForNow9-Jan-17 18:57
ForNow9-Jan-17 18:57 
GeneralRe: Multithreading question Pin
leon de boer10-Jan-17 23:23
leon de boer10-Jan-17 23:23 

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.