< prev index next >

src/java.desktop/macosx/classes/sun/java2d/OSXSurfaceData.java

Print this page




 555                 this.fGraphicsStatesInt.put(kColorStateIndex, kColorGradient);
 556                 this.fGraphicsStatesInt.put(kColorRGBValue1Index, color.getColor1().getRGB());
 557                 this.fGraphicsStatesInt.put(kColorRGBValue2Index, color.getColor2().getRGB());
 558                 this.fGraphicsStatesInt.put(kColorIsCyclicIndex, (color.isCyclic()) ? kColorCyclic : kColorNonCyclic);
 559                 Point2D p = color.getPoint1();
 560                 this.fGraphicsStatesFloat.put(kColorx1Index, (float) p.getX());
 561                 this.fGraphicsStatesFloat.put(kColory1Index, (float) p.getY());
 562                 p = color.getPoint2();
 563                 this.fGraphicsStatesFloat.put(kColorx2Index, (float) p.getX());
 564                 this.fGraphicsStatesFloat.put(kColory2Index, (float) p.getY());
 565 
 566                 this.fChangeFlag = (this.fChangeFlag | kColorChangedBit);
 567             } else {
 568                 this.fChangeFlag = (this.fChangeFlag & kColorNotChangedBit);
 569             }
 570         } else if (sg2d.paint instanceof TexturePaint) {
 571             if ((this.fGraphicsStatesInt.get(kColorStateIndex) != kColorTexture) || (lastPaint != sg2d.paint)) {
 572                 TexturePaint color = (TexturePaint) sg2d.paint;
 573                 this.fGraphicsStatesInt.put(kColorStateIndex, kColorTexture);
 574                 texturePaintImage = color.getImage();
 575                 SurfaceData textureSurfaceData = BufImgSurfaceData.createData(texturePaintImage);
 576                 this.fGraphicsStatesInt.put(kColorWidthIndex, texturePaintImage.getWidth());
 577                 this.fGraphicsStatesInt.put(kColorHeightIndex, texturePaintImage.getHeight());
 578                 Rectangle2D anchor = color.getAnchorRect();
 579                 this.fGraphicsStatesFloat.put(kColortxIndex, (float) anchor.getX());
 580                 this.fGraphicsStatesFloat.put(kColortyIndex, (float) anchor.getY());
 581                 this.fGraphicsStatesFloat.put(kColorsxIndex, (float) (anchor.getWidth() / texturePaintImage.getWidth()));
 582                 this.fGraphicsStatesFloat.put(kColorsyIndex, (float) (anchor.getHeight() / texturePaintImage.getHeight()));
 583                 this.fGraphicsStatesObject[kTextureImageIndex] = textureSurfaceData;
 584 
 585                 this.fChangeFlag = (this.fChangeFlag | kColorChangedBit);
 586             } else {
 587                 this.fChangeFlag = (this.fChangeFlag & kColorNotChangedBit);
 588             }
 589         } else {
 590             if ((this.fGraphicsStatesInt.get(kColorStateIndex) != kColorTexture) || (lastPaint != sg2d.paint) || ((this.fChangeFlag & kBoundsChangedBit) != 0)) {
 591                 PaintContext context = sg2d.paint.createContext(sg2d.getDeviceColorModel(), userBounds, userBounds, sIdentityMatrix, sg2d.getRenderingHints());
 592                 WritableRaster raster = (WritableRaster) (context.getRaster(userBounds.x, userBounds.y, userBounds.width, userBounds.height));
 593                 ColorModel cm = context.getColorModel();
 594                 texturePaintImage = new BufferedImage(cm, raster, cm.isAlphaPremultiplied(), null);
 595 




 555                 this.fGraphicsStatesInt.put(kColorStateIndex, kColorGradient);
 556                 this.fGraphicsStatesInt.put(kColorRGBValue1Index, color.getColor1().getRGB());
 557                 this.fGraphicsStatesInt.put(kColorRGBValue2Index, color.getColor2().getRGB());
 558                 this.fGraphicsStatesInt.put(kColorIsCyclicIndex, (color.isCyclic()) ? kColorCyclic : kColorNonCyclic);
 559                 Point2D p = color.getPoint1();
 560                 this.fGraphicsStatesFloat.put(kColorx1Index, (float) p.getX());
 561                 this.fGraphicsStatesFloat.put(kColory1Index, (float) p.getY());
 562                 p = color.getPoint2();
 563                 this.fGraphicsStatesFloat.put(kColorx2Index, (float) p.getX());
 564                 this.fGraphicsStatesFloat.put(kColory2Index, (float) p.getY());
 565 
 566                 this.fChangeFlag = (this.fChangeFlag | kColorChangedBit);
 567             } else {
 568                 this.fChangeFlag = (this.fChangeFlag & kColorNotChangedBit);
 569             }
 570         } else if (sg2d.paint instanceof TexturePaint) {
 571             if ((this.fGraphicsStatesInt.get(kColorStateIndex) != kColorTexture) || (lastPaint != sg2d.paint)) {
 572                 TexturePaint color = (TexturePaint) sg2d.paint;
 573                 this.fGraphicsStatesInt.put(kColorStateIndex, kColorTexture);
 574                 texturePaintImage = color.getImage();
 575                 SurfaceData textureSurfaceData = OSXOffScreenSurfaceData.createNewSurface(texturePaintImage);
 576                 this.fGraphicsStatesInt.put(kColorWidthIndex, texturePaintImage.getWidth());
 577                 this.fGraphicsStatesInt.put(kColorHeightIndex, texturePaintImage.getHeight());
 578                 Rectangle2D anchor = color.getAnchorRect();
 579                 this.fGraphicsStatesFloat.put(kColortxIndex, (float) anchor.getX());
 580                 this.fGraphicsStatesFloat.put(kColortyIndex, (float) anchor.getY());
 581                 this.fGraphicsStatesFloat.put(kColorsxIndex, (float) (anchor.getWidth() / texturePaintImage.getWidth()));
 582                 this.fGraphicsStatesFloat.put(kColorsyIndex, (float) (anchor.getHeight() / texturePaintImage.getHeight()));
 583                 this.fGraphicsStatesObject[kTextureImageIndex] = textureSurfaceData;
 584 
 585                 this.fChangeFlag = (this.fChangeFlag | kColorChangedBit);
 586             } else {
 587                 this.fChangeFlag = (this.fChangeFlag & kColorNotChangedBit);
 588             }
 589         } else {
 590             if ((this.fGraphicsStatesInt.get(kColorStateIndex) != kColorTexture) || (lastPaint != sg2d.paint) || ((this.fChangeFlag & kBoundsChangedBit) != 0)) {
 591                 PaintContext context = sg2d.paint.createContext(sg2d.getDeviceColorModel(), userBounds, userBounds, sIdentityMatrix, sg2d.getRenderingHints());
 592                 WritableRaster raster = (WritableRaster) (context.getRaster(userBounds.x, userBounds.y, userBounds.width, userBounds.height));
 593                 ColorModel cm = context.getColorModel();
 594                 texturePaintImage = new BufferedImage(cm, raster, cm.isAlphaPremultiplied(), null);
 595 


< prev index next >