javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/graphics/Image.java
equal
deleted
inserted
replaced
282 { |
282 { |
283 if (device == null) device = Device.getDevice(); |
283 if (device == null) device = Device.getDevice(); |
284 if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); |
284 if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); |
285 init(device, new ImageData(filename)); |
285 init(device, new ImageData(filename)); |
286 } |
286 } |
287 |
287 |
288 /** |
288 /** |
289 * Disposes of the operating system resources associated with |
289 * Disposes of the operating system resources associated with |
290 * the image. Applications must dispose of all images which |
290 * the image. Applications must dispose of all images which |
291 * they allocate. |
291 * they allocate. |
292 */ |
292 */ |
770 } |
770 } |
771 } |
771 } |
772 |
772 |
773 return baoStream.toByteArray(); |
773 return baoStream.toByteArray(); |
774 } |
774 } |
|
775 |
|
776 /** |
|
777 * Invokes platform specific functionality to allocate a new image |
|
778 * which has handle to a system image. |
|
779 * <p> |
|
780 * <b>IMPORTANT:</b> This method is <em>not</em> part of the public |
|
781 * API for <code>Font</code>. It is marked public only so that it |
|
782 * can be shared within the packages provided by SWT. It is not |
|
783 * available on all platforms, and should never be called from |
|
784 * application code. |
|
785 * </p> |
|
786 * |
|
787 * @param device the device on which to allocate the image |
|
788 * @param handle the native handle for the image |
|
789 * @return a new image object containing the specified device and |
|
790 * system image handle |
|
791 */ |
|
792 public static Image internal_new(Device device, int handle) |
|
793 { |
|
794 if (device == null) device = Device.getDevice(); |
|
795 if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); |
|
796 if (handle == 0) |
|
797 { |
|
798 SWT.error(SWT.ERROR_NO_HANDLES, null, device.getLastError()); |
|
799 } |
|
800 |
|
801 Image image = new Image(); |
|
802 image.device = device; |
|
803 image.handle = handle; |
|
804 image.type = SWT.BITMAP; |
|
805 |
|
806 try |
|
807 { |
|
808 if (device.tracking) device.new_Object(image); |
|
809 } |
|
810 catch (Error e) |
|
811 { |
|
812 OS.Image_Dispose(device.handle, handle); |
|
813 throw e; |
|
814 } |
|
815 |
|
816 return image; |
|
817 } |
775 } |
818 } |