view dstep/quartzcore/CIColor.d @ 22:f8a3b67adfcb

Removed duplicated methods
author Jacob Carlborg <doob@me.com>
date Tue, 09 Feb 2010 18:02:03 +0100
parents 19885b43130e
children b9de51448c6b
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Sep 24, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.quartzcore.CIColor;

import dstep.applicationservices.coregraphics.CGBase;
import dstep.applicationservices.coregraphics.CGColor;
import dstep.applicationservices.coregraphics.CGColorSpace;
import dstep.foundation.NSCoder;
import dstep.foundation.NSObject;
import dstep.foundation.NSString;
import dstep.foundation.NSZone;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;
import dstep.quartzcore.CIVector;

class CIColor : NSObject, INSCoding, INSCopying
{
	mixin (ObjcWrap);
	
	typeof(this) copyWithZone (NSZone* zone)
	{
		return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
	}
	
	this (NSCoder aDecoder)
	{
		super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
	}
	
	void encodeWithCoder (NSCoder aCoder)
	{
		return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
	}
	
	typeof(this) initWithCoder (NSCoder aDecoder)
	{
		return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
	}

	static CIColor colorWithCGColor (CGColorRef c)
	{
		return invokeObjcSelfClass!(CIColor, "colorWithCGColor:", CGColorRef)(c);
	}

	static CIColor colorWithRed (CGFloat r, CGFloat g, CGFloat b, CGFloat a)
	{
		return invokeObjcSelfClass!(CIColor, "colorWithRed:green:blue:alpha:", CGFloat, CGFloat, CGFloat, CGFloat)(r, g, b, a);
	}

	static CIColor colorWithRed (CGFloat r, CGFloat g, CGFloat b)
	{
		return invokeObjcSelfClass!(CIColor, "colorWithRed:green:blue:", CGFloat, CGFloat, CGFloat)(r, g, b);
	}

	static CIColor colorWithString (NSString representation)
	{
		return invokeObjcSelfClass!(CIColor, "colorWithString:", NSString)(representation);
	}

	CIColor initWithCGColor (CGColorRef c)
	{
		id result = invokeObjcSelf!(id, "initWithCGColor:", CGColorRef)(c);
		return result is this.objcObject ? this : (result !is null ? new CIColor(result) : null);
	}

	this (CGColorRef c)
	{
		super(CIColor.alloc.initWithCGColor(c).objcObject);
	}

	uint numberOfComponents ()
	{
		return invokeObjcSelf!(uint, "numberOfComponents");
	}

	CGFloat* components ()
	{
		return invokeObjcSelf!(CGFloat*, "components");
	}

	CGFloat alpha ()
	{
		return invokeObjcSelf!(CGFloat, "alpha");
	}

	CGColorSpaceRef colorSpace ()
	{
		return invokeObjcSelf!(CGColorSpaceRef, "colorSpace");
	}

	CGFloat red ()
	{
		return invokeObjcSelf!(CGFloat, "red");
	}

	CGFloat green ()
	{
		return invokeObjcSelf!(CGFloat, "green");
	}

	CGFloat blue ()
	{
		return invokeObjcSelf!(CGFloat, "blue");
	}

	NSString stringRepresentation ()
	{
		return invokeObjcSelf!(NSString, "stringRepresentation");
	}

}