Show
Ignore:
Timestamp:
05/17/08 11:34:28 (8 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Update to SWT 3.4M7

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/graphics/Pattern.d

    r212 r213  
    4444 */ 
    4545public class Pattern : Resource { 
    46  
     46    alias Resource.init_ init_; 
    4747    /** 
    4848     * the OS resource for the Pattern 
     
    8383 */ 
    8484public this(Device device, Image image) { 
    85     if (device is null) device = Device.getDevice(); 
    86     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     85    super(device); 
    8786    if (image is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    8887    if (image.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    89     this.device = device; 
    90     device.checkGDIP(); 
    91     int[] gdipImage = image.createGdipImage(); 
    92     auto img = cast(Gdip.Image)gdipImage[0]; 
     88    this.device.checkGDIP(); 
     89    int /*long*/[] gdipImage = image.createGdipImage(); 
     90    auto img = cast(Gdip.Image) gdipImage[0]; 
    9391    int width = Gdip.Image_GetWidth(img); 
    9492    int height = Gdip.Image_GetHeight(img); 
     
    10098    } 
    10199    if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES); 
    102     if (device.tracking) device.new_Object(this); 
     100    init_(); 
    103101} 
    104102 
     
    176174 */ 
    177175public this(Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2) { 
    178     if (device is null) device = Device.getDevice(); 
    179     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     176    super(device); 
    180177    if (color1 is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    181178    if (color1.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    182179    if (color2 is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    183180    if (color2.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    184     this.device = device; 
    185     device.checkGDIP(); 
     181    this.device.checkGDIP(); 
    186182    auto colorRef1 = color1.handle; 
    187183    int rgb = ((colorRef1 >> 16) & 0xFF) | (colorRef1 & 0xFF00) | ((colorRef1 & 0xFF) << 16); 
     
    216212            f[1] = 0.5f; 
    217213            f[2] = 1; 
    218             Gdip.LinearGradientBrush_SetInterpolationColors( cast(Gdip.LinearGradientBrush)handle, c, f, 3); 
     214            Gdip.LinearGradientBrush_SetInterpolationColors( cast(Gdip.LinearGradientBrush)handle, c.ptr, f.ptr, 3); 
    219215            Gdip.Color_delete(midColor); 
    220216        } 
     
    222218    } 
    223219    Gdip.Color_delete(foreColor); 
    224     if (device.tracking) device.new_Object(this); 
    225 
    226  
    227 /** 
    228  * Disposes of the operating system resources associated with 
    229  * the Pattern. Applications must dispose of all Patterns that 
    230  * they allocate. 
    231  */ 
    232 override public void dispose() { 
    233     if (handle is null) return; 
    234     if (device.isDisposed()) return; 
     220    init_(); 
     221
     222 
     223void destroy() { 
    235224    int type = Gdip.Brush_GetType(handle); 
    236225    switch (type) { 
     
    250239    } 
    251240    handle = null; 
    252     if (device.tracking) device.dispose_Object(this); 
    253     device = null; 
    254241} 
    255242