1 /*
2 * Copyright (c) 1999, 2011, 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
148 public void Blit(SurfaceData srcData,
149 SurfaceData dstData,
150 Composite comp,
151 Region clip,
152 int srcx, int srcy,
153 int dstx, int dsty,
154 int width, int height)
155 {
156 ColorModel srcCM = srcData.getColorModel();
157 ColorModel dstCM = dstData.getColorModel();
158 // REMIND: Should get RenderingHints from sg2d
159 CompositeContext ctx = comp.createContext(srcCM, dstCM,
160 new RenderingHints(null));
161 Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
162 WritableRaster dstRas =
163 (WritableRaster) dstData.getRaster(dstx, dsty, width, height);
164
165 if (clip == null) {
166 clip = Region.getInstanceXYWH(dstx, dsty, width, height);
167 }
168 int span[] = {dstx, dsty, dstx+width, dsty+height};
169 SpanIterator si = clip.getSpanIterator(span);
170 srcx -= dstx;
171 srcy -= dsty;
172 while (si.nextSpan(span)) {
173 int w = span[2] - span[0];
174 int h = span[3] - span[1];
175 Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
176 w, h, 0, 0, null);
177 WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
178 w, h, 0, 0, null);
179 ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
180 }
181 ctx.dispose();
182 }
183 }
184
185 private static class GeneralMaskBlit extends Blit {
186 MaskBlit performop;
187
188 public GeneralMaskBlit(SurfaceType srctype,
|
1 /*
2 * Copyright (c) 1999, 2018, 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
148 public void Blit(SurfaceData srcData,
149 SurfaceData dstData,
150 Composite comp,
151 Region clip,
152 int srcx, int srcy,
153 int dstx, int dsty,
154 int width, int height)
155 {
156 ColorModel srcCM = srcData.getColorModel();
157 ColorModel dstCM = dstData.getColorModel();
158 // REMIND: Should get RenderingHints from sg2d
159 CompositeContext ctx = comp.createContext(srcCM, dstCM,
160 new RenderingHints(null));
161 Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
162 WritableRaster dstRas =
163 (WritableRaster) dstData.getRaster(dstx, dsty, width, height);
164
165 if (clip == null) {
166 clip = Region.getInstanceXYWH(dstx, dsty, width, height);
167 }
168 int[] span = {dstx, dsty, dstx+width, dsty+height};
169 SpanIterator si = clip.getSpanIterator(span);
170 srcx -= dstx;
171 srcy -= dsty;
172 while (si.nextSpan(span)) {
173 int w = span[2] - span[0];
174 int h = span[3] - span[1];
175 Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
176 w, h, 0, 0, null);
177 WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
178 w, h, 0, 0, null);
179 ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
180 }
181 ctx.dispose();
182 }
183 }
184
185 private static class GeneralMaskBlit extends Blit {
186 MaskBlit performop;
187
188 public GeneralMaskBlit(SurfaceType srctype,
|