Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSBitmapImageRep.d @ 129:ad4e1fe71a5a
Fixed runtime errors
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 18 Jan 2009 18:39:46 +0100 |
parents | 62202ce0039f |
children |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D programming language: * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.internal.cocoa.NSBitmapImageRep; import dwt.internal.c.Carbon; import cocoa = dwt.internal.cocoa.id; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSColor; import dwt.internal.cocoa.NSData; import dwt.internal.cocoa.NSDictionary; import dwt.internal.cocoa.NSImageRep; import dwt.internal.cocoa.NSRect; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; import dwt.internal.objc.cocoa.Cocoa; import objc = dwt.internal.objc.runtime; public class NSBitmapImageRep : NSImageRep { public this () { super(); } public this (objc.id id) { super(id); } public this (cocoa.id id) { super(id); } public ubyte* bitmapData () { return cast(ubyte*) OS.objc_msgSend(this.id, OS.sel_bitmapData); } public NSInteger bitsPerPixel () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_bitsPerPixel); } public NSInteger bytesPerPlane () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_bytesPerPlane); } public NSInteger bytesPerRow () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_bytesPerRow); } public NSBitmapImageRep initWithBitmapDataPlanes (ubyte** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, NSString colorSpaceName, NSBitmapFormat bitmapFormat, NSInteger rBytes, NSInteger pBits) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_, planes, width, height, bps, spp, alpha, isPlanar, colorSpaceName !is null ? colorSpaceName.id : null, bitmapFormat, rBytes, pBits); return result is this.id ? this : (result !is null ? new NSBitmapImageRep(result) : null); } public NSBitmapImageRep initWithBitmapDataPlanes (ubyte** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, NSString colorSpaceName, NSInteger rBytes, NSInteger pBits) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_, planes, width, height, bps, spp, alpha, isPlanar, colorSpaceName !is null ? colorSpaceName.id : null, rBytes, pBits); return result is this.id ? this : (result !is null ? new NSBitmapImageRep(result) : null); } public bool isPlanar () { return OS.objc_msgSend_bool(this.id, OS.sel_isPlanar); } public NSInteger samplesPerPixel () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_samplesPerPixel); } }