Beispiel #1
0
  /** Creates and returns a context used to generate the pattern. */
  public PaintContext createContext(
      ColorModel cm,
      Rectangle deviceBounds,
      Rectangle2D userBounds,
      AffineTransform xform,
      RenderingHints hints) {
    // Concatenate the patternTransform to xform
    if (patternTransform != null) {
      xform = new AffineTransform(xform);
      xform.concatenate(patternTransform);
    }

    if ((lastContext != null) && lastContext.getColorModel().equals(cm)) {

      double[] p = new double[6];
      double[] q = new double[6];
      xform.getMatrix(p);
      lastContext.getUsr2Dev().getMatrix(q);
      if ((p[0] == q[0]) && (p[1] == q[1]) && (p[2] == q[2]) && (p[3] == q[3])) {
        if ((p[4] == q[4]) && (p[5] == q[5])) return lastContext;
        else
          return new PatternPaintContextWrapper(
              lastContext, (int) (q[4] - p[4] + 0.5), (int) (q[5] - p[5] + 0.5));
      }
    }
    // System.out.println("CreateContext Called: " + this);
    // System.out.println("CM : " + cm);
    // System.out.println("xForm : " + xform);

    lastContext = new PatternPaintContext(cm, xform, hints, tile, patternRegion, overflow);
    return lastContext;
  }
Beispiel #2
0
 public Raster getRaster(int x, int y, int width, int height) {
   return ppc.getRaster(x + xShift, y + yShift, width, height);
 }
Beispiel #3
0
 public ColorModel getColorModel() {
   return ppc.getColorModel();
 }