Пример #1
0
 public void XRRenderRectangles(XRSurfaceData dst, GrowableRectArray rects) {
   if (xorEnabled) {
     con.GCRectangles(dst.getXid(), dst.getGC(), rects);
   } else {
     con.renderRectangles(dst.getPicture(), compRule, solidColor, rects);
   }
 }
Пример #2
0
  private XRCompositeManager(XRSurfaceData surface) {
    con = new XRBackendNative();
    // con = XRBackendJava.getInstance();

    String gradProp = System.getProperty("sun.java2d.xrgradcache");
    enableGradCache =
        gradProp == null || !(gradProp.equalsIgnoreCase("false") || gradProp.equalsIgnoreCase("f"));

    XRPaints.register(this);

    initResources(surface);

    maskBuffer = new MaskTileManager(this, surface.getXid());
    textRenderer = new XRTextRenderer(this);
    maskImage = new XRMaskImage(this, surface.getXid());
  }
Пример #3
0
  public void validateCompositeState(
      Composite comp, AffineTransform xform, Paint paint, SunGraphics2D sg2d) {
    boolean updatePaint = (paint != validatedPaint) || paint == null;

    // validate composite
    if ((comp != validatedComp)) {
      if (comp != null) {
        setComposite(comp);
      } else {
        comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER);
        setComposite(comp);
      }
      // the paint state is dependent on the composite state, so make
      // sure we update the color below
      updatePaint = true;
      validatedComp = comp;
    }

    if (sg2d != null && validatedPixel != sg2d.pixel) {
      validatedPixel = sg2d.pixel;
      setForeground(validatedPixel);
    }

    // validate paint
    if (updatePaint) {
      if (paint != null && sg2d != null && sg2d.paintState >= SunGraphics2D.PAINT_GRADIENT) {
        XRPaints.setPaint(sg2d, paint);
      } else {
        XRResetPaint();
      }
      validatedPaint = paint;
    }

    if (src != solidSrcPict) {
      AffineTransform at = (AffineTransform) xform.clone();
      try {
        at.invert();
      } catch (NoninvertibleTransformException e) {
        at.setToIdentity();
      }
      src.validateAsSource(at, -1, -1);
    }
  }
Пример #4
0
  public void initResources(XRSurfaceData surface) {
    int parentXid = surface.getXid();

    int solidPixmap = con.createPixmap(parentXid, 32, 1, 1);
    int solidSrcPictXID = con.createPicture(solidPixmap, XRUtils.PictStandardARGB32);
    con.setPictureRepeat(solidSrcPictXID, XRUtils.RepeatNormal);
    con.renderRectangle(solidSrcPictXID, XRUtils.PictOpSrc, XRColor.FULL_ALPHA, 0, 0, 1, 1);
    solidSrcPict = new XRSurfaceData.XRInternalSurfaceData(con, solidSrcPictXID, null);
    setForeground(0);

    int extraAlphaMask = con.createPixmap(parentXid, 8, 1, 1);
    alphaMaskPict = con.createPicture(extraAlphaMask, XRUtils.PictStandardA8);
    con.setPictureRepeat(alphaMaskPict, XRUtils.RepeatNormal);
    con.renderRectangle(alphaMaskPict, XRUtils.PictOpClear, XRColor.NO_ALPHA, 0, 0, 1, 1);

    if (enableGradCache) {
      gradCachePixmap =
          con.createPixmap(parentXid, 32, MaskTileManager.MASK_SIZE, MaskTileManager.MASK_SIZE);
      gradCachePicture = con.createPicture(gradCachePixmap, XRUtils.PictStandardARGB32);
    }
  }