how to convert graphics to bitmap in GDI? (C++ or AHK)

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: how to convert graphics to bitmap in GDI? (C++ or AHK)

Re: how to convert graphics to bitmap in GDI? (C++ or AHK)

Post by robodesign » 12 Jun 2019, 10:08

I want to do the same thing... have you found the solution?

Thank you very much in advance.

how to convert graphics to bitmap in GDI? (C++ or AHK)

Post by brandonhotkey » 21 May 2014, 06:10

I have this code:

Code: Select all

GpGraphics * pG;
// I create graphics from bitmap
result = Gdiplus::DllExports::GdipGetImageGraphicsContext(pBitmap, &pG);
 
// here to work with graphics
 
// here to check the image ... save to file
CLSID pngClsid;    
GetEncoderClsid(L"image/png", &pngClsid);
GpBitmap* pBitmap2;
result = Gdiplus::DllExports::GdipCreateBitmapFromGraphics(60, 60, pG, &pBitmap2);

pBitmap refers to bitmap (picture of window). I want to do rotation with the pBitmap2 but I cannot find out

1) how to insert the bitmap (picture) into the bitmap2 (empty one - just created)

2) how to get the graphics back to bitmap.

3) Edit: I think 1) is not what I really need. I need to convert graphics to bitmap. BUt when I call
GdipCreateBitmapFromGraphics I got blank file! So pls how to convert the graphics to bitmap?


result = Gdiplus::DllExports::GdipCreateBitmapFromGraphics(60, 60, pG, &pBitmap2);


If you know how to do it in AHK, pls help and I will find out how to do it in C++. If you know how to do it in C++ help me with C++ version directly.

Top