Using FreeImage to fit a PNG file in an image control

Hi,

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.

Any suggestions are appreciated.

Regards

Larry Sand created ClarionFreeImage. Have you looked at that?

http://www.clarionfreeimage.com/

Mark Riffey created this repo for it, as well. GitHub - mriffey/ClarionFreeImage: A backup of Larry Sand's Clarion Free Image product

GDI+ is much simplier:

  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

Hello,

I tried the code but I am getting this error about “ToString” : Unknown function label.

I checked the class but could not find it there. Am I missing something?

Regards

Perhaps you have outdated classes.

This is the one I have:

!* GdiPlus support
!* mikeduglas 2022
!* [email protected]

INCLUDE(‘svapi.inc’), ONCE
INCLUDE(‘gdiplustypes.inc’), ONCE

TGdiPlusImage CLASS, TYPE, MODULE(‘gdiplus.clw’), LINK(‘gdiplus.clw’)
nativeImage LONG, PROTECTED !- GpImage*
lastResult GpStatus, PROTECTED

Construct PROCEDURE()
Destruct PROCEDURE(), VIRTUAL

GetLastStatus PROCEDURE(), GpStatus

FromFile PROCEDURE(STRING pFileName, BOOL pUseICM=FALSE), GpStatus, PROC
FromString PROCEDURE(STRING pImageData, BOOL pUseICM=FALSE), GpStatus, PROC
DisposeImage PROCEDURE(), GpStatus, PROC
!!!

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

I just downloaded the latest one.

thank you

I updated everything and it all ran smooth.

Thanks a lot and best regards

interested in your PDF reader and writer classes. you dont appear to be taking messages the moment .

mIss attending the ballet in Moscow…