Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSBitmapImageRep.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children | 62202ce0039f |
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; enum NSTIFFCompression : NSUInteger { NSTIFFCompressionNone = 1, NSTIFFCompressionCCITTFAX3 = 3, NSTIFFCompressionCCITTFAX4 = 4, NSTIFFCompressionLZW = 5, NSTIFFCompressionJPEG = 6, NSTIFFCompressionNEXT = 32766, NSTIFFCompressionPackBits = 32773, NSTIFFCompressionOldJPEG = 32865 } enum NSBitmapFormat : NSUInteger { NSAlphaFirstBitmapFormat = 1 << 0, NSAlphaNonpremultipliedBitmapFormat = 1 << 1, NSFloatingPointSamplesBitmapFormat = 1 << 2 } public class NSBitmapImageRep : NSImageRep { public this () { super(); } public this (objc.id id) { super(id); } public this (cocoa.id id) { super(id); } public objc.id bitmapData () { return 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 null ? this : 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 null ? this : 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); } }