Mercurial > projects > dstep
diff dstep/quartzcore/CIColor.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children | f8a3b67adfcb |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIColor.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,121 @@ +/** + * 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); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + 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"); + } + +} +