2
|
1 |
/*
|
56106
|
2 |
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
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 |
*
|
5506
|
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.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
#ifndef ProcessPath_h_Included
|
|
27 |
#define ProcessPath_h_Included
|
|
28 |
|
|
29 |
#include <float.h>
|
|
30 |
#include "jni_util.h"
|
|
31 |
|
|
32 |
#define UPPER_BND (FLT_MAX/4.0f)
|
|
33 |
#define LOWER_BND (-UPPER_BND)
|
|
34 |
|
|
35 |
/* Precision (in bits) used in forward differencing */
|
|
36 |
#define FWD_PREC 7
|
|
37 |
|
|
38 |
/* Precision (in bits) used for the rounding in the midpoint test */
|
|
39 |
#define MDP_PREC 10
|
|
40 |
|
|
41 |
#define MDP_MULT (1<<MDP_PREC)
|
|
42 |
#define MDP_HALF_MULT (MDP_MULT >> 1)
|
|
43 |
|
|
44 |
/* Bit mask used to separate whole part from the fraction part of the
|
|
45 |
* number
|
|
46 |
*/
|
|
47 |
#define MDP_W_MASK (-MDP_MULT)
|
|
48 |
|
|
49 |
/* Bit mask used to separate fractional part from the whole part of the
|
|
50 |
* number
|
|
51 |
*/
|
|
52 |
#define MDP_F_MASK (MDP_MULT-1)
|
|
53 |
|
|
54 |
typedef struct _DrawHandler {
|
|
55 |
void (*pDrawLine)(struct _DrawHandler* hnd,
|
|
56 |
jint x0, jint y0, jint x1, jint y1);
|
|
57 |
|
|
58 |
void (*pDrawPixel)(struct _DrawHandler* hnd, jint x0, jint y0);
|
|
59 |
|
|
60 |
void (*pDrawScanline)(struct _DrawHandler* hnd, jint x0, jint x1, jint y0);
|
|
61 |
// TODO Change following names to smth like outXMin
|
|
62 |
jint xMin, yMin, xMax, yMax;
|
|
63 |
|
|
64 |
/* Boundary values with stroke control rendering hint applied */
|
|
65 |
jfloat xMinf, yMinf, xMaxf, yMaxf;
|
|
66 |
|
|
67 |
void* pData;
|
|
68 |
} DrawHandler;
|
|
69 |
|
|
70 |
typedef enum {
|
|
71 |
PH_MODE_DRAW_CLIP,
|
|
72 |
PH_MODE_FILL_CLIP
|
|
73 |
} PHClip;
|
|
74 |
|
|
75 |
/* Constants representing KEY_STROKE_CONTROL rendering hints */
|
|
76 |
typedef enum {
|
|
77 |
PH_STROKE_PURE, /* RenderingHints.VALUE_STROKE_PURE */
|
|
78 |
PH_STROKE_DEFAULT /* RenderingHints.VALUE_STROKE_DEFAULT */
|
|
79 |
} PHStroke;
|
|
80 |
|
|
81 |
typedef struct _ProcessHandler {
|
|
82 |
void (*pProcessFixedLine)(struct _ProcessHandler* hnd,
|
|
83 |
jint x1,jint y1,
|
|
84 |
jint x2,jint y2, jint* pixelInfo,
|
|
85 |
jboolean checkBounds,
|
|
86 |
jboolean endSubPath);
|
|
87 |
void (*pProcessEndSubPath)(struct _ProcessHandler* hnd);
|
|
88 |
DrawHandler* dhnd;
|
|
89 |
PHStroke stroke;
|
|
90 |
PHClip clipMode;
|
|
91 |
void* pData;
|
|
92 |
} ProcessHandler;
|
|
93 |
|
|
94 |
|
56106
|
95 |
JNIEXPORT jboolean doDrawPath(DrawHandler* hnd,
|
2
|
96 |
void (*pProcessEndSubPath)(ProcessHandler* hnd),
|
|
97 |
jint transX, jint transY,
|
|
98 |
jfloat* coords, jint maxCoords,
|
|
99 |
jbyte* types, jint numTypes,
|
|
100 |
PHStroke stroke);
|
|
101 |
|
56106
|
102 |
JNIEXPORT jboolean doFillPath(DrawHandler* hnd,
|
2
|
103 |
jint transX, jint transY,
|
|
104 |
jfloat* coords, jint maxCoords,
|
|
105 |
jbyte* types, jint numTypes,
|
|
106 |
PHStroke stroke,
|
|
107 |
jint fillRule);
|
|
108 |
|
|
109 |
#endif
|