< prev index next >

src/java.desktop/share/classes/sun/java2d/loops/MaskFill.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 2016, 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


 164 
 165     private static class General extends MaskFill {
 166         FillRect fillop;
 167         MaskBlit maskop;
 168 
 169         public General(SurfaceType srctype,
 170                        CompositeType comptype,
 171                        SurfaceType dsttype)
 172         {
 173             super(srctype, comptype, dsttype);
 174             fillop = FillRect.locate(srctype,
 175                                      CompositeType.SrcNoEa,
 176                                      SurfaceType.IntArgb);
 177             maskop = MaskBlit.locate(SurfaceType.IntArgb, comptype, dsttype);
 178         }
 179 
 180         public void MaskFill(SunGraphics2D sg2d,
 181                              SurfaceData sData,
 182                              Composite comp,
 183                              int x, int y, int w, int h,
 184                              byte mask[], int offset, int scan)
 185         {
 186             BufferedImage dstBI =
 187                 new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
 188             SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);
 189 
 190             // REMIND: This is not pretty.  It would be nicer if we
 191             // passed a "FillData" object to the Pixel loops, instead
 192             // of a SunGraphics2D parameter...
 193             Region clip = sg2d.clipRegion;
 194             sg2d.clipRegion = null;
 195             int pixel = sg2d.pixel;
 196             sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
 197             fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
 198             sg2d.pixel = pixel;
 199             sg2d.clipRegion = clip;
 200 
 201             maskop.MaskBlit(tmpData, sData, comp, null,
 202                             0, 0, x, y, w, h,
 203                             mask, offset, scan);
 204         }


   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


 164 
 165     private static class General extends MaskFill {
 166         FillRect fillop;
 167         MaskBlit maskop;
 168 
 169         public General(SurfaceType srctype,
 170                        CompositeType comptype,
 171                        SurfaceType dsttype)
 172         {
 173             super(srctype, comptype, dsttype);
 174             fillop = FillRect.locate(srctype,
 175                                      CompositeType.SrcNoEa,
 176                                      SurfaceType.IntArgb);
 177             maskop = MaskBlit.locate(SurfaceType.IntArgb, comptype, dsttype);
 178         }
 179 
 180         public void MaskFill(SunGraphics2D sg2d,
 181                              SurfaceData sData,
 182                              Composite comp,
 183                              int x, int y, int w, int h,
 184                              byte[] mask, int offset, int scan)
 185         {
 186             BufferedImage dstBI =
 187                 new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
 188             SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);
 189 
 190             // REMIND: This is not pretty.  It would be nicer if we
 191             // passed a "FillData" object to the Pixel loops, instead
 192             // of a SunGraphics2D parameter...
 193             Region clip = sg2d.clipRegion;
 194             sg2d.clipRegion = null;
 195             int pixel = sg2d.pixel;
 196             sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
 197             fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
 198             sg2d.pixel = pixel;
 199             sg2d.clipRegion = clip;
 200 
 201             maskop.MaskBlit(tmpData, sData, comp, null,
 202                             0, 0, x, y, w, h,
 203                             mask, offset, scan);
 204         }


< prev index next >