Drawing a bitmap, TIFF or jpeg image

DrawImage()

Draw a bitmap or jpeg image


SYNTAX

DrawImage(window_id, xpos, ypos, width, height, pathname)

Position a bitmap, TIFF or jpeg image at a specified location.

window_id

The identifier of the window in which the image is to be positioned. To print it in the current report, specify NULL instead of a window_id.

xpos, ypos

The x and y co-ordinates of the position where the upper-left corner of the image is to appear.

width
height

The width and height in device units of the area the image is to occupy. The image is stretched or compressed as necessary to fit the measurements specified by width and height.

pathname

The path of the image file, which must have a .bmp, .tif, .tiff, .jpg or .jpeg extension. The extension must be included in the pathname.

The ImageSize() function can be used to return the image’s default width and height.


EXAMPLE

This example illustrates the use of the DrawImage() and ImageSize() functions in a report.

!temp Height,,r8
!temp Width,,r8
!temp Ratio,,r8
!temp Image,,a255

     sys.Unit = UNIT_INS
     Image = "C:/graphics/Logo.bmp"
     ImageSize(NULL, Image, Width, Height)
     Ratio = Width / Height
     if (Width > 8) {
          Ratio = Width / Height
          Width = 8
          Height = Width / Ratio
     }

     DrawImage(NULL, (8.0 - Width) / 2, 0, Width, Height, Image)

RELATED TOPICS

Drawing operations

Draw functions