As I am using clarion 6.3 and it does not support PNG display. I tried using the FreeImage examples (because I did not find a documentation for using clarion with FreeImage ) but there was always a problem with aspect ratio or the height and width which exceed the control limits.
PROGRAM
INCLUDE('gdiplus.inc'), ONCE
MAP
END
Window WINDOW('PNG image in C6'),AT(,,208,120),CENTER,GRAY,SYSTEM
IMAGE,AT(9,14,64,59),USE(?IMAGE1)
END
bm TGdiPlusBitmap
sBits &STRING, AUTO
CODE
OPEN(Window)
bm.FromFile('CristmasTree.png')
sBits &= bm.ToString('image/bmp')
?IMAGE1{PROP:ImageBits} = sBits
DISPOSE(sBits)
ACCEPT
END
Gets the width, in pixels, of this image.
GetWidth PROCEDURE(), ULONG
!!!Gets the height, in pixels, of this image.
GetHeight PROCEDURE(), ULONG
!!!Gets the horizontal resolution, in dots per inch, of this image.
GetHorizontalResolution PROCEDURE(), SREAL
!!!Gets the vertical resolution, in dots per inch, of this image.
GetVerticalResolution PROCEDURE(), SREAL
!Clone PROCEDURE(), *TGdiPlusImage
!ToFile PROCEDURE(STRING pFileName), GpStatus, PROC
!GetType PROCEDURE(), GpImageType
!GetPhysicalDimension PROCEDURE(*GpSizeF pSize), GpStatus, PROC
!GetBounds PROCEDURE(*GpRectF pRect, *GpUnit pUnit), GpStatus, PROC
END
TGdiPlusBitmap CLASS(TGdiPlusImage), TYPE, MODULE(âgdiplus.clwâ), LINK(âgdiplus.clwâ)
GetHBITMAP PROCEDURE(ULONG pBackground), HBITMAP
END
Say the IMAGE control is 500x500 and the image is 2000x2000.
Currently the large image loads and most of it is not visible. I would like the image to be scaled so that the entire image is visible in the image control.
If you really want to get resized image, then several ways exist. You can clone the image, or you can create an image with desired size and draw original image on it, you can ask google
Create Graphics object over bm2: g.FromImage(bm2) then draw on it what you need.
Also keep in mind that TGdiPlusBitmap.CreateBitmap expects width and height parameters in pixels, while ?Image{PROP:Width} and ?Image{PROP:Height} by default return the values in dialog units.