Silverfrost Logo About Us | Contact Us
 

%gi - GIF

Purpose

To draw a (possibly animated/transparent) GIF image.

Syntax

winio@('%gi[gif_name]')

Modifiers

Caret (^) - the call-back is called when the user clicks on the image.

Question mark (?) - a help string is supplied.

Description

gif_name is a name appearing in a resource script if type GIF. The resource compiler stores such resources in a non-GIF format (for legal reasons). The GIF file can be animated and/or partially transparent.

A call-back can be supplied to receive single and double clicks. The call-back function can interrogate the clearwin_info@ parameters GIF_MOUSE_X and GIF_MOUSE_Y to determine where within the image the click occurred. This means that a medium to large image can contain regions which respond in different ways to mouse clicks. Co-ordinates are in pixels relative to the top left of the image. Note that if the GIF image is displayed at another screen resolution, these pixel co-ordinates will consistently refer to the same point in the image.

Example

winio@('%gi[my_gif]')
my_gif GIF file.gif      (resource file)

Notes

A GIF file can contain more than one image frame, and each image can specify the duration for which it is shown. Animations can be one-shot, repeated for a finite number of times, or (most usefully) cycled indefinitely. Many image processing and paint tools will create simple (non-animated) GIF files, and these can be assembled into animated GIFs using a variety of tools, such as the Microsoft GIF Animator, available from the Microsoft Web site. GIF files are commonly available on the internet. MATHEMATICA can export graphics as GIF files.

A GIF image contains size information, so none is required with the format.

Hypertext (%ht) containing images normally refers to BITMAP resources. However, if a particular named resource is not found as a bitmap, ClearWin+ will look for the corresponding GIF resource. This means that GIFs (possibly animated/transparent) can also be used in hypertext.

Animations require memory and processing time, so it might be unwise to use a large and complex animation on a 'please wait' screen that is displayed while a lengthy operation is being performed. Obviously, slower animations are less expensive than rapid ones. Also, for the animation to be maintained, it is important that very lengthy calculations are broken up with calls to temporary_yield@.

One way to reduce the performance cost of many animations is to exploit the fact that much of an image may remain the same from frame to frame. Consider for example an animated ballot paper. It might be that only the region that contains the cross would actually need to change. It is possible to assemble a GIF consisting of one full image and a series of patches, which will obviously require less memory and processing resources than the corresponding set of full images. If you decide to proceed this way your program will remain unchanged, it will simply require more work with the image processing tools.

On 16 or 256 colour systems, GIF images are displayed without the use of a palette. This is to avoid some of the problems with Windows when two or more processes compete for the use of the palette. GIF images are best viewed in a high colour mode. If in doubt it is worth switching your screen to 256 colour mode to ensure that your graphic looks acceptable. You can read the clearwin_info@ parameter, SCREEN_NUM_COLOURS do determine what to do at run time.

GIF images may be used to provide fancy buttons that attract attention because of their animation, to provide front cover screens for programs, and to add colour and interest. Larger images can even be used as image maps by reading the click co-ordinates, as explained above.

The GIF resources are decompressed by the resource compiler and recompressed by a different method. This means that your executables and the DLL salflibc.dll do not contain any code related to the processing of the GIF format. For this reason we have not supplied any routines to enable you to export graphics to GIF files. However, if you want to incorporate your graphics in animated GIFs this is still possible. Simply create a series of still images as BMP files, convert them to GIFs using a shareware image processing program, and assemble the result as an animated GIF.

See also

%ic - Icon,%bm - Bitmap

 

 

 

Copyright © 1999-2017 Silverfrost Limited