Mercurial > projects > dwt-linux
comparison dwt/graphics/Image.d @ 216:997624cece6a
renames init() to init_() to avoid problems in tango collections in jface port
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Apr 2008 22:24:08 +0200 |
parents | 08789b28bdf3 |
children | 380bad9f6852 |
comparison
equal
deleted
inserted
replaced
215:8e159d7052e0 | 216:997624cece6a |
---|---|
192 * </ul> | 192 * </ul> |
193 */ | 193 */ |
194 public this(Device device, int width, int height) { | 194 public this(Device device, int width, int height) { |
195 if (device is null) device = Device.getDevice(); | 195 if (device is null) device = Device.getDevice(); |
196 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 196 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
197 init(device, width, height); | 197 init_(device, width, height); |
198 if (device.tracking) device.new_Object(this); | 198 if (device.tracking) device.new_Object(this); |
199 } | 199 } |
200 | 200 |
201 /** | 201 /** |
202 * Constructs a new instance of this class based on the | 202 * Constructs a new instance of this class based on the |
394 */ | 394 */ |
395 public this(Device device, Rectangle bounds) { | 395 public this(Device device, Rectangle bounds) { |
396 if (device is null) device = Device.getDevice(); | 396 if (device is null) device = Device.getDevice(); |
397 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 397 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
398 if (bounds is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 398 if (bounds is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
399 init(device, bounds.width, bounds.height); | 399 init_(device, bounds.width, bounds.height); |
400 if (device.tracking) device.new_Object(this); | 400 if (device.tracking) device.new_Object(this); |
401 } | 401 } |
402 | 402 |
403 /** | 403 /** |
404 * Constructs an instance of this class from the given | 404 * Constructs an instance of this class from the given |
419 * </ul> | 419 * </ul> |
420 */ | 420 */ |
421 public this(Device device, ImageData data) { | 421 public this(Device device, ImageData data) { |
422 if (device is null) device = Device.getDevice(); | 422 if (device is null) device = Device.getDevice(); |
423 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 423 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
424 init(device, data); | 424 init_(device, data); |
425 if (device.tracking) device.new_Object(this); | 425 if (device.tracking) device.new_Object(this); |
426 } | 426 } |
427 | 427 |
428 /** | 428 /** |
429 * Constructs an instance of this class, whose type is | 429 * Constructs an instance of this class, whose type is |
460 } | 460 } |
461 mask = ImageData.convertMask (mask); | 461 mask = ImageData.convertMask (mask); |
462 ImageData image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data); | 462 ImageData image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data); |
463 image.maskPad = mask.scanlinePad; | 463 image.maskPad = mask.scanlinePad; |
464 image.maskData = mask.data; | 464 image.maskData = mask.data; |
465 init(device, image); | 465 init_(device, image); |
466 if (device.tracking) device.new_Object(this); | 466 if (device.tracking) device.new_Object(this); |
467 } | 467 } |
468 | 468 |
469 /** | 469 /** |
470 * Constructs an instance of this class by loading its representation | 470 * Constructs an instance of this class by loading its representation |
515 * </ul> | 515 * </ul> |
516 */ | 516 */ |
517 public this(Device device, InputStream stream) { | 517 public this(Device device, InputStream stream) { |
518 if (device is null) device = Device.getDevice(); | 518 if (device is null) device = Device.getDevice(); |
519 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 519 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
520 init(device, new ImageData(stream)); | 520 init_(device, new ImageData(stream)); |
521 if (device.tracking) device.new_Object(this); | 521 if (device.tracking) device.new_Object(this); |
522 } | 522 } |
523 | 523 |
524 /** | 524 /** |
525 * Constructs an instance of this class by loading its representation | 525 * Constructs an instance of this class by loading its representation |
589 if (pixmap is null) DWT.error(DWT.ERROR_NO_HANDLES); | 589 if (pixmap is null) DWT.error(DWT.ERROR_NO_HANDLES); |
590 OS.g_object_unref (pixbuf); | 590 OS.g_object_unref (pixbuf); |
591 return; | 591 return; |
592 } | 592 } |
593 } catch (DWTException e) {} | 593 } catch (DWTException e) {} |
594 init(device, new ImageData(filename)); | 594 init_(device, new ImageData(filename)); |
595 if (device.tracking) device.new_Object(this); | 595 if (device.tracking) device.new_Object(this); |
596 } | 596 } |
597 | 597 |
598 void createAlphaMask (int width, int height) { | 598 void createAlphaMask (int width, int height) { |
599 if (device.useXRender && (alpha !is -1 || alphaData !is null)) { | 599 if (device.useXRender && (alpha !is -1 || alphaData !is null)) { |
965 */ | 965 */ |
966 public override hash_t toHash () { | 966 public override hash_t toHash () { |
967 return cast(hash_t)/*64*/pixmap; | 967 return cast(hash_t)/*64*/pixmap; |
968 } | 968 } |
969 | 969 |
970 void init(Device device, int width, int height) { | 970 void init_(Device device, int width, int height) { |
971 if (width <= 0 || height <= 0) { | 971 if (width <= 0 || height <= 0) { |
972 DWT.error (DWT.ERROR_INVALID_ARGUMENT); | 972 DWT.error (DWT.ERROR_INVALID_ARGUMENT); |
973 } | 973 } |
974 this.device = device; | 974 this.device = device; |
975 this.type = DWT.BITMAP; | 975 this.type = DWT.BITMAP; |
989 OS.gdk_draw_rectangle(pixmap, gdkGC, 1, 0, 0, width, height); | 989 OS.gdk_draw_rectangle(pixmap, gdkGC, 1, 0, 0, width, height); |
990 OS.g_object_unref(gdkGC); | 990 OS.g_object_unref(gdkGC); |
991 OS.gdk_colormap_free_colors(colormap, white, 1); | 991 OS.gdk_colormap_free_colors(colormap, white, 1); |
992 } | 992 } |
993 | 993 |
994 void init(Device device, ImageData image) { | 994 void init_(Device device, ImageData image) { |
995 if (image is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 995 if (image is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
996 this.device = device; | 996 this.device = device; |
997 int width = image.width; | 997 int width = image.width; |
998 int height = image.height; | 998 int height = image.height; |
999 PaletteData palette = image.palette; | 999 PaletteData palette = image.palette; |