예제 #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 void setComposite(Composite comp) {
    if (comp instanceof AlphaComposite) {
      AlphaComposite aComp = (AlphaComposite) comp;
      validatedExtraAlpha = aComp.getAlpha();

      this.compRule = XRUtils.j2dAlphaCompToXR(aComp.getRule());
      this.extraAlpha = validatedExtraAlpha;

      if (extraAlpha == 1.0f) {
        alphaMask = XRUtils.None;
        alphaColor.alpha = XRColor.FULL_ALPHA.alpha;
      } else {
        alphaColor.alpha = XRColor.byteToXRColorValue((int) (extraAlpha * 255));
        alphaMask = alphaMaskPict;
        con.renderRectangle(alphaMaskPict, XRUtils.PictOpSrc, alphaColor, 0, 0, 1, 1);
      }

      xorEnabled = false;
    } else if (comp instanceof XORComposite) {
      /* XOR composite validation is handled in XRSurfaceData */
      xorEnabled = true;
    } else {
      throw new InternalError(
          "Composite accaleration not implemented for: " + comp.getClass().getName());
    }
  }
예제 #3
0
 public void setGradientPaint(XRSurfaceData gradient) {
   if (this.gradient != null) {
     con.freePicture(this.gradient.picture);
   }
   this.gradient = gradient;
   src = gradient;
 }
예제 #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);
    }
  }
예제 #5
0
  public void XRComposite(
      int src,
      int mask,
      int dst,
      int srcX,
      int srcY,
      int maskX,
      int maskY,
      int dstX,
      int dstY,
      int width,
      int height) {
    int cachedSrc = (src == XRUtils.None) ? this.src.picture : src;
    int cachedX = srcX;
    int cachedY = srcY;

    if (enableGradCache && gradient != null && cachedSrc == gradient.picture) {
      con.renderComposite(
          XRUtils.PictOpSrc,
          gradient.picture,
          XRUtils.None,
          gradCachePicture,
          srcX,
          srcY,
          0,
          0,
          0,
          0,
          width,
          height);
      cachedX = 0;
      cachedY = 0;
      cachedSrc = gradCachePicture;
    }

    con.renderComposite(
        compRule, cachedSrc, mask, dst, cachedX, cachedY, maskX, maskY, dstX, dstY, width, height);
  }
예제 #6
0
  public void XRCompositeTraps(int dst, int srcX, int srcY, TrapezoidList trapList) {
    int renderReferenceX = 0;
    int renderReferenceY = 0;

    if (trapList.getP1YLeft(0) < trapList.getP2YLeft(0)) {
      renderReferenceX = trapList.getP1XLeft(0);
      renderReferenceY = trapList.getP1YLeft(0);
    } else {
      renderReferenceX = trapList.getP2XLeft(0);
      renderReferenceY = trapList.getP2YLeft(0);
    }

    renderReferenceX = (int) Math.floor(XRUtils.XFixedToDouble(renderReferenceX));
    renderReferenceY = (int) Math.floor(XRUtils.XFixedToDouble(renderReferenceY));

    con.renderCompositeTrapezoids(
        compRule,
        src.picture,
        XRUtils.PictStandardA8,
        dst,
        renderReferenceX,
        renderReferenceY,
        trapList);
  }
예제 #7
0
 public void compositeText(int dst, int glyphSet, int maskFormat, GrowableEltArray elts) {
   con.XRenderCompositeText(compRule, src.picture, dst, maskFormat, 0, 0, 0, 0, glyphSet, elts);
 }
예제 #8
0
 public void compositeBlit(
     XRSurfaceData src, XRSurfaceData dst, int sx, int sy, int dx, int dy, int w, int h) {
   con.renderComposite(compRule, src.picture, alphaMask, dst.picture, sx, sy, 0, 0, dx, dy, w, h);
 }
예제 #9
0
 public void setForeground(int pixel) {
   solidColor.setColorValues(pixel, false);
   con.renderRectangle(solidSrcPict.picture, XRUtils.PictOpSrc, solidColor, 0, 0, 1, 1);
 }