Picture.CopyOSHandle

From Xojo Documentation
Jump to: navigation, search
Method

Picture.CopyOSHandle ( type as Picture.HandleType ) As Ptr

Returns a platform-specific image handle.


Method

Picture.CopyOSHandle ( width As Integer, height As Integer, scale As Double, type as Picture.HandleType ) As Ptr

Returns a platform-specific image handle that is the best match for drawing at the given resolution, using the same logic as Picture.BestRepresentation.


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).
NSImage An NSImage object that has been autoreleased, so an explicit release is not necessary. This is supported for all types of Pictures, including vector images. Supported in Mac OS X GUI applications.

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
Content
Starting Out
Dig Deeper
More Help
Toolbox
About