History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/sun/java2d/pipe/AATileGenerator.java (1 of 18352 files). Show all

Unified · Split

java/pkg/sun/java2d/pipe/AATileGenerator.java+111−0
@@ -0,0 +1,111 @@
1/*
2 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
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
26package sun.java2d.pipe;
27
28/**
29 * The API for an object that generates alpha coverage tiles for a given
30 * path.
31 * The {@link RenderingEngine} will be consulted as a factory to return
32 * one of these objects for a given Shape and a given set of rendering
33 * attributes.
34 * This object will iterate through the bounds of the rendering primitive
35 * and return tiles of a constant size as specified by the getTileWidth()
36 * and getTileHeight() parameters.
37 * The iteration order of the tiles will be as specified by the pseudo-code:
38 * <pre>
39 * int bbox[] = {left, top, right, bottom};
40 * AATileGenerator aatg = renderengine.getAATileGenerator(..., bbox);
41 * int tw = aatg.getTileWidth();
42 * int th = aatg.getTileHeight();
43 * byte tile[] = new byte[tw * th];
44 * for (y = top; y < bottom; y += th) {
45 * for (x = left; x < right; x += tw) {
46 * int a = aatg.getTypicalAlpha();
47 * int w = Math.min(tw, right-x);
48 * int h = Math.min(th, bottom-y);
49 * if (a == 0x00) {
50 * // can skip this tile...
51 * aatg.nextTile();
52 * } else if (a == 0xff) {
53 * // can treat this tile like a fillRect
54 * aatg.nextTile();
55 * doFill(x, y, w, h);
56 * } else {
57 * aatg.getAlpha(tile, 0, tw);
58 * handleAlpha(tile, x, y, w, h);
59 * }
60 * }
61 * }
62 * aatg.dispose();
63 * </pre>
64 * The bounding box for the iteration will be returned by the
65 * {@code RenderingEngine} via an argument to the getAATileGenerator() method.
66 */
67public interface AATileGenerator {
68 /**
69 * Gets the width of the tiles that the generator batches output into.
70 * @return the width of the standard alpha tile
71 */
72 public int getTileWidth();
73
74 /**
75 * Gets the height of the tiles that the generator batches output into.
76 * @return the height of the standard alpha tile
77 */
78 public int getTileHeight();
79
80 /**
81 * Gets the typical alpha value that will characterize the current
82 * tile.
83 * The answer may be 0x00 to indicate that the current tile has
84 * no coverage in any of its pixels, or it may be 0xff to indicate
85 * that the current tile is completely covered by the path, or any
86 * other value to indicate non-trivial coverage cases.
87 * @return 0x00 for no coverage, 0xff for total coverage, or any other
88 * value for partial coverage of the tile
89 */
90 public int getTypicalAlpha();
91
92 /**
93 * Skips the current tile and moves on to the next tile.
94 * Either this method, or the getAlpha() method should be called
95 * once per tile, but not both.
96 */
97 public void nextTile();
98
99 /**
100 * Gets the alpha coverage values for the current tile.
101 * Either this method, or the nextTile() method should be called
102 * once per tile, but not both.
103 */
104 public void getAlpha(byte tile[], int offset, int rowstride);
105
106 /**
107 * Disposes this tile generator.
108 * No further calls will be made on this instance.
109 */
110 public void dispose();
111}