initial AntiGrain context skeleton

This commit is contained in:
Christopher Lloyd 2011-05-18 23:05:04 -04:00
parent 9d9389e587
commit 192b27647c
20 changed files with 818 additions and 5 deletions

View File

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034Identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFPlugInDynamicRegisterFunction</key>
<string></string>
<key>CFPlugInDynamicRegistration</key>
<string>NO</string>
<key>CFPlugInFactories</key>
<dict>
<key>00000000-0000-0000-0000-000000000000</key>
<string>MyFactoryFunction</string>
</dict>
<key>CFPlugInTypes</key>
<dict>
<key>00000000-0000-0000-0000-000000000000</key>
<array>
<string>00000000-0000-0000-0000-000000000000</string>
</array>
</dict>
<key>CFPlugInUnloadFunction</key>
<string></string>
<key>NSPrincipalClass</key>
<string>O2Context_AntiGrain</string>
</dict>
</plist>

View File

@ -0,0 +1,99 @@
#import "O2AGGContext.h"
#import "O2Defines_AntiGrain.h"
#import <stdio.h>
#ifdef ANTIGRAIN_PRESENT
#include <agg_basics.h>
#include <agg_pixfmt_rgba.h>
#include <agg_path_storage.h>
#include <agg_renderer_base.h>
#include <agg_scanline_u.h>
#include <agg_rasterizer_scanline_aa.h>
#include <agg_renderer_scanline.h>
#include <agg_conv_curve.h>
typedef agg::renderer_base<agg::pixfmt_bgra32> renderer_base;
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_aa;
typedef agg::renderer_scanline_bin_solid<renderer_base> renderer_aliased;
struct O2AGGContext {
agg::rendering_buffer *renderingBuffer;
agg::pixfmt_bgra32 pixelFormat;
agg::rasterizer_scanline_aa<> *rasterizer;
agg::path_storage path;
};
#else
struct O2AGGContext {
int notPresent;
};
#endif
O2AGGContextRef O2AGGContextCreateBGRA32(unsigned char *pixelBytes,size_t width,size_t height,size_t bytesPerRow) {
O2AGGContextRef self=(O2AGGContextRef)calloc(1,sizeof(struct O2AGGContext));
self->renderingBuffer=new agg::rendering_buffer(pixelBytes,width,height,bytesPerRow);
self->pixelFormat.attach(*(self->renderingBuffer));
self->rasterizer=new agg::rasterizer_scanline_aa<>();
return self;
}
void O2AGGContextBeginPath(O2AGGContextRef self) {
self->path.remove_all();
}
void O2AGGContextMoveTo(O2AGGContextRef self,double x,double y) {
self->path.move_to(x,y);
}
void O2AGGContextAddLineTo(O2AGGContextRef self,double x,double y) {
self->path.line_to(x,y);
}
void O2AGGContextAddCurveToPoint(O2AGGContextRef self,double cp1x,double cp1y,double cp2x,double cp2y,double endx,double endy) {
self->path.curve4(cp1x,cp1y,cp2x,cp2y,endx,endy);
}
void O2AGGContextAddQuadCurveToPoint(O2AGGContextRef self,double cp1x,double cp1y,double endx,double endy) {
self->path.curve3(cp1x,cp1y,endx,endy);
}
void O2AGGContextCloseSubpath(O2AGGContextRef self) {
self->path.close_polygon();
}
void O2AGGContextClipReset(O2AGGContextRef self) {
// self->renderer.reset_clipping(1);
}
void O2AGGContextClipToPath(O2AGGContextRef self,int evenOdd) {
}
void O2AGGContextFillPath(O2AGGContextRef self,float r,float g,float b,float a,double xa,double xb,double xc,double xd,double xtx,double xty) {
renderer_base ren_base(self->pixelFormat);
renderer_aa ren_aa(ren_base);
agg::scanline_u8 sl;
ren_aa.color(agg::rgba(r,g,b,a));
printf("%s %d %f %f %f %f %f %f\n",__FILE__,__LINE__,xa,xb,xc,xd,xtx,xty);
agg::trans_affine mtx(xa,xb,xc,xd,xtx,xty);
printf("%s %d\n",__FILE__,__LINE__);
agg::conv_transform<agg::path_storage, agg::trans_affine> trans(self->path, mtx);
printf("%s %d\n",__FILE__,__LINE__);
self->rasterizer->add_path(trans);
printf("%s %d\n",__FILE__,__LINE__);
self->rasterizer->filling_rule(agg::fill_non_zero);
printf("%s %d\n",__FILE__,__LINE__);
render_scanlines(*(self->rasterizer),sl,ren_aa);
printf("%s %d\n",__FILE__,__LINE__);
#if 0
agg::make_polygon(&pf,&curve,0);
agg::render_polygon(&renderer,&pf);
agg::render_scanlines_aa_solid(rasterizer,sl,renderer,agg::rgba8(0,0,0));
#endif
}

View File

@ -0,0 +1,28 @@
#import <stdlib.h>
// There are some constructs in Onyx2D which cause compiler crashes with ObjC++
// So we're just wrapping the AGG calls with straight C until it is sorted out.
#ifdef __cplusplus
extern "C" {
#endif
typedef struct O2AGGContext *O2AGGContextRef;
O2AGGContextRef O2AGGContextCreateBGRA32(unsigned char *pixelBytes,size_t width,size_t height,size_t bytesPerRow);
void O2AGGContextBeginPath(O2AGGContextRef self);
void O2AGGContextMoveTo(O2AGGContextRef self,double x,double y);
void O2AGGContextAddLineTo(O2AGGContextRef self,double x,double y);
void O2AGGContextAddCurveToPoint(O2AGGContextRef self,double cp1x,double cp1y,double cp2x,double cp2y,double endx,double endy);
void O2AGGContextAddQuadCurveToPoint(O2AGGContextRef self,double cp1x,double cp1y,double endx,double endy);
void O2AGGContextCloseSubpath(O2AGGContextRef self);
void O2AGGContextClipReset(O2AGGContextRef self);
void O2AGGContextClipToPath(O2AGGContextRef self,int evenOdd);
void O2AGGContextFillPath(O2AGGContextRef self,float r,float g,float b,float a,double xa,double xb,double xc,double xd,double xtx,double xty);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,9 @@
#import <Onyx2D/O2Context_builtin_gdi.h>
#import "O2AGGContext.h"
@interface O2Context_AntiGrain : O2Context_builtin_gdi {
O2AGGContextRef _agg;
}
@end

View File

@ -0,0 +1,125 @@
#import "O2Context_AntiGrain.h"
#import <Onyx2D/O2Surface.h>
#import <Onyx2D/O2GraphicsState.h>
#import <Onyx2D/O2ClipState.h>
#import <Onyx2D/O2ClipPhase.h>
#import <Onyx2D/O2MutablePath.h>
#import "O2AGGContext.h"
@implementation O2Context_AntiGrain
-initWithSurface:(O2Surface *)surface flipped:(BOOL)flipped {
[super initWithSurface:surface flipped:flipped];
_agg=O2AGGContextCreateBGRA32((unsigned char *)O2SurfaceGetPixelBytes(surface),O2SurfaceGetWidth(surface),O2SurfaceGetHeight(surface),O2SurfaceGetBytesPerRow(surface));
// if _agg is NULL here it's
return self;
}
static void transferPath(O2AGGContextRef agg,O2PathRef path,O2AffineTransform xform){
const unsigned char *elements=O2PathElements(path);
const O2Point *points=O2PathPoints(path);
unsigned i,numberOfElements=O2PathNumberOfElements(path),pointIndex;
pointIndex=0;
for(i=0;i<numberOfElements;i++){
switch(elements[i]){
case kO2PathElementMoveToPoint:{
NSPoint point=O2PointApplyAffineTransform(points[pointIndex++],xform);
O2AGGContextMoveTo(agg,point.x,point.y);
}
break;
case kO2PathElementAddLineToPoint:{
NSPoint point=O2PointApplyAffineTransform(points[pointIndex++],xform);
O2AGGContextAddLineTo(agg,point.x,point.y);
}
break;
case kO2PathElementAddCurveToPoint:{
NSPoint cp1=O2PointApplyAffineTransform(points[pointIndex++],xform);
NSPoint cp2=O2PointApplyAffineTransform(points[pointIndex++],xform);
NSPoint end=O2PointApplyAffineTransform(points[pointIndex++],xform);
O2AGGContextAddCurveToPoint(agg,cp1.x,cp1.y,cp2.x,cp2.y,end.x,end.y);
}
break;
case kO2PathElementAddQuadCurveToPoint:{
NSPoint cp1=O2PointApplyAffineTransform(points[pointIndex++],xform);
NSPoint cp2=O2PointApplyAffineTransform(points[pointIndex++],xform);
O2AGGContextAddQuadCurveToPoint(agg,cp1.x,cp1.y,cp2.x,cp2.y);
}
break;
case kO2PathElementCloseSubpath:
O2AGGContextCloseSubpath(agg);
break;
}
}
}
-(void)clipToState:(O2ClipState *)clipState {
[super clipToState:clipState];
O2GState *gState=O2ContextCurrentGState(self);
NSArray *phases=[O2GStateClipState(gState) clipPhases];
int i,count=[phases count];
// O2DeviceContextClipReset_gdi(_dc);
for(i=0;i<count;i++){
O2ClipPhase *phase=[phases objectAtIndex:i];
O2Path *path;
switch(O2ClipPhasePhaseType(phase)){
case O2ClipPhaseNonZeroPath:
path=O2ClipPhaseObject(phase);
// O2DeviceContextClipToNonZeroPath_gdi(_dc,path,O2AffineTransformIdentity,O2AffineTransformIdentity);
break;
case O2ClipPhaseEOPath:
path=O2ClipPhaseObject(phase);
// O2DeviceContextClipToEvenOddPath_gdi(_dc,path,O2AffineTransformIdentity,O2AffineTransformIdentity);
break;
case O2ClipPhaseMask:
break;
}
}
}
-(void)drawPath:(O2PathDrawingMode)drawingMode {
O2GState *gState=O2ContextCurrentGState(self);
if(drawingMode==kO2PathFill){
O2ColorRef rgbColor=O2ColorConvertToDeviceRGB(gState->_fillColor);
const float *components=O2ColorGetComponents(rgbColor);
transferPath(_agg,(O2PathRef)_path,O2AffineTransformInvert(gState->_userSpaceTransform));
O2AffineTransform deviceTransform=gState->_deviceSpaceTransform;
O2AGGContextFillPath(_agg,components[0],components[1],components[2],components[3],
deviceTransform.a,deviceTransform.b,deviceTransform.c,deviceTransform.d,deviceTransform.tx,deviceTransform.ty);
O2ColorRelease(rgbColor);
O2PathReset(_path);
}
else {
// O2PathReset(_path);
[super drawPath:drawingMode];
}
}
@end

View File

@ -0,0 +1,394 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
8D576314048677EA00EA77CD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* Foundation.framework */; };
8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; };
FE5C8314121D81470063E96F /* O2Context_AntiGrain.m in Sources */ = {isa = PBXBuildFile; fileRef = FE5C8313121D81470063E96F /* O2Context_AntiGrain.m */; };
FEB99C471382CDFE0072F784 /* O2AGGContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB99C461382CDFE0072F784 /* O2AGGContext.cpp */; };
FEE163EA137C6DAD00B2F340 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FEE163E9137C6DAD00B2F340 /* AppKit.framework */; };
/* End PBXBuildFile section */
/* Begin PBXBuildRule section */
FE5C82FA121D67BB0063E96F /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = org.cocotron.1.0.windows.i386.gcc.default;
fileType = sourcecode.c;
isEditable = 1;
outputFiles = (
);
};
FEB99E5B138417F20072F784 /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = org.cocotron.1.0.windows.i386.gcc.default;
fileType = sourcecode.cpp;
isEditable = 1;
outputFiles = (
);
};
/* End PBXBuildRule section */
/* Begin PBXContainerItemProxy section */
FEE16435137C6DC800B2F340 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FEE163EC137C6DC600B2F340 /* AppKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = FE01AAC10C5D9BCB00AEA51A;
remoteInfo = "AppKit-Windows-i386";
};
FEE16437137C6DC800B2F340 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FEE163EC137C6DC600B2F340 /* AppKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = C889770C0EA0BF3100D0A0A2;
remoteInfo = "AppKit-Linux-i386";
};
FEE16439137C6DC800B2F340 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FEE163EC137C6DC600B2F340 /* AppKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = C8A2E5730F07EA1F0054397C;
remoteInfo = "AppKit-Darwin-i386";
};
FEE1643B137C6DC800B2F340 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FEE163EC137C6DC600B2F340 /* AppKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = FEA3164C0FD5667D00F480D4;
remoteInfo = "AppKit-MacOS-i386";
};
FEE1643D137C6DC800B2F340 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FEE163EC137C6DC600B2F340 /* AppKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = FE5A8BE310C6F50E005E348A;
remoteInfo = "AppKit-FreeBSD-i386";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
0AA1909FFE8422F4C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
8D576316048677EA00EA77CD /* O2Context_AntiGrain.cgContext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = O2Context_AntiGrain.cgContext; sourceTree = BUILT_PRODUCTS_DIR; };
8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FE5C8312121D81470063E96F /* O2Context_AntiGrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = O2Context_AntiGrain.h; sourceTree = "<group>"; };
FE5C8313121D81470063E96F /* O2Context_AntiGrain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = O2Context_AntiGrain.m; sourceTree = "<group>"; };
FEB99C451382CDFE0072F784 /* O2AGGContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = O2AGGContext.h; sourceTree = "<group>"; };
FEB99C461382CDFE0072F784 /* O2AGGContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = O2AGGContext.cpp; sourceTree = "<group>"; };
FEE163E9137C6DAD00B2F340 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
FEE163EC137C6DC600B2F340 /* AppKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AppKit.xcodeproj; path = ../AppKit/AppKit.xcodeproj; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D576313048677EA00EA77CD /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D576314048677EA00EA77CD /* Foundation.framework in Frameworks */,
FEE163EA137C6DAD00B2F340 /* AppKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
089C166AFE841209C02AAC07 /* O2Context_AntiGrain */ = {
isa = PBXGroup;
children = (
FEE163EC137C6DC600B2F340 /* AppKit.xcodeproj */,
FE5C8312121D81470063E96F /* O2Context_AntiGrain.h */,
FE5C8313121D81470063E96F /* O2Context_AntiGrain.m */,
089C167CFE841241C02AAC07 /* Resources */,
089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
19C28FB6FE9D52B211CA2CBB /* Products */,
FEB99C451382CDFE0072F784 /* O2AGGContext.h */,
FEB99C461382CDFE0072F784 /* O2AGGContext.cpp */,
);
name = O2Context_AntiGrain;
sourceTree = "<group>";
};
089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
0AA1909FFE8422F4C02AAC07 /* Foundation.framework */,
FEE163E9137C6DAD00B2F340 /* AppKit.framework */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
089C167CFE841241C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
8D576317048677EA00EA77CD /* Info.plist */,
8D5B49A704867FD3000E48DA /* InfoPlist.strings */,
);
name = Resources;
sourceTree = "<group>";
};
19C28FB6FE9D52B211CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D576316048677EA00EA77CD /* O2Context_AntiGrain.cgContext */,
);
name = Products;
sourceTree = "<group>";
};
FEE163ED137C6DC600B2F340 /* Products */ = {
isa = PBXGroup;
children = (
FEE16436137C6DC800B2F340 /* AppKit.framework */,
FEE16438137C6DC800B2F340 /* AppKit.framework */,
FEE1643A137C6DC800B2F340 /* AppKit.framework */,
FEE1643C137C6DC800B2F340 /* AppKit.framework */,
FEE1643E137C6DC800B2F340 /* AppKit.framework */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D57630D048677EA00EA77CD /* O2Context_AntiGrain-Windows-i386 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "O2Context_AntiGrain-Windows-i386" */;
buildPhases = (
FEE16442137C6DDA00B2F340 /* Check for AntiGrain Library */,
8D57630F048677EA00EA77CD /* Resources */,
8D576311048677EA00EA77CD /* Sources */,
8D576313048677EA00EA77CD /* Frameworks */,
);
buildRules = (
FEB99E5B138417F20072F784 /* PBXBuildRule */,
FE5C82FA121D67BB0063E96F /* PBXBuildRule */,
);
dependencies = (
);
name = "O2Context_AntiGrain-Windows-i386";
productInstallPath = "$(HOME)/Library/Bundles";
productName = O2Context_AntiGrain;
productReference = 8D576316048677EA00EA77CD /* O2Context_AntiGrain.cgContext */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "O2Context_AntiGrain" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 089C166AFE841209C02AAC07 /* O2Context_AntiGrain */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = FEE163ED137C6DC600B2F340 /* Products */;
ProjectRef = FEE163EC137C6DC600B2F340 /* AppKit.xcodeproj */;
},
);
projectRoot = "";
targets = (
8D57630D048677EA00EA77CD /* O2Context_AntiGrain-Windows-i386 */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
FEE16436137C6DC800B2F340 /* AppKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = AppKit.framework;
remoteRef = FEE16435137C6DC800B2F340 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
FEE16438137C6DC800B2F340 /* AppKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = AppKit.framework;
remoteRef = FEE16437137C6DC800B2F340 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
FEE1643A137C6DC800B2F340 /* AppKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = AppKit.framework;
remoteRef = FEE16439137C6DC800B2F340 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
FEE1643C137C6DC800B2F340 /* AppKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = AppKit.framework;
remoteRef = FEE1643B137C6DC800B2F340 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
FEE1643E137C6DC800B2F340 /* AppKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = AppKit.framework;
remoteRef = FEE1643D137C6DC800B2F340 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
8D57630F048677EA00EA77CD /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
FEE16442137C6DDA00B2F340 /* Check for AntiGrain Library */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check for AntiGrain Library";
outputPaths = (
"$(DERIVED_FILE_DIR)/O2Defines_AntiGrain.h",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/sh\necho \"\" > $DERIVED_FILE_DIR/O2Defines_AntiGrain.h\n\nif [ -d /Developer/Cocotron/1.0/Windows/i386/agg-2.5 ]; then\n echo \"#define ANTIGRAIN_2_5 1\" >> $DERIVED_FILE_DIR/O2Defines_AntiGrain.h\n ANTIGRAIN_PRESENT=YES\necho \"2.5 present!\"\nfi\n\nif [ -d /Developer/Cocotron/1.0/Windows/i386/agg-2.4 ]; then\n echo \"#define ANTIGRAIN_2_4 1\" >> $DERIVED_FILE_DIR/O2Defines_AntiGrain.h\n ANTIGRAIN_PRESENT=YES\necho \"2.4 present!\"\nfi\n\nif [ \"$ANTIGRAIN_PRESENT\" = \"YES\" ];then\n echo \"#define ANTIGRAIN_PRESENT 1\" >> $DERIVED_FILE_DIR/O2Defines_AntiGrain.h\nfi\n\n\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D576311048677EA00EA77CD /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FE5C8314121D81470063E96F /* O2Context_AntiGrain.m in Sources */,
FEB99C471382CDFE0072F784 /* O2AGGContext.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C167EFE841241C02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
1DEB911B08733D790010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = i386;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = stabs;
DEPLOYMENT_LOCATION = YES;
DSTROOT = /;
EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Windows";
EXECUTABLE_SUFFIX = .1.0.dll;
FRAMEWORK_SEARCH_PATHS = /Developer/Cocotron/1.0/Windows/i386/Frameworks;
GCC_DYNAMIC_NO_PIC = NO;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
HEADER_SEARCH_PATHS = "/Developer/Cocotron/1.0/Windows/i386/agg-2.4/include/";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = /Developer/Cocotron/1.0/Windows/i386/Frameworks/AppKit.framework/Resources;
OTHER_CFLAGS = "-D__LITTLE_ENDIAN__";
OTHER_LDFLAGS = (
"-shared",
"-Wl,--enable-auto-import",
);
PRODUCT_NAME = O2Context_AntiGrain;
SDKROOT = "";
SYMROOT = build/Windows/i386;
WRAPPER_EXTENSION = cgContext;
};
name = Debug;
};
1DEB911C08733D790010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = i386;
DEBUG_INFORMATION_FORMAT = stabs;
DEPLOYMENT_LOCATION = YES;
DSTROOT = /;
EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Windows";
EXECUTABLE_SUFFIX = .1.0.dll;
FRAMEWORK_SEARCH_PATHS = /Developer/Cocotron/1.0/Windows/i386/Frameworks;
GCC_MODEL_TUNING = G5;
HEADER_SEARCH_PATHS = "/Developer/Cocotron/1.0/Windows/i386/agg-2.4/include/";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = /Developer/Cocotron/1.0/Windows/i386/Frameworks/AppKit.framework/Resources;
LIBRARY_SEARCH_PATHS = "/Developer/Cocotron/1.0/Windows/i386/agg-2.4";
OTHER_CFLAGS = "-D__LITTLE_ENDIAN__";
OTHER_LDFLAGS = (
"-static",
"-lagg",
"-shared",
"-Wl,--enable-auto-import",
);
PRODUCT_NAME = O2Context_AntiGrain;
SDKROOT = "";
SYMROOT = build/Windows/i386;
WRAPPER_EXTENSION = cgContext;
};
name = Release;
};
1DEB911F08733D790010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Debug;
};
1DEB912008733D790010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "O2Context_AntiGrain-Windows-i386" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB911B08733D790010E9CD /* Debug */,
1DEB911C08733D790010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "O2Context_AntiGrain" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB911F08733D790010E9CD /* Debug */,
1DEB912008733D790010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 089C1669FE841209C02AAC07 /* Project object */;
}

View File

@ -8,6 +8,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Onyx2D/O2Geometry.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
O2Float a;
O2Float b;
@ -35,3 +39,6 @@ ONYX2D_EXPORT O2Point O2PointApplyAffineTransform(O2Point point, O2AffineTransfo
ONYX2D_EXPORT O2Size O2SizeApplyAffineTransform(O2Size size, O2AffineTransform xform);
#ifdef __cplusplus
}
#endif

View File

@ -2,6 +2,10 @@
#import <Onyx2D/O2Geometry.h>
#import <Onyx2D/O2AffineTransform.h>
#ifdef __cplusplus
extern "C" {
#endif
@class O2Path,O2Image;
typedef enum {
@ -25,3 +29,7 @@ O2ClipPhaseType O2ClipPhasePhaseType(O2ClipPhase *self);
id O2ClipPhaseObject(O2ClipPhase *self);
@end
#ifdef __cplusplus
}
#endif

View File

@ -9,6 +9,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/NSObject.h>
#import <Onyx2D/O2Geometry.h>
#ifdef __cplusplus
extern "C" {
#endif
@class O2Context,O2Color,O2Shading,O2Image,O2GState,O2MutablePath,O2Path,O2Pattern,O2Layer,O2PDFPage,NSMutableArray,CGWindow,O2Surface,NSDictionary,NSData,O2Font,O2Encoding,O2PDFCharWidths,O2ClipState;
typedef O2Context *O2ContextRef;
@ -367,3 +371,7 @@ O2GState *O2ContextCurrentGState(O2ContextRef self);
void O2ContextCopyBits(O2ContextRef self,O2Rect rect,O2Point point,int gState);
@end
#ifdef __cplusplus
}
#endif

View File

@ -31,6 +31,10 @@
#import <Onyx2D/O2Surface.h>
#import <Onyx2D/O2Paint.h>
#ifdef __cplusplus
extern "C" {
#endif
@class O2Paint;
typedef enum {
@ -114,3 +118,7 @@ void O2ContextDeviceClipToEvenOddPath_builtin(O2Context_builtin *self,O2Path *pa
void O2argb8u_sover_by_coverage(O2argb8u *src,O2argb8u *dst,unsigned coverage,int length);
@end
#ifdef __cplusplus
}
#endif

View File

@ -8,7 +8,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/Foundation.h>
#define ONYX2D_EXPORT
#ifdef __cplusplus
extern "C" {
#endif
#define ONYX2D_EXPORT extern
#define ONYX2D_STATIC static
#define ONYX2D_STATIC_INLINE static inline
@ -18,9 +22,9 @@ typedef NSPoint O2Point;
typedef NSSize O2Size;
typedef NSRect O2Rect;
const O2Rect O2RectZero;
const O2Point O2PointZero;
const O2Size O2SizeZero;
extern const O2Rect O2RectZero;
extern const O2Point O2PointZero;
extern const O2Size O2SizeZero;
static inline O2Rect O2RectMake(O2Float x, O2Float y, O2Float width, O2Float height) {
return NSMakeRect(x,y,width,height);
@ -78,3 +82,7 @@ static inline O2Rect O2RectIntegral(O2Rect rect){
return rect;
}
#ifdef __cplusplus
}
#endif

View File

@ -10,6 +10,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Onyx2D/O2Geometry.h>
#import <Onyx2D/O2Font.h>
#ifdef __cplusplus
extern "C" {
#endif
@class O2Image,O2ColorSpace,O2Color,O2Pattern,O2MutablePath,O2Path,NSArray,NSMutableArray,O2Font,O2Encoding,O2PDFCharWidths,O2ClipState;
@interface O2GState : NSObject {
@ -151,3 +155,7 @@ void O2GStateSetBlendMode(O2GState *self,O2BlendMode mode);
-(void)setAntialiasingQuality:(int)value;
@end
#ifdef __cplusplus
}
#endif

View File

@ -33,6 +33,10 @@
#import <Onyx2D/O2argb8u.h>
#import <Onyx2D/O2argb32f.h>
#ifdef __cplusplus
extern "C" {
#endif
@class O2Image;
typedef O2Image *O2ImageRef;
@ -219,3 +223,7 @@ void O2ImageIntegerTranslate_largb8u_PRE(O2Image *self,int x, int y,O2argb8u *sp
void O2ImageReadPatternSpan_largb8u_PRE(O2Image *self,O2Float x, O2Float y, O2argb8u *span,int length, O2AffineTransform surfaceToImage, O2PatternTiling distortion);
void O2ImageReadPatternSpan_largb32f_PRE(O2Image *self,O2Float x, O2Float y, O2argb32f *span,int length, O2AffineTransform surfaceToImage, O2PatternTiling distortion);
#ifdef __cplusplus
}
#endif

View File

@ -9,6 +9,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Onyx2D/O2Path.h>
#import <Onyx2D/O2Geometry.h>
#ifdef __cplusplus
extern "C" {
#endif
@interface O2MutablePath : O2Path <NSCopying> {
unsigned _capacityOfElements;
unsigned _capacityOfPoints;
@ -34,3 +38,7 @@ void O2PathApplyTransform(O2MutablePathRef self,const O2AffineTransform matrix);
void O2MutablePathEllipseToBezier(O2Point *cp,float x,float y,float xrad,float yrad);
@end
#ifdef __cplusplus
}
#endif

View File

@ -10,6 +10,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Onyx2D/O2Geometry.h>
#import <Onyx2D/O2AffineTransform.h>
#ifdef __cplusplus
extern "C" {
#endif
@class O2Path,O2MutablePath;
typedef O2Path *O2PathRef;
@ -61,3 +65,8 @@ O2PathRef O2PathCreateCopy(O2PathRef self);
BOOL O2PathContainsPoint(O2PathRef self,const O2AffineTransform *xform,O2Point point,BOOL evenOdd);
@end
#ifdef __cplusplus
}
#endif

View File

@ -32,6 +32,10 @@
#import <Onyx2D/VGmath.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned int RIuint32;
typedef short RIint16;
typedef unsigned int VGbitfield;
@ -70,6 +74,11 @@ typedef void (*O2SurfaceWriteSpan_argb32f)(O2Surface *self,int x,int y,O2argb32f
-(void)setWidth:(size_t)width height:(size_t)height reallocateOnlyIfRequired:(BOOL)roir;
void *O2SurfaceGetPixelBytes(O2Surface *surface);
size_t O2SurfaceGetWidth(O2Surface *surface);
size_t O2SurfaceGetHeight(O2Surface *surface);
size_t O2SurfaceGetBytesPerRow(O2Surface *surface);
O2ImageRef O2SurfaceCreateImage(O2Surface *surface);
BOOL O2SurfaceIsValidFormat(int format);
@ -91,3 +100,7 @@ void O2SurfaceGaussianBlur(O2Surface *self,O2Image * src, O2GaussianKernelRef ke
void O2SurfaceLookup(O2Surface *self,O2Surface * src, const uint8_t * redLUT, const uint8_t * greenLUT, const uint8_t * blueLUT, const uint8_t * alphaLUT, BOOL outputLinear, BOOL outputPremultiplied, BOOL filterFormatLinear, BOOL filterFormatPremultiplied, VGbitfield channelMask);
@end
#ifdef __cplusplus
}
#endif

View File

@ -551,6 +551,23 @@ static BOOL initFunctionsForParameters(O2Surface *self,size_t bitsPerComponent,s
}
}
void *O2SurfaceGetPixelBytes(O2Surface *surface) {
return surface->_pixelBytes;
}
size_t O2SurfaceGetWidth(O2Surface *surface) {
return surface->_width;
}
size_t O2SurfaceGetHeight(O2Surface *surface) {
return surface->_height;
}
size_t O2SurfaceGetBytesPerRow(O2Surface *surface) {
return surface->_bytesPerRow;
}
O2ImageRef O2SurfaceCreateImage(O2Surface *self) {
NSData *data=[[NSData alloc] initWithBytes:self->_pixelBytes length:self->_bytesPerRow*self->_height];
O2DataProviderRef provider=O2DataProviderCreateWithCFData(data);

View File

@ -9,6 +9,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <windows.h>
#import <Onyx2D/O2GlyphStencil.h>
#ifdef __cplusplus
extern "C" {
#endif
@class Win32Font,O2DeviceContext_gdi,O2DeviceContext_gdiDIBSection;
@interface O2Context_builtin_gdi : O2Context_builtin {
@ -30,3 +34,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
-(O2DeviceContext_gdi *)deviceContext;
@end
#ifdef __cplusplus
}
#endif

View File

@ -319,7 +319,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/Developer/Cocotron/1.0/bin/retargetBundle -framework Foundation -framework AppKit -framework CoreData -destination $TARGET_BUILD_DIR\"/\"$EXECUTABLE_FOLDER_PATH\ncp /Developer/Cocotron/1.0/Windows/i386/gcc-4.3.1/i386-mingw32msvc/bin/freetype6.dll \"$TARGET_BUILD_DIR\"/\"$EXECUTABLE_FOLDER_PATH\"\ncp /Developer/Cocotron/1.0/Windows/i386/gcc-4.3.1/i386-mingw32msvc/bin/zlib1.dll \"$TARGET_BUILD_DIR\"/\"$EXECUTABLE_FOLDER_PATH\"\n\n";
shellScript = "/Developer/Cocotron/1.0/bin/retargetBundle -framework Foundation -framework AppKit -framework CoreData -destination $TARGET_BUILD_DIR\"/\"$EXECUTABLE_FOLDER_PATH\n\n";
};
/* End PBXShellScriptBuildPhase section */