1 /*
2 * Copyright (c) 2011, 2013, 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
108 if (sCocoaTextPipe == null) {
109 sCocoaTextPipe = new CTextPipe();
110 }
111
112 sg2d.imagepipe = sQuartzCompositePipe;
113 sg2d.drawpipe = sQuartzCompositePipe;
114 sg2d.fillpipe = sQuartzCompositePipe;
115 sg2d.shapepipe = sQuartzCompositePipe;
116 sg2d.textpipe = sCocoaTextPipe;
117 }
118
119 public Rectangle getBounds() {
120 // gznote: always return a copy, not the rect itself and translate into device space
121 return new Rectangle(fBounds.x, fBounds.y, fBounds.width, fBounds.height - fBounds.y);
122 }
123
124 public GraphicsConfiguration getDeviceConfiguration() {
125 return fConfig;
126 }
127
128 protected void setBounds(int x, int y, int w, int h) {
129 fBounds.reshape(x, y, w, y + h);
130 }
131
132 // START compositing support API
133 public abstract BufferedImage copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, BufferedImage image);
134
135 public abstract boolean xorSurfacePixels(SunGraphics2D sg2d, BufferedImage srcPixels, int x, int y, int w, int h, int colorXOR);
136
137 GraphicsConfiguration sDefaultGraphicsConfiguration = null;
138
139 protected BufferedImage getCompositingImage(int w, int h) {
140 if (sDefaultGraphicsConfiguration == null) {
141 sDefaultGraphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
142 }
143
144 BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
145 // clear the image.
146 clearRect(img, w, h);
147 return img;
|
1 /*
2 * Copyright (c) 2011, 2014, 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
108 if (sCocoaTextPipe == null) {
109 sCocoaTextPipe = new CTextPipe();
110 }
111
112 sg2d.imagepipe = sQuartzCompositePipe;
113 sg2d.drawpipe = sQuartzCompositePipe;
114 sg2d.fillpipe = sQuartzCompositePipe;
115 sg2d.shapepipe = sQuartzCompositePipe;
116 sg2d.textpipe = sCocoaTextPipe;
117 }
118
119 public Rectangle getBounds() {
120 // gznote: always return a copy, not the rect itself and translate into device space
121 return new Rectangle(fBounds.x, fBounds.y, fBounds.width, fBounds.height - fBounds.y);
122 }
123
124 public GraphicsConfiguration getDeviceConfiguration() {
125 return fConfig;
126 }
127
128 @SuppressWarnings("deprecation")
129 protected void setBounds(int x, int y, int w, int h) {
130 fBounds.reshape(x, y, w, y + h);
131 }
132
133 // START compositing support API
134 public abstract BufferedImage copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, BufferedImage image);
135
136 public abstract boolean xorSurfacePixels(SunGraphics2D sg2d, BufferedImage srcPixels, int x, int y, int w, int h, int colorXOR);
137
138 GraphicsConfiguration sDefaultGraphicsConfiguration = null;
139
140 protected BufferedImage getCompositingImage(int w, int h) {
141 if (sDefaultGraphicsConfiguration == null) {
142 sDefaultGraphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
143 }
144
145 BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
146 // clear the image.
147 clearRect(img, w, h);
148 return img;
|