/** * Feature in WinCE. GetIconInfo is not available in WinCE. * The workaround is to cache the object ImageData for images * of type SWT.ICON. The bitmaps hbmMask and hbmColor can then * be reconstructed by using our version of getIconInfo. * This function takes an ICONINFO object and sets the fields * hbmMask and hbmColor with the corresponding bitmaps it has * created. * Note. These bitmaps must be freed - as they would have to be * if the regular GetIconInfo had been used. */ static void GetIconInfo(Image image, ICONINFO info) { int /*long*/ [] result = init(image.device, null, image.data); info.hbmColor = result[0]; info.hbmMask = result[1]; }
void init(ImageData i) { if (i == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); init(device, this, i); }
/** * Constructs an instance of this class from the given * <code>ImageData</code>. * * @param device the device on which to create the image * @param data the image data to create the image from (must not be null) * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li> * <li>ERROR_NULL_ARGUMENT - if the image data is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_UNSUPPORTED_DEPTH - if the depth of the ImageData is not supported</li> * </ul> * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li> * </ul> */ public Image(Device device, ImageData data) { super(device); NSAutoreleasePool pool = null; if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); try { init(data); init(); } finally { if (pool != null) pool.release(); } }
image.maskPad = mask.scanlinePad; image.maskData = mask.data; init(image); } finally { if (pool != null) pool.release();