Loading a graphic image

load_picture()

Load a graphic image


SYNTAX

load_picture(filename)

Loads the graphic image whose full path is filename. The path should be that of a suitable bitmap, TIFF or jpeg file.

The image may be loaded from a server. In this case, Sculptor first copies the file to the $SCULPTOR/temp directory on the client. The next time the file is accessed, it is copied only if its timestamp indicates that it has been updated on the server.

The function returns a reference (pointer) to an OLE picture object, which can be assigned to any OLE control property that requires an image. It can be assigned to a Sculptor graphic of type GT_IMAGE by means of the picture = property. The reference may be stored in a temporary field with the special type o (object). When the value NULL is assigned to such a field, and the field contains the last reference to the object, the object is destroyed. If an image is loaded and its reference is assigned to an OLE control property, deleting the reference does not destroy the image, because the control creates its own link to the image.

The Windows GDI handle of the image is the HANDLE property of the OLE picture object. The handle to the image can be retrieved and passed to another object. A full list of the OLE picture object properties:

Property

Type

Access

Description

HANDLE

i4

R

The Windows GDI handle of the picture

hPal

i4

RW

The Windows handle of the palette used by the picture

Type

i2

R

The type of picture. Types are defined in sculptor.h with prefix PICTYPE_.

Width

i4

R

The width of the picture in pixels

Height

i4

R

The height of the picture in pixels

KeepOriginalFormat

i1

RW

TRUE: The picture object maintains the entire original state of the picture in memory.

FALSE: Any state not applicable to the user’s machine is discarded.

Attributes

i4

R

Miscellaneous bit attributes of the picture (see below). Attribute values are defined in sculptor.h with prefix PICTURE_.


EXAMPLES

1.

!temp image_ref,,o

image_ref = load_picture(“C:/SCULPTOR/images/keys.ico”)

  1. Using load_picture() to generate an picture object used by the “Add” method of a “ListImages” property:

    +ole IconImageList at 0,0 {
         ole_id = "COMCTL.ImageListCtrl.1"
    }
    
    IconImageList->"ListImages"->"Add"(1, "Icon1", load_picture("C:/SCULPTOR/images/kfserver.ico"))
    IconImageList->"ListImages"->"Add"(1, "Icon1", load_picture("C:/SCULPTOR/images/compile.ico"))
    IconImageList->"ListImages"->"Add"(1, "Icon1", load_picture("C:/SCULPTOR/images/exit.ico"))
    

RELATED TOPICS

OLE controls

OLE control methods

Modifying or retrieving OLE properties at runtime

Servers

Graphic picture property

Object (o) type fields