view dstep/quartzcore/CIImageProvider.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
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.CIImageProvider;

import dstep.foundation.NSDictionary;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;
import dstep.quartzcore.CIImage;

import bindings = dstep.quartzcore.CIImageProvider_bindings;

private
{
	NSString kCIImageProviderTileSize_;
	NSString kCIImageProviderUserInfo_;
}

NSString kCIImageProviderTileSize ()
{
	if (kCIImageProviderTileSize_)
		return kCIImageProviderTileSize_;

	return kCIImageProviderTileSize_ = new NSString(bindings.kCIImageProviderTileSize);
}

NSString kCIImageProviderUserInfo ()
{
	if (kCIImageProviderUserInfo_)
		return kCIImageProviderUserInfo_;

	return kCIImageProviderUserInfo_ = new NSString(bindings.kCIImageProviderUserInfo);
}

const TCIImageProvider = `

	static CIImage imageWithImageProvider (Object p, size_t width, size_t height, CIFormat f, CGColorSpaceRef cs, NSDictionary dict)
	{
		return invokeObjcSelfClass!(CIImage, "imageWithImageProvider:size::format:colorSpace:options:", Object, size_t, size_t, CIFormat, CGColorSpaceRef, NSDictionary)(p, width, height, f, cs, dict);
	}

	typeof(this) initWithImageProvider (Object p, size_t width, size_t height, CIFormat f, CGColorSpaceRef cs, NSDictionary dict)
	{
		id result = invokeObjcSelf!(id, "initWithImageProvider:size::format:colorSpace:options:", Object, size_t, size_t, CIFormat, CGColorSpaceRef, NSDictionary)(p, width, height, f, cs, dict);
		return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null);
	}

	this (Object p, size_t width, size_t height, CIFormat f, CGColorSpaceRef cs, NSDictionary dict)
	{
		super(typeof(this).alloc.initWithImageProvider(p, width, height, f, cs, dict).objcObject);
	}

	//mixin ObjcBindClassMethod!(imageWithImageProvider, "imageWithImageProvider:size::format:colorSpace:options:");
	//mixin ObjcBindMethod!(initWithImageProvider, "initWithImageProvider:size::format:colorSpace:options:");

`;