27 #import "BufImgSurfaceData.h"
28 #import "AWTFont.h"
29 #import <Cocoa/Cocoa.h>
30
31 // these flags are not defined on Tiger on PPC, so we need to make them a no-op
32 #if !defined(kCGBitmapByteOrder32Host)
33 #define kCGBitmapByteOrder32Host 0
34 #endif
35 #if !defined(kCGBitmapByteOrder16Host)
36 #define kCGBitmapByteOrder16Host 0
37 #endif
38
39 // NOTE : Modify the printSurfaceDataDiagnostics API if you change this enum
40 enum SDRenderType
41 {
42 SD_Nothing,
43 SD_Stroke,
44 SD_Fill,
45 SD_EOFill,
46 SD_Shade,
47 SD_Pattern,
48 SD_Image,
49 SD_Text,
50 SD_CopyArea,
51 SD_Queue,
52 SD_External
53 };
54 typedef enum SDRenderType SDRenderType;
55
56 struct _stateShadingInfo
57 {
58 CGPoint start;
59 CGPoint end;
60 CGFloat colors[8];
61 BOOL cyclic;
62 CGFloat length; // of the total segment (used by the cyclic gradient)
63 CGFloat period; // of the cycle (used by the cyclic gradient)
64 CGFloat offset; // of the cycle from the start (used by the cyclic gradient)
65 };
66 typedef struct _stateShadingInfo StateShadingInfo;
67
68 struct _statePatternInfo
69 {
70 CGFloat tx;
71 CGFloat ty;
72 CGFloat sx;
73 CGFloat sy;
74 jint width;
75 jint height;
76 jobject sdata;
77 };
78 typedef struct _statePatternInfo StatePatternInfo;
79
80 struct _stateGraphicsInfo
81 {
82 BOOL adjustedLineWidth;
83 BOOL adjustedAntialias;
84 BOOL antialiased;
85 jint interpolation;
86 BOOL simpleColor;
87 BOOL simpleStroke;
105 BOOL newContext;
106 CGContextRef cgRef;
107
108 jint* javaGraphicsStates;
109 jobject javaGraphicsStatesObjects;
110
111 SDRenderType renderType;
112
113 // rdar://problem/5214320
114 // Gradient/Texture fills of Java GeneralPath don't respect the even odd winding rule (quartz pipeline).
115 BOOL isEvenOddFill; // Tracks whether the original render type passed into
116 // SetUpCGContext(...) is SD_EOFILL.
117 // The reason for this field is because SetUpCGContext(...) can
118 // change the render type after calling SetUpPaint(...), and right
119 // after that, the possibly new render type is then assigned into
120 // qsdo->renderType. Sigh!!!
121 // This field is potentially used within CompleteCGContext(...) or
122 // its callees.
123
124 StateShadingInfo* shadingInfo; // tracks shading and its parameters
125 StatePatternInfo* patternInfo; // tracks pattern and its parameters
126 StateGraphicsInfo graphicsStateInfo; // tracks other graphics state
127
128 BOOL syncContentsToLayer; // should changed pixels be synced to a CALayer
129 CGRect updateRect; // used by the layer synchronization code to track update rects.
130 };
131
132 void SetUpCGContext(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
133 SDRenderType DoShapeUsingCG(CGContextRef cgRef, jint *types, jfloat *coords, jint numtypes, BOOL fill, CGFloat offsetX, CGFloat offsetY);
134 SDRenderType SetUpPaint(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
135 void CompleteCGContext(JNIEnv *env, QuartzSDOps *qsdo);
136
137 NSColor* ByteParametersToNSColor(JNIEnv* env, jint *javaGraphicsStates, NSColor* defColor);
138
139 #define JNF_COCOA_RENDERER_EXIT(env) \
140 } @catch(NSException *localException) { \
141 qsdo->FinishSurface(env, qsdo); \
142 [JNFException throwToJava:env exception:localException]; \
143 } \
144 if (_token) JNFNativeMethodExit(_token); \
|
27 #import "BufImgSurfaceData.h"
28 #import "AWTFont.h"
29 #import <Cocoa/Cocoa.h>
30
31 // these flags are not defined on Tiger on PPC, so we need to make them a no-op
32 #if !defined(kCGBitmapByteOrder32Host)
33 #define kCGBitmapByteOrder32Host 0
34 #endif
35 #if !defined(kCGBitmapByteOrder16Host)
36 #define kCGBitmapByteOrder16Host 0
37 #endif
38
39 // NOTE : Modify the printSurfaceDataDiagnostics API if you change this enum
40 enum SDRenderType
41 {
42 SD_Nothing,
43 SD_Stroke,
44 SD_Fill,
45 SD_EOFill,
46 SD_Shade,
47 SD_LinearGradient,
48 SD_RadialGradient,
49 SD_Pattern,
50 SD_Image,
51 SD_Text,
52 SD_CopyArea,
53 SD_Queue,
54 SD_External
55 };
56 typedef enum SDRenderType SDRenderType;
57
58 struct _stateShadingInfo
59 {
60 CGPoint start;
61 CGPoint end;
62 CGFloat colors[8];
63 BOOL cyclic;
64 CGFloat length; // of the total segment (used by the cyclic gradient)
65 CGFloat period; // of the cycle (used by the cyclic gradient)
66 CGFloat offset; // of the cycle from the start (used by the cyclic gradient)
67 };
68 typedef struct _stateShadingInfo StateShadingInfo;
69
70 struct _stateGradientInfo
71 {
72 CGPoint start;
73 CGPoint end;
74 CGFloat radius;
75 CGFloat* colordata;
76 CGFloat* fractionsdata;
77 jint fractionsLength;
78 };
79 typedef struct _stateGradientInfo StateGradientInfo;
80
81 struct _statePatternInfo
82 {
83 CGFloat tx;
84 CGFloat ty;
85 CGFloat sx;
86 CGFloat sy;
87 jint width;
88 jint height;
89 jobject sdata;
90 };
91 typedef struct _statePatternInfo StatePatternInfo;
92
93 struct _stateGraphicsInfo
94 {
95 BOOL adjustedLineWidth;
96 BOOL adjustedAntialias;
97 BOOL antialiased;
98 jint interpolation;
99 BOOL simpleColor;
100 BOOL simpleStroke;
118 BOOL newContext;
119 CGContextRef cgRef;
120
121 jint* javaGraphicsStates;
122 jobject javaGraphicsStatesObjects;
123
124 SDRenderType renderType;
125
126 // rdar://problem/5214320
127 // Gradient/Texture fills of Java GeneralPath don't respect the even odd winding rule (quartz pipeline).
128 BOOL isEvenOddFill; // Tracks whether the original render type passed into
129 // SetUpCGContext(...) is SD_EOFILL.
130 // The reason for this field is because SetUpCGContext(...) can
131 // change the render type after calling SetUpPaint(...), and right
132 // after that, the possibly new render type is then assigned into
133 // qsdo->renderType. Sigh!!!
134 // This field is potentially used within CompleteCGContext(...) or
135 // its callees.
136
137 StateShadingInfo* shadingInfo; // tracks shading and its parameters
138 StateGradientInfo* gradientInfo; // tracks gradient and its parameters
139 StatePatternInfo* patternInfo; // tracks pattern and its parameters
140 StateGraphicsInfo graphicsStateInfo; // tracks other graphics state
141
142 BOOL syncContentsToLayer; // should changed pixels be synced to a CALayer
143 CGRect updateRect; // used by the layer synchronization code to track update rects.
144 };
145
146 void SetUpCGContext(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
147 SDRenderType DoShapeUsingCG(CGContextRef cgRef, jint *types, jfloat *coords, jint numtypes, BOOL fill, CGFloat offsetX, CGFloat offsetY);
148 SDRenderType SetUpPaint(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
149 void CompleteCGContext(JNIEnv *env, QuartzSDOps *qsdo);
150
151 NSColor* ByteParametersToNSColor(JNIEnv* env, jint *javaGraphicsStates, NSColor* defColor);
152
153 #define JNF_COCOA_RENDERER_EXIT(env) \
154 } @catch(NSException *localException) { \
155 qsdo->FinishSurface(env, qsdo); \
156 [JNFException throwToJava:env exception:localException]; \
157 } \
158 if (_token) JNFNativeMethodExit(_token); \
|