Jules (or anyone), is there a better way to do it than this?..
for ( int x = 0; x < _image->getWidth(); ++x )
for ( int y = 0; y < _image->getHeight(); ++y )
SetPixel( di.hdcDraw, x + rc.left , y + rc.top, (COLORREF)*(_image->getPixelPointer( x, y )) );
I’m thinking hack juce to get hold of raw buffer then memcpy?
good grief, it’ll take hours to do it a pixel at a time.
The Juce image class can actually wrap a HBITMAP, so you can blit it directly - check out the code in juce_win32_windowing.cpp that does the repainting, because that just creates an image, draws into it, then blits it to the window.
[quote=“jules”]good grief, it’ll take hours to do it a pixel at a time.
The Juce image class can actually wrap a HBITMAP, so you can blit it directly - check out the code in juce_win32_windowing.cpp that does the repainting, because that just creates an image, draws into it, then blits it to the window.[/quote]
Yes yes. Just chucked that in before looking for something zippier.
Anyway, can’t get it working. are we talking createSystemNativeImage()? (or whatever its called) Tried that with a hack to get hold of the WindowsBitmapWrapper. Nope. Tried setting up BITMAPINFO (or whatever it is) manually and using getPixelPointer(0,0) to get the buffer but I’m just getting solid black where me graphics should be!
Don’t know if I’m going about it wrong or fucked up a setting.
I can see why you wrote a JDK-alike crossplatform library Jules.