Пример #1
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());
    }
  }
Пример #2
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);
    }
  }
Пример #3
0
 public void setForeground(int pixel) {
   solidColor.setColorValues(pixel, false);
   con.renderRectangle(solidSrcPict.picture, XRUtils.PictOpSrc, solidColor, 0, 0, 1, 1);
 }