10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #import "SurfaceData.h"
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,
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); \
159 }
|
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #import "SurfaceData.h"
27 #import "BufImgSurfaceData.h"
28 #import "AWTFont.h"
29 #import <Cocoa/Cocoa.h>
30 #import "JNIUtilities.h"
31
32 // these flags are not defined on Tiger on PPC, so we need to make them a no-op
33 #if !defined(kCGBitmapByteOrder32Host)
34 #define kCGBitmapByteOrder32Host 0
35 #endif
36 #if !defined(kCGBitmapByteOrder16Host)
37 #define kCGBitmapByteOrder16Host 0
38 #endif
39
40 // NOTE : Modify the printSurfaceDataDiagnostics API if you change this enum
41 enum SDRenderType
42 {
43 SD_Nothing,
44 SD_Stroke,
45 SD_Fill,
46 SD_EOFill,
47 SD_Shade,
48 SD_LinearGradient,
49 SD_RadialGradient,
50 SD_Pattern,
134 // qsdo->renderType. Sigh!!!
135 // This field is potentially used within CompleteCGContext(...) or
136 // its callees.
137
138 StateShadingInfo* shadingInfo; // tracks shading and its parameters
139 StateGradientInfo* gradientInfo; // tracks gradient and its parameters
140 StatePatternInfo* patternInfo; // tracks pattern and its parameters
141 StateGraphicsInfo graphicsStateInfo; // tracks other graphics state
142
143 BOOL syncContentsToLayer; // should changed pixels be synced to a CALayer
144 CGRect updateRect; // used by the layer synchronization code to track update rects.
145 };
146
147 void SetUpCGContext(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
148 SDRenderType DoShapeUsingCG(CGContextRef cgRef, jint *types, jfloat *coords, jint numtypes, BOOL fill, CGFloat offsetX, CGFloat offsetY);
149 SDRenderType SetUpPaint(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
150 void CompleteCGContext(JNIEnv *env, QuartzSDOps *qsdo);
151
152 NSColor* ByteParametersToNSColor(JNIEnv* env, jint *javaGraphicsStates, NSColor* defColor);
153
154 #define JNI_COCOA_RENDERER_EXIT(env) \
155 JNI_COCOA_EXIT_WITH_ACTION(env, qsdo->FinishSurface(env, qsdo))
|