Picture


Description

The Picture class allows you to display various kinds of picture (for example, JPEG, Windows bitmaps, or MacOS PICT images). The object can optionally include scroll bars for scrolling around the image (if the image is bigger than the object), or can allow stretching of the image to fit the object size. The image can be read from file, from an APL array of pixel color values, or from a stored vector of drawing commands.

See also the Draw method which allows you to draw icons, pictures and bitmaps on your windows and controls.

Properties to specify the image

You can specify the image which is displayed in one of four ways:

Reading back the bitmap property always returns an APL array of color values, so you can use this to convert an image from file (such as a JPEG picture) to a bitmap.

Other properties

style: An integer comprising one of:

    0  Picture is unscaled and centred
    4  Picture is scaled to fit image
    8  Picture is always scaled to fit frame, even when frame resized

to which can be added:

   16  Vertical scroll bar       (Not valid if style = 8)
   64  Horizontal scroll bar     (Not valid if style = 8)
  128  Disable unnecessary scroll bars instead of removing them (MacOS only)

imagesize: The size (in current scale units) of the picture. This may be larger than or smaller than the size property of the object itself. If the style is 8, you cannot set imagesize, since it is always the same as the object size.

bitmapsize: The size (in current scale units) of the image within the picture.

Example


     ’DEMO_Picture;DEMO
[1]   © Sample function demonstrating use of the Picture object
[2]   DEMO„'Œ' ŒNEW 'Window' ª DEMO.scale„5 ª DEMO.size„188 140
[3]   DEMO.title„'Picture'
[4]   DEMO.myPicture.New 'Picture' ª DEMO.myPicture.align„¯1
[5]   ©
[6]   © Specify the picture either from a PICT or JPEG file, e.g.
[7]   ©
[8]   © Macintosh:
[9]   ©    DEMO.myPicture.file„'Macintosh HD:MyPicture'
[10]  ©
[11]  © Windows:
[12]  ©    DEMO.myPicture.file„'C:/MyFiles/MyPicture.jpg'
[13]  ©
[14]  © ...or put up a dialog asking the user to choose an image file:
[15]  ©
[16]  ©    DEMO.myPicture.file„''
[17]  ©
[18]  © ...or from an image held in a variable or the clipboard, e.g.
[19]  ©
[20]  ©    DEMO.myPicture.picture„('Œ' ŒWI 'picture')
[21]  ©
[22]  ©
[23]  © ...or from an integer matrix of encoded RGB colour values, as here:
[24]  ©
[25]  DEMO.myPicture.bitmap„SAMPLE_BITMAP
[26]  ©
[27]  © Wait for the user to close the window
[28]  0 0½ŒWE DEMO
     ’

Properties

align anchors aquaadjust autodraw bitmap bitmapsize border children class color data dragsource droptarget enabled events extent file imagesize maxsize methods minsize name opened picture pointer properties scale self size sourceformats style targetformats tie units visible where

Methods

Click Clienttoscreen Close Create Delete Draw Hide New Open Paint Resize Screentoclient Send Set Show Trigger

Callbacks

onClick onClose onDblClick onDestroy onDragDrop onDragEnd onDragEnter onDragLeave onDragOver onDragStart onHide onMouseDown onMouseMove onMouseUp onOpen onSend onShow


Topic: APLX Help : System Classes : List of Classes : Picture
[ Previous | Next | Contents | Index ]