1. win32Lib pixmap
- Posted by buzzo Nov 22, 2014
- 1548 views
I am using GDIPlus for jpeg images; photos
Have not been able to place an image from GDIPlus on a pixmap.. can draw to the pixmap without problems.
Also can copy the pixmap to a window successfully with bitBlt or copyBlt.
If I then put the images on that window, the images disappear when the window is scrolled.
When attempting to place the image on the pixmap, the program fails at this line:
status=GdipCreateFromHWND(getHandle(VirtScrn),ppGraphics)
The value of status is 3.. indicating "out of memory HWND". If use getHandle(ChartWin), a normal window, status is 0 and the image is drawn.
I would think both VirtScrn and ChartWin are atoms, but I could be incorrect.
- charting VirtScrn = createEx( Pixmap, "", 0, 0, 0, 0, 0, 0, 0), ChartWin = createEx( Window, "Relatives Chart", 0, 0, 0,vxChartWin, vyChartWin,{WS_POPUP,WS_BORDER, WS_SCROLLBARS},0),
The 0's are replaced depending on the size of the chart.
I have studied win32lib.ew, but did not get a clue on this problem.
As usual, advise will be appreciated .
Buzzo
2. Re: win32Lib pixmap
- Posted by ghaberek (admin) Nov 23, 2014
- 1508 views
If I then put the images on that window, the images disappear when the window is scrolled.
It sounds like you are not drawing the image on the window during its paint event.
When attempting to place the image on the pixmap, the program fails at this line:
status=GdipCreateFromHWND(getHandle(VirtScrn),ppGraphics)
The "handle" of a Pixmap is the memory address of its underlying Bitmap object (a raw HANDLE value in Windows). The "handle" of a Window is its HWND value from Windows, which is what GdipCreateFromHWND() is expecting. HWND specifically means, Handle of a WiNDow. A Pixmap object is not a window, it is an in-memory Bitmap that can be used like a control.
The value of status is 3.. indicating "out of memory HWND". If use getHandle(ChartWin), a normal window, status is 0 and the image is drawn.
I would think both VirtScrn and ChartWin are atoms, but I could be incorrect.
They are both integer values. All values returned from create() (or createEx()) are simple integers that reference internal sequences used by Win32Lib to store data about the controls.
-Greg
3. Re: win32Lib pixmap
- Posted by buzzo Nov 23, 2014
- 1491 views
I have found that I can do exactly what I want using the following code.. it is called from a paint event
procedure chartBmpImage() atom hBitmap -- load the bitmap hBitmap = loadBitmapFromFile( "C:\\Users\\Buzz\\Pictures\\kathleen01.bmp" ) -- display the bitmap in VirtScrn drawBitmap( VirtScrn, hBitmap, 2, 36 ) end procedure
Now to write code to convert jpg to bmp
4. Re: win32Lib pixmap
- Posted by ghaberek (admin) Nov 24, 2014
- 1450 views
I have found that I can do exactly what I want using the following code.. it is called from a paint event
Make sure you're not loading the bitmap during each paint event.
That's a huge waste of resources (both memory and CPU cycles).
Just load the bitmap once when you declare your controls...
-- load the bitmap atom hBitmap = loadBitmapFromFile( "C:\\Users\\Buzz\\Pictures\\kathleen01.bmp" )
And then draw it in the paint event procedure...
-- display the bitmap in VirtScrn drawBitmap( VirtScrn, hBitmap, 2, 36 )
-Greg
5. Re: win32Lib pixmap
- Posted by buzzo Nov 24, 2014
- 1438 views
Will be using a loop in the paint event.. controlled by a flag set when everything else id finished..