The IMAGE Object API (Redux)
Published 12 MAY 2021 at 04:40:05PM
Once upon a time, in a blog post far far away, we looked at a very early incarnation of the version 10 Image API which described how images were used with OpenInsight forms and controls. Since then the API has changed quite a bit, so this post gives you a PDF link to a preview of the API documentation which covers the capabilities in the next release, some of which hasn't been described before.
An overview of the Image API
Many GUI types managed by the Presentation Server support images in one form or another; some have background images, some have glyphs, some have image lists and so on. However, many of these images have properties of their own, and in most cases these image properties are common to all.
Because of this most Presentation Server types that support images expose them as intrinsic "sub-objects", thorough a model we refer to as the "Image Object API". The image object's lifetime is managed by the system and it cannot be programmatically destroyed from Basic+, but it can be manipulated by the Get/Set_Property and Exec_Method functions just like any other Presentation Server object.
The entire Image API is described in the linked PDF below but be aware that not all image objects support all of the API. For example, a PUSHBUTTON type does not support an "INDEX" property for its background image, and its SplitGlyph image doesn't support an ALIGN property: All such exceptions are documented in the relevant sections that describe each object type.
Supported image types
The Presentation Server supports the following image types via the WIC (Windows Imaging Component) sub-sytem:
- BMP
- ICO
- PNG
- GIF
- JPEG
- TIFF
Image Object Properties
Name | Description |
ALIGN | Specifies the horizontal and vertical alignment of the image within its parent. |
AUTOSCALE | Specifies if the image should be scaled along with its parent object. |
COLORKEY | Specifies the color in the image that should be treated as the "transparent color". |
COUNT | Specifies the number of sub-images within an image file. |
FILENAME | Returns the name of the image file being displayed. |
FILENAMES | Specifies an array of DPI-specific image files to display. |
FRAMECOUNT | Returns the number of "frames" within an image. |
FRAMEDELAY | Returns the delay time in milliseconds for a multi-frame image. |
FRAMEINDEX | Specifies the frame to display within a multi-frame image. |
INDEX | Specifies the index of the sub-image to display within a multiimage file. |
OFFSET | Specifies the point within the image (not the object) to begin drawing from. |
ORIGIN | Specifies the point within the object (not the image) to begin drawing from. |
SIZE | Returns the width and height of the image in pixels |
STYLE | Specifies how the image is drawn into an object (Tiled, Stretched, Clipped or Scaled). |
TRANSLUCENCY | Specifies the degree of transparency applied to an image when it is drawn |
Image Object Methods
Name | Description |
SAVETOFILE | Saves the current image to a file. |
SETHBITMAP | Loads an image from a Windows BITMAP handle (HBITMAP). |
SETIMAGE | Loads an image from an array of "raw" image bytes. |
SETREPOSIMAGE | Specifies the image file(s) using an OpenInsight repository IMAGE entity. |
Here's the link to the Image Object API PDF - adding animated GIFs to your applications has never been so easy!
Comments
At 13 MAY 2021 02:25AM Barry Stevens wrote:
I see a TOOLBAR object mentioned. I assume it is what it logically sounds like especially with multiple images. But, I cant see where you can create it or any related help on the subject. Can you point me in the right direction.
At 13 MAY 2021 09:52AM Captain C wrote:
Hi Barry - ToolBars haven't been released yet - we'll let you know when they are ready, and you'll probably see it here first.
At 13 MAY 2021 11:24PM Barry Stevens wrote:
Ah, cool. I will cancel my glasses appointment :)