001: /*
002: *
003: *
004: * Sun Proprietary Confidential, Internal Use Only
005: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
006: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public License version
010: * 2 only, as published by the Free Software Foundation.
011: *
012: * This program is distributed in the hope that it will be useful, but
013: * WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * General Public License version 2 for more details (a copy is
016: * included at /legal/license.txt).
017: *
018: * You should have received a copy of the GNU General Public License
019: * version 2 along with this work; if not, write to the Free Software
020: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
021: * 02110-1301 USA
022: *
023: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
024: * Clara, CA 95054 or visit www.sun.com if you need additional
025: * information or have any questions.
026: */
027: package com.sun.perseus.j2d;
028:
029: /**
030: * This interface is used to access and set computed property values
031: * for graphical characteristics such as fill or stroke color.
032: *
033: */
034: public interface GraphicsProperties {
035: // =======================================================================
036: // Initial Property values
037: // =======================================================================
038:
039: /**
040: * Default value for the display property
041: */
042: boolean INITIAL_DISPLAY = true;
043:
044: /**
045: * Default value for the visibility property
046: */
047: boolean INITIAL_VISIBILITY = true;
048:
049: /**
050: * Default value for the current color
051: */
052: RGB INITIAL_COLOR = RGB.black;
053:
054: /**
055: * Default value for the fill paint
056: */
057: RGB INITIAL_FILL = RGB.black;
058:
059: /**
060: * Default value for fill opacity
061: */
062: float INITIAL_FILL_OPACITY = 1;
063:
064: /**
065: * Default value for the stroke paint
066: */
067: RGB INITIAL_STROKE = null;
068:
069: /**
070: * Default value for stroke opacity
071: */
072: float INITIAL_STROKE_OPACITY = 1;
073:
074: /**
075: * Default stroke-width value
076: */
077: int INITIAL_FILL_RULE = RenderContext.WIND_NON_ZERO;
078:
079: /**
080: * Default stroke width
081: */
082: float INITIAL_STROKE_WIDTH = 1;
083:
084: /**
085: * Default line join
086: */
087: int INITIAL_STROKE_LINE_JOIN = RenderContext.JOIN_MITER;
088:
089: /**
090: * Default line cap
091: */
092: int INITIAL_STROKE_LINE_CAP = RenderContext.CAP_BUTT;
093:
094: /**
095: * Default miter limit
096: */
097: float INITIAL_STROKE_MITER_LIMIT = 4;
098:
099: /**
100: * Default dash array
101: */
102: float[] INITIAL_STROKE_DASH_ARRAY = null;
103:
104: /**
105: * Default dash offset
106: */
107: float INITIAL_STROKE_DASH_OFFSET = 0;
108:
109: /**
110: * Default value for opacity
111: */
112: float INITIAL_OPACITY = 1;
113:
114: // =======================================================================
115: // Value constants
116: // =======================================================================
117:
118: /**
119: * The even-odd rule specifies that a point lies inside the
120: * path if a ray drawn in any direction from that point to
121: * infinity is crossed by path segments an odd number of times.
122: */
123: int WIND_EVEN_ODD = 0;
124:
125: /**
126: * The non-zero rule specifies that a point lies inside the
127: * path if a ray drawn in any direction from that point to
128: * infinity is crossed by path segments a different number
129: * of times in the counter-clockwise direction than the
130: * clockwise direction.
131: */
132: int WIND_NON_ZERO = 1;
133:
134: /**
135: * Joins path segments by extending their outside edges until
136: * they meet.
137: */
138: int JOIN_MITER = 0;
139:
140: /**
141: * Joins path segments by rounding off the corner at a radius
142: * of half the line width.
143: */
144: int JOIN_ROUND = 1;
145:
146: /**
147: * Joins path segments by connecting the outer corners of their
148: * wide outlines with a straight segment.
149: */
150: int JOIN_BEVEL = 2;
151:
152: /**
153: * Ends unclosed subpaths and dash segments with no added
154: * decoration.
155: */
156: int CAP_BUTT = 0;
157:
158: /**
159: * Ends unclosed subpaths and dash segments with a round
160: * decoration that has a radius equal to half of the width
161: * of the pen.
162: */
163: int CAP_ROUND = 1;
164:
165: /**
166: * Ends unclosed subpaths and dash segments with a square
167: * projection that extends beyond the end of the segment
168: * to a distance equal to half of the line width.
169: */
170: int CAP_SQUARE = 2;
171:
172: // =======================================================================
173: // Property access
174: // =======================================================================
175:
176: /**
177: * @param fill the new paint to use for fill operations
178: */
179: void setFill(PaintServer fill);
180:
181: /**
182: * @return the paint used for fill operations
183: */
184: PaintServer getFill();
185:
186: /**
187: * @param fillOpacity the new opacity to use for fill operations.
188: * The value is clamped to the [0, 1] range.
189: */
190: void setFillOpacity(float fillOpacity);
191:
192: /**
193: * @return the opacity used for fill operations, in the [0, 1] range.
194: */
195: float getFillOpacity();
196:
197: /**
198: * @param stroke the new paint to use to fill stroked path
199: */
200: void setStroke(PaintServer stroke);
201:
202: /**
203: * @return the paint used to fill the stroked path
204: */
205: PaintServer getStroke();
206:
207: /**
208: * @param strokeOpacity the new opacity to use for stroke operations.
209: * The value is clamped to the [0, 1] range.
210: */
211: void setStrokeOpacity(float strokeOpacity);
212:
213: /**
214: * @return the opacity used for stroke operations, in the [0, 1] range.
215: */
216: float getStrokeOpacity();
217:
218: /**
219: * @param color the new color property value
220: */
221: void setColor(RGB color);
222:
223: /**
224: * @return the current color property value.
225: */
226: RGB getColor();
227:
228: /**
229: * @param fillRule the new rull to fill shapes
230: * @see #getFillRule
231: */
232: void setFillRule(int fillRule);
233:
234: /**
235: * @return the rule used to fill shapes. One of WIND_NON_ZERO or
236: * WIND_EVEN_ODD.
237: * @see #WIND_EVEN_ODD
238: * @see #WIND_NON_ZERO
239: */
240: int getFillRule();
241:
242: /**
243: * @param strokeDashArray the new set of dashes and gaps to use for
244: * stroking operations.
245: * @see #getStrokeDashArray
246: */
247: void setStrokeDashArray(float[] strokeDashArray);
248:
249: /**
250: * @return an array of float value describing alternance of
251: * solid and transparent sections on stroked paths, starting
252: * with dash, followed by a gap.
253: * @see #getStrokeDashOffset
254: */
255: float[] getStrokeDashArray();
256:
257: /**
258: * @param strokeLineCap the new line cap decoration style
259: */
260: void setStrokeLineCap(int strokeLineCap);
261:
262: /**
263: * @return the style used to decorate the ends of unclosed
264: * path segments. One of CAP_BUTT, CAP_ROUND or CAP_SQUARE.
265: */
266: int getStrokeLineCap();
267:
268: /**
269: * @param strokeLineJoin the new line join style
270: * @see #getStrokeLineJoin
271: */
272: void setStrokeLineJoin(int strokeLineJoin);
273:
274: /**
275: * @return the style used to decorate line segment intersections.
276: * Can be one of JOIN_BEVEL, JOIN_MITER, JOIN_ROUND
277: */
278: int getStrokeLineJoin();
279:
280: /**
281: * @param strokeWidth the new stroke width
282: * @see #getStrokeWidth
283: */
284: void setStrokeWidth(float strokeWidth);
285:
286: /**
287: * @return the width to use for stroking. This is expressed in user
288: * space and is the width of the line measured on a
289: * perpendicular to the stroked path.
290: */
291: float getStrokeWidth();
292:
293: /**
294: * @param strokeMiterLimit the new value for the miter limit
295: * @see #getStrokeMiterLimit
296: */
297: void setStrokeMiterLimit(float strokeMiterLimit);
298:
299: /**
300: * @return the limit of miter joins. Line joins which exceed this
301: * value are trimmed. The miter is expressed as the ratio
302: * of the miter length (i.e, the distance between the inner
303: * and the outer elbows) to the stroke width.
304: */
305: float getStrokeMiterLimit();
306:
307: /**
308: * @param strokeDashOffset the offset, in user space, in the
309: * stroke's dash array. This is ignored if the dash array
310: * is null
311: */
312: void setStrokeDashOffset(float strokeDashOffset);
313:
314: /**
315: * @return the offset in the dash array.
316: */
317: float getStrokeDashOffset();
318:
319: /**
320: * @param visibility the new visibility property value
321: */
322: void setVisibility(boolean visibility);
323:
324: /**
325: * @return true if the node is visible. false otherwise
326: */
327: boolean getVisibility();
328:
329: /**
330: * @param display the new display property value
331: */
332: void setDisplay(boolean display);
333:
334: /**
335: * @return true if the display is on. false otherwise
336: */
337: boolean getDisplay();
338:
339: /**
340: * @param opacity the new opacity to use for blending operations.
341: * The value is clamped to the [0, 1] range.
342: */
343: void setOpacity(float opacity);
344:
345: /**
346: * @return the opacity used for blending operations, in the [0, 1] range.
347: */
348: float getOpacity();
349:
350: }
|