comparison dwt/graphics/Image.d @ 246:fd9c62a2998e

Updater SWT 3.4M7 to 3.4
author Frank Benoit <benoit@tionex.de>
date Tue, 01 Jul 2008 10:15:59 +0200
parents e2affbeb686d
children 555d58850cd9
comparison
equal deleted inserted replaced
245:d8c3d4a4f2b0 246:fd9c62a2998e
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2000, 2007 IBM Corporation and others. 2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
82 * </p> 82 * </p>
83 * 83 *
84 * @see Color 84 * @see Color
85 * @see ImageData 85 * @see ImageData
86 * @see ImageLoader 86 * @see ImageLoader
87 * @see <a href="http://www.eclipse.org/swt/snippets/#image">Image snippets</a>
88 * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Examples: GraphicsExample, ImageAnalyzer</a>
89 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
87 */ 90 */
88 91
89 public final class Image : Resource, Drawable { 92 public final class Image : Resource, Drawable {
90 93
91 alias Resource.init_ init_; 94 alias Resource.init_ init_;
115 public HGDIOBJ handle; 118 public HGDIOBJ handle;
116 119
117 /** 120 /**
118 * specifies the transparent pixel 121 * specifies the transparent pixel
119 */ 122 */
120 int transparentPixel = -1; 123 int transparentPixel = -1, transparentColor = -1;
121 124
122 /** 125 /**
123 * the GC which is drawing on the image 126 * the GC which is drawing on the image
124 */ 127 */
125 GC memGC; 128 GC memGC;
201 /** 204 /**
202 * Constructs a new instance of this class based on the 205 * Constructs a new instance of this class based on the
203 * provided image, with an appearance that varies depending 206 * provided image, with an appearance that varies depending
204 * on the value of the flag. The possible flag values are: 207 * on the value of the flag. The possible flag values are:
205 * <dl> 208 * <dl>
206 * <dt><b>IMAGE_COPY</b></dt> 209 * <dt><b>{@link DWT#IMAGE_COPY}</b></dt>
207 * <dd>the result is an identical copy of srcImage</dd> 210 * <dd>the result is an identical copy of srcImage</dd>
208 * <dt><b>IMAGE_DISABLE</b></dt> 211 * <dt><b>{@link DWT#IMAGE_DISABLE}</b></dt>
209 * <dd>the result is a copy of srcImage which has a <em>disabled</em> look</dd> 212 * <dd>the result is a copy of srcImage which has a <em>disabled</em> look</dd>
210 * <dt><b>IMAGE_GRAY</b></dt> 213 * <dt><b>{@link DWT#IMAGE_GRAY}</b></dt>
211 * <dd>the result is a copy of srcImage which has a <em>gray scale</em> look</dd> 214 * <dd>the result is a copy of srcImage which has a <em>gray scale</em> look</dd>
212 * </dl> 215 * </dl>
213 * 216 *
214 * @param device the device on which to create the image 217 * @param device the device on which to create the image
215 * @param srcImage the image to use as the source 218 * @param srcImage the image to use as the source
2093 static if (OS.IsWinCE) return; 2096 static if (OS.IsWinCE) return;
2094 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 2097 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
2095 if (color is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 2098 if (color is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
2096 if (color.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 2099 if (color.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
2097 if (transparentPixel is -1) return; 2100 if (transparentPixel is -1) return;
2101 transparentColor = -1;
2098 2102
2099 /* Get the HDC for the device */ 2103 /* Get the HDC for the device */
2100 auto hDC = device.internal_new_GC(null); 2104 auto hDC = device.internal_new_GC(null);
2101 2105
2102 /* Change the background color in the image */ 2106 /* Change the background color in the image */