Esempio n. 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());
    }
  }
Esempio n. 2
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);
  }