CImage:Attach


The Attach method attaches the image associated with a different instance of a CImage.

Syntax

bSuccess = CImage:Attach( pointer )

where

    pointer refers to an image, not a CImage object.

    bSuccess is the returned success code. On success it is true, otherwise false.

  

Using Attach provides CImage class functionality to be used with an image owned by another class, but the CImage does not own the foreign image or make a copy of it. Use this method, for example, to work with a displayed image that is owned by an image view window, but for that purpose it is usually preferable to use the CImageView:GetImage method.

Example

Suppose an image window exists and is Wrapped by a CImageView object named V:

I = CImage:new()

-- create a CImage object

ptr = V:GetImagePtr()

-- return a pointer to the current displayed image

I:Attach( ptr )

-- attach the pointer p to CImage I

nValue = I:Get(10,20)

-- fetch the value at coordinate (10,20)

Related Topics

CImageView class

CImage class