OPL development pages - Image.opx

OPX for loading and saving different graphics formats (freeware)

What is Image.opx?
IMAGE.OPX is an OPL extension library that allows you to load and save images in a range of different formats (BMP,JPG,PNG,GIF,ICO etc) from within OPL. Features include getting pixel color information from OPL bitmaps, loading all kinds of graphics formats (including transparency), saving into different graphics formats and image rescaling, flipping and rotating.

Which graphics formats can be read and written by IMAGE.OPX depends on the number of graphics converter libraries that are installed on your Communicator. By default converters for the formats BMP, JPG, PNG, ICO, TIFF,GIF, WBMP, WMF and OTA are installed on 9300/9500 devices, but there may be additional formats if extra converters are installed.

Note: IMAGE.OPX only runs on S80 devices (Nokia 9300/9500).

Download Image.opx
You can download Image.opx from the Downloads page.

Usage
To use IMAGE.OPX, use the following statement at the beginning of your OPL application:

INCLUDE "IMAGE.OXH"

Installing IMAGE.OPX
To install Image.opx, double click on the IMAGEOPX_S80.SIS-file in Windows Explorer or copy it to your device and open it from the FileManager application. After this, copy the Image.oxh file to the \SYSTEM\OPL folder on either drive C: or drive D:

Bugs or improvements
If you find any bugs or have further ideas for improvement, please let me know by sending an email to Arjen Broeze or by posting a message in the OPX and OPM support forum.

Documentation of IMAGE.OPX functions

IMAGE.OXH
REM Image.oxh
REM
REM Copyright (c) 2005 Arjen Broeze. All rights reserved.
REM

CONST KUidOpxImage&=&1020834B
CONST KOpxImageVersion%=$110

CONST KImgLoadDefault%=1
CONST KImgLoadScale%=2

CONST KImgTypeBMP%=1
CONST KImgTypeGIF%=2
CONST KImgTypeWMFStd%=3
CONST KImgTypeWMFApm%=4
CONST KImgTypeWMFClp%=5
CONST KImgTypeTIFFLittleEndian%=6
CONST KImgTypeTIFFBigEndian%=7
CONST KImgTypePNG%=8
CONST KImgTypeMBM%=9
CONST KImgTypeWBMP%=10
CONST KImgTypeOTA%=11
CONST KImgTypeICO%=12
CONST KImgTypeJPG%=13

CONST KImgJpgImageMonochrome%=1
CONST KImgJpgImageColor420%=2
CONST KImgJpgImageColor422%=3
CONST KImgJpgImageColor444%=4

CONST KImgPngDefaultCompression%=1
CONST KImgPngNoCompression%=2
CONST KImgPngBestSpeedCompression%=3
CONST KImgPngBestCompression%=4

CONST KImgRotation90DegreesClockwise%=1
CONST KImgRotation180DegreesClockwise%=2
CONST KImgRotation270DegreesClockwise%=3
CONST KImgMirrorHorizontalAxis%=4
CONST KImgMirrorVerticalAxis%=5

DECLARE OPX Image,KUidOpxImage&,KOpxImageVersion%

   imgBitmapGet&:(aWindowId%) :1
   imgBitmapFree:(aBitmapHandle&) :2
   imgBitmapGetPixel&:(aBitmapHandle&,aXPos%,aYPos%) :3

   imgOpen&:(aFileName$) :4
   imgClose:(aImage&) :5
   imgFrameCount%:(aImage&) :6
   imgFrameWidth%:(aImage&, aFrame%) :7
   imgFrameHeight%:(aImage&, aFrame%) :8
   imgFrameDisplayMode%:(aImage&, aFrame%) :9
   imgFrameLoad:(aImage&,aFrame%,aBitmap%,aMode%) :10

   imgResetImageData: :11
   imgSetMbmData:(aDisplayMode%) :12
   imgSetBmpData:(aBitsPerPixel%) :13
   imgSetJpgData:(aColorSampling%,aQualityFactor%) :14
   imgSetPngData:(aCompressLevel%,aBitsPerPixel%,aColor%,aPaletted%) :15
   imgSave%:(aBitmap%,aFileName$,aImageType%) :16

   imgDrawBitmap:(aSource%,aSrcLeft%,aSrcTop%,aSrcWidth%,aSrcHeight%,aDest%,aDestLeft%,aDestTop%,aDestWidth%,aDestHeight%) :17

   imgFrameTransparencyPossible%:(aImage&, aFrame%) :18
   imgFrameLoadTransparent:(aImage&,aFrame%,aBitmap%,aMask%,aMode%) :19

   imgRotateBitmap:(aSource%,aDest%,aAngle%) :20
END DECLARE