1. win32Lib pixmap

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

new topic     » topic index » view message » categorize

2. Re: win32Lib pixmap

buzzo said...

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.

buzzo said...

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.

buzzo said...

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: win32Lib pixmap

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: win32Lib pixmap

buzzo said...

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: win32Lib pixmap

Will be using a loop in the paint event.. controlled by a flag set when everything else id finished..

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu