TXImage class is available for displaying bmp,png,jpg,gif,ico,cur,tif,emf,wmf formats without freeimage.dll and more formats if freeimage.dll is available. But the class methods and user-interface is much different from the TBitmap and TImage.
From version 18.01, TBitmap class itself can handle all image formats bmp,png,jpg,gif,ico,cur,tif,emf,wmf without freeimage.dll and more with the dll. Thus in most cases, TBitmap meets the requirements without having to use TImage.
The choice between TBitmap and TXImage depends only on the kind of interface prefered by the programmer than the capabilities to handle a variety of image formats.
A test program:
- Code: Select all Expand view RUN
- #include "fivewin.ch"
function Main()
local oDlg, oBrush, oFont, oBmp
DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-16 BOLD
DEFINE BRUSH oBrush FILE "\fwh\bitmaps\backgrnd\stone.bmp"
DEFINE DIALOG oDlg SIZE 1050,700 PIXEL TRUEPIXEL TRANSPARENT ;
TITLE "FWH 1801 : TBITMAP Control" BRUSH oBrush
@ 20, 20 BITMAP oBmp SIZE 150,150 PIXEL OF oDlg ;
FILE "\fwh\bitmaps\alphabmp\android.bmp" NOBORDER
@ 20,200 BITMAP oBmp SIZE 150,150 PIXEL OF oDlg ;
FILE "\fwh\bitmaps\pngs\dvd.png" NOBORDER
@ 20,400 BITMAP oBmp SIZE 150,150 PIXEL OF oDlg ;
FILE "leaves.wmf" NOBORDER
oBmp:nZoom := 0.08
@ 20,600 BITMAP oBmp SIZE 150,150 PIXEL OF oDlg ;
FILE "\fwh\icons\hires\auxiliarydisplay.ico(128x128)" NOBORDER
@ 20,750 BITMAP oBmp SIZE 300,400 PIXEL OF oDlg ;
FILE "\fwh\gifs\test3.gif" NOBORDER
@ 200, 20 BITMAP oBmp SIZE 350,450 PIXEL OF oDlg ;
FILE "\fwh\bitmaps\olga1.jpg" NOBORDER
@ 200,390 BITMAP oBmp SIZE 390,450 PIXEL OF oDlg ;
FILE "https://wikitravel.org/upload/en/thumb/3/32/Paris-eiffel-tower.jpg/300px-Paris-eiffel-tower.jpg" ;
NOBORDER
for each oBmp in oDlg:aControls
if oBmp:ClassName() == "TBITMAP"
@ oBmp:nTop + oBmp:Super:nHeight, oBmp:nLeft SAY Upper( cFileExt( oBmp:cBmpFile ) ) ;
SIZE oBmp:Super:nWidth, 20 PIXEL OF oDlg CENTER FONT oFont
else
EXIT
endif
next
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
RELEASE BRUSH oBrush
return nil