Picture.CopyOSHandle

From Xojo Documentation
Jump to: navigation, search
Method
Picture.CopyOSHandle ( type as Picture.HandleType ) As Ptr

Returns a platform-specific image handle.


NOTE: The handle returned is a copy of the underlying data and will not be modified if the Picture itself is modified. Also, since it is a copy, it is your responsibility to release it using the proper OS API.  


Class Constant Description
MacCGImage A CGImageRef that you are responsible for releasing with CFRelease. Supported in Mac OS X GUI applications.
WindowsBMP A 32-bit HBITMAP that you are responsible for releasing with DeleteObject. Supported in Windows GUI applications.
WindowsICON A 32-bit HICON that you are responsible for releasing with DeleteObject. Supported in Windows GUI applications.
LinuxGdkPixbuf A 32-bit GdkPixbuf that you are responsible for releasing with g_object_unref. Supported in Linux GUI applications.
ConsoleGDImage A gdImagePtr that you are responsible for releasing with gdFree. This requires the use of the libgd library. Supported in console applications (all platforms).

Example

The following code gets the CGImageRef from the Picture and properly releases it.

declare sub CFRelease lib "CoreFoundation" ( obj as ptr )

dim pict as new Picture( 100, 100, 32 )
dim cgImage as ptr = pict.CopyOSHandle( Picture.HandleType.MacCGImage )
// Do something with the 'cgImage' object
CFRelease( cgImage )
Personal tools
Namespaces

Variants
Actions
Main
Documentation
Community
Toolbox
Help