public static PaintContext getContext(
     BufferedImage bufImg, AffineTransform xform, RenderingHints hints, Rectangle devBounds) {
   WritableRaster raster = bufImg.getRaster();
   ColorModel cm = bufImg.getColorModel();
   int maxw = devBounds.width;
   Object val = hints.get(hints.KEY_INTERPOLATION);
   boolean filter =
       (val == null
           ? (hints.get(hints.KEY_RENDERING) == hints.VALUE_RENDER_QUALITY)
           : (val != hints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
   if (raster instanceof IntegerInterleavedRaster && (!filter || isFilterableDCM(cm))) {
     IntegerInterleavedRaster iir = (IntegerInterleavedRaster) raster;
     if (iir.getNumDataElements() == 1 && iir.getPixelStride() == 1) {
       return new Int(iir, cm, xform, maxw, filter);
     }
   } else if (raster instanceof ByteInterleavedRaster) {
     ByteInterleavedRaster bir = (ByteInterleavedRaster) raster;
     if (bir.getNumDataElements() == 1 && bir.getPixelStride() == 1) {
       if (filter) {
         if (isFilterableICM(cm)) {
           return new ByteFilter(bir, cm, xform, maxw);
         }
       } else {
         return new Byte(bir, cm, xform, maxw);
       }
     }
   }
   return new Any(raster, cm, xform, maxw, filter);
 }
示例#2
0
文件: Menu.java 项目: niwhsa9/Hangman
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   setBackground(new Color(219, 219, 72));
   Graphics2D g2d = (Graphics2D) g;
   RenderingHints rh =
       new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
   g2d.setRenderingHints(rh);
   Font fnt = new Font("STENCIL", Font.BOLD, 100);
   g2d.setColor(new Color(62, 11, 214));
   g2d.setFont(fnt);
   g2d.drawString("Hangman", 240, 100);
   fnt = new Font("STENCIL", Font.ITALIC, 30);
   g2d.setFont(fnt);
   g2d.setColor(new Color(11, 214, 201));
   g2d.drawString("created by Ashwin Gupta", 240, 125);
   /*g2d.setFont(new Font("Arial", Font.PLAIN, 75));
   g2d.drawString("PAINT BIG ", 100, 400);
   g2d.drawString("HANGMAN HERE", 100, 500);*/
   // int offset= 20;
   HangComponents dh = new HangComponents();
   g2d.setColor(Color.DARK_GRAY);
   for (int i = 0; i < 8; i++) {
     if (i == 7 || i == 6) {
       g2d.setStroke(new BasicStroke(45));
       g2d.draw(dh.hangman[i]);
     } else g2d.fill(dh.hangman[i]);
   }
 }
 private RenderedOp createScaledImage(
     RenderedImage sourceImage, S2Resolution resolution, int level) {
   int sourceWidth = sourceImage.getWidth();
   int sourceHeight = sourceImage.getHeight();
   int targetWidth = imageLayouts[0].width >> level;
   int targetHeight = imageLayouts[0].height >> level;
   float scaleX = (float) targetWidth / (float) sourceWidth;
   float scaleY = (float) targetHeight / (float) sourceHeight;
   float corrFactorX = resolution == S2Resolution.R20M ? R20M_X_FACTOR : R60M_X_FACTOR;
   float corrFactorY = resolution == S2Resolution.R20M ? R20M_Y_FACTOR : R60M_Y_FACTOR;
   final Dimension tileDim = getTileDim(targetWidth, targetHeight);
   ImageLayout imageLayout = new ImageLayout();
   imageLayout.setTileWidth(tileDim.width);
   imageLayout.setTileHeight(tileDim.height);
   RenderingHints renderingHints =
       new RenderingHints(
           JAI.KEY_BORDER_EXTENDER, BorderExtender.createInstance(BorderExtender.BORDER_ZERO));
   renderingHints.put(JAI.KEY_IMAGE_LAYOUT, imageLayout);
   RenderedOp scaledImage =
       ScaleDescriptor.create(
           sourceImage,
           scaleX * corrFactorX,
           scaleY * corrFactorY,
           0F,
           0F,
           Interpolation.getInstance(Interpolation.INTERP_NEAREST),
           renderingHints);
   if (scaledImage.getWidth() != targetWidth || scaledImage.getHeight() != targetHeight) {
     return CropDescriptor.create(
         scaledImage, 0.0F, 0.0F, (float) targetWidth, (float) targetHeight, null);
   } else {
     return scaledImage;
   }
 }
示例#4
0
  /** store the given RenderingHints to a Properties object */
  public static void formatRenderingHints(RenderingHints rh, Properties preferences) {

    if (rh.get(RenderingHints.KEY_ANTIALIASING).equals(RenderingHints.VALUE_ANTIALIAS_ON))
      preferences.put("rendering.antialiasing", "on");
    else if (rh.get(RenderingHints.KEY_ANTIALIASING).equals(RenderingHints.VALUE_ANTIALIAS_OFF))
      preferences.put("rendering.antialiasing", "off");

    if (rh.get(RenderingHints.KEY_TEXT_ANTIALIASING).equals(RenderingHints.VALUE_TEXT_ANTIALIAS_ON))
      preferences.put("rendering.text-antialiasing", "on");
    else if (rh.get(RenderingHints.KEY_TEXT_ANTIALIASING)
        .equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF))
      preferences.put("rendering.text-antialiasing", "off");

    if (rh.get(RenderingHints.KEY_RENDERING).equals(RenderingHints.VALUE_RENDER_SPEED))
      preferences.put("rendering.render", "speed");
    else if (rh.get(RenderingHints.KEY_RENDERING).equals(RenderingHints.VALUE_RENDER_QUALITY))
      preferences.put("rendering.render", "quality");

    if (rh.get(RenderingHints.KEY_DITHERING).equals(RenderingHints.VALUE_DITHER_ENABLE))
      preferences.put("rendering.dither", "on");
    else if (rh.get(RenderingHints.KEY_DITHERING).equals(RenderingHints.VALUE_DITHER_DISABLE))
      preferences.put("rendering.dither", "off");

    if (rh.get(RenderingHints.KEY_FRACTIONALMETRICS)
        .equals(RenderingHints.VALUE_FRACTIONALMETRICS_ON))
      preferences.put("rendering.fractional-metrics", "on");
    else if (rh.get(RenderingHints.KEY_FRACTIONALMETRICS)
        .equals(RenderingHints.VALUE_FRACTIONALMETRICS_OFF))
      preferences.put("rendering.fractional-metrics", "off");
  }
 private static BufferedImage getGaussianBlur(int size, BufferedImage image) {
   KernelJAI kernel = Functions.getGaussKernel(size / 3.0);
   ParameterBlock pb = new ParameterBlock();
   pb.addSource(image);
   pb.add(kernel);
   RenderingHints hints =
       new RenderingHints(
           JAI.KEY_BORDER_EXTENDER, BorderExtender.createInstance(BorderExtender.BORDER_COPY));
   hints.add(JAIContext.noCacheHint);
   return JAI.create("LCSeparableConvolve", pb, hints).getAsBufferedImage();
 }
示例#6
0
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g;
   RenderingHints hints = new RenderingHints(null);
   hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
   hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
   g2.setRenderingHints(hints);
   g2.rotate(-Math.toRadians(degrees), w / 2, h / 2);
   g2.drawImage(dimg, 0, 0, this);
   g2.dispose();
 }
示例#7
0
      /**
       * A paint class that will draw the needle, dots, and TO/FROM RenderingHints is IMPORTANT. It
       * will make sure that everything stays focused and not blurry whenever the image rotates. I
       * added an empty line between the 8 fillArcs, just so its easier to see that four of them
       * draw on the left side and four draw on the right side.
       */
      public void paintComponent(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        RenderingHints hints = new RenderingHints(null);
        hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        g2.setRenderingHints(hints);
        g2.setStroke(new BasicStroke(3));
        // g2.drawString("TO", 190, 200);
        if (vor.isTo() == true) {
          if (vor.isAbeamed() == true) {
            // g2.setFont(new Font("default", Font.BOLD, 16));
            // g2.setColor(Color.red);
            // g2.drawString("BAD", 190, 200);
          } else {
            // g2.setFont(new Font("default", Font.BOLD, 16));
            g2.drawString("TO", 190, 200);
          }
        } else if (vor.isFrom() == true) {
          if (vor.isAbeamed() == true) {
            // g2.setFont(new Font("default", Font.BOLD, 16));
            // g2.setColor(Color.red);
            // g2.drawString("BAD", 190, 300);
          } else {
            // g2.setFont(new Font("default", Font.BOLD, 13));
            g2.drawString("FROM", 190, 300);
          }
        } else if (vor.isFrom() == false || vor.isTo() == false) {
          // is above the vor station no to or from
        }

        g2.fillArc(140, 240, 7, 7, 0, 360);
        g2.fillArc(125, 240, 7, 7, 0, 360);
        g2.fillArc(110, 240, 7, 7, 0, 360);
        g2.fillArc(95, 240, 7, 7, 0, 360);

        g2.fillArc(195, 240, 7, 7, 0, 360);
        g2.fillArc(210, 240, 7, 7, 0, 360);
        g2.fillArc(225, 240, 7, 7, 0, 360);
        g2.fillArc(240, 240, 7, 7, 0, 360);

        // g2.drawString("FROM",190, 300);
        g2.drawLine(x, y1, x, y2);
        super.paintComponent(g);
        g2.dispose();
      }
示例#8
0
  public RecodeRaster(
      final RenderedImage image,
      final double srcVal,
      final double destVal,
      final RenderingHints hints) {
    super(image, (ImageLayout) hints.get(JAI.KEY_IMAGE_LAYOUT), hints, false);

    this.srcVal = srcVal;
    this.destVal = destVal;
    permitInPlaceOperation();
  }
  public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderHints) {
    RenderedImage source = paramBlock.getRenderedSource(0);

    ImageLayout layout =
        renderHints == null ? null : (ImageLayout) renderHints.get(JAI.KEY_IMAGE_LAYOUT);

    String algorism = (String) paramBlock.getObjectParameter(0);
    int level = paramBlock.getIntParameter(1);
    Vector[] coefs = (Vector[]) paramBlock.getObjectParameter(2);

    return new QuantizationOpImage(source, layout, renderHints, algorism, level, coefs);
  }
示例#10
0
  // init
  private static void init() {
    if (frame != null) frame.setVisible(false);
    frame = new JFrame();
    offscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    onscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    offscreen = offscreenImage.createGraphics();
    onscreen = onscreenImage.createGraphics();
    setXscale();
    setYscale();
    offscreen.setColor(DEFAULT_CLEAR_COLOR);
    offscreen.fillRect(0, 0, width, height);
    setPenColor();
    setPenRadius();
    setFont();
    clear();

    // add antialiasing
    RenderingHints hints =
        new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    offscreen.addRenderingHints(hints);

    // frame stuff
    ImageIcon icon = new ImageIcon(onscreenImage);
    JLabel draw = new JLabel(icon);

    draw.addMouseListener(std);
    draw.addMouseMotionListener(std);

    frame.setContentPane(draw);
    frame.addKeyListener(std); // JLabel cannot get keyboard focus
    frame.setResizable(false);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // closes all windows
    // frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);      // closes only current window
    frame.setTitle("Standard Draw");
    frame.setJMenuBar(createMenuBar());
    frame.pack();
    frame.requestFocusInWindow();
    frame.setVisible(true);
  }
示例#11
0
文件: Utils.java 项目: mkolod/pdfxtk
 static {
   hints = new RenderingHints(null);
   // fractional metrics distorts text spacing; not for this application!
   hints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
   hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
   hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
   // hints.put(RenderingHints.KEY_TEXT_ANTIALIASING,   RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
   hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
   hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   // hints.put(RenderingHints.KEY_ANTIALIASING ,       RenderingHints.VALUE_ANTIALIAS_OFF);
   hints.put(
       RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
   hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED);
   hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
 }
示例#12
0
  // Draw elements:
  @Override
  public void paint(Graphics g) {

    // Set up Graphics Enigne:
    Graphics2D g2d = (Graphics2D) g;

    // Antialiasing:
    if (antialiasing == true) {
      RenderingHints rh =
          new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

      g2d.setRenderingHints(rh);
    }

    // Draw rendered image
    g2d.drawImage(
        renderImage, 0, 0, width, height, 0, 0, resolution.width, resolution.height, this);

    g2d.setColor(Color.yellow);

    g2d.drawString("FPS: " + fps, 20, 20);
  }
  /**
   * Instantiates a new AffineTransformOp with the specified AffineTransform and RenderingHints
   * object which defines the interpolation type.
   *
   * @param xform the AffineTransform.
   * @param hints the RenderingHints object which defines the interpolation type.
   */
  public AffineTransformOp(AffineTransform xform, RenderingHints hints) {
    this(xform, TYPE_NEAREST_NEIGHBOR);
    this.hints = hints;

    if (hints != null) {
      Object hint = hints.get(RenderingHints.KEY_INTERPOLATION);
      if (hint != null) {
        // Nearest neighbor is default
        if (hint == RenderingHints.VALUE_INTERPOLATION_BILINEAR) {
          this.iType = TYPE_BILINEAR;
        } else if (hint == RenderingHints.VALUE_INTERPOLATION_BICUBIC) {
          this.iType = TYPE_BICUBIC;
        }
      } else {
        hint = hints.get(RenderingHints.KEY_RENDERING);
        // Determine from rendering quality
        if (hint == RenderingHints.VALUE_RENDER_QUALITY) {
          this.iType = TYPE_BILINEAR;
          // For speed use nearest neighbor
        }
      }
    }
  }
示例#14
0
  static {
    ImageLayout layout = new ImageLayout();
    layout.setColorModel(ColorModel.getRGBdefault());

    RenderingHints screenHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
    screenHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    screenHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    screenHints.put(
        RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
    screenHints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
    screenHints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    screenHints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
    screenHints.put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
    screenHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);

    screenContext = new RenderContext(AffineTransform.getTranslateInstance(0.0, 0.0), screenHints);

    RenderingHints draftHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);

    draftHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    draftHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    draftHints.put(
        RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
    draftHints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED);
    draftHints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
    draftHints.put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
    draftHints.put(
        RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
    draftHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);

    draftContext = new RenderContext(AffineTransform.getTranslateInstance(0.0, 0.0), draftHints);
  }
示例#15
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    Graphics2D g2d = (Graphics2D) g;
    RenderingHints rh = g2d.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2d.setRenderingHints(rh);

    // Background.
    D = this.getSize();
    g.setColor(backgroundColor);
    g.fillRect(0, 0, D.width, D.height);
    Graphics2D g2 = (Graphics2D) g;
    g2.setStroke(lineStroke);

    // Axes, bounding box.
    g.setColor(Color.gray);
    g.drawLine(inset, D.height - inset, D.width - inset, D.height - inset);
    g.drawLine(D.width - inset, inset, D.width - inset, D.height - inset);
    g.drawLine(inset, inset, inset, D.height - inset);
    g.drawLine(inset, inset, D.width - inset, inset);

    double xDelta = (maxX - minX) / numIntervals;

    // X-ticks and labels.
    for (int i = 1; i <= numIntervals; i++) {
      double xTickd = i * xDelta;
      int xTick = (int) (xTickd / (maxX - minX) * (D.width - 2 * inset));
      g.drawLine(inset + xTick, D.height - inset - 5, inset + xTick, D.height - inset + 5);
      double x = minX + i * xDelta;
      g.drawString(df.format(x), xTick + inset - 5, D.height - inset + 20);
    }

    // Y-ticks
    double yDelta = (maxY - minY) / numIntervals;
    for (int i = 0; i < numIntervals; i++) {
      int yTick = (i + 1) * (int) ((D.height - 2 * inset) / (double) numIntervals);
      g.drawLine(inset - 5, D.height - yTick - inset, inset + 5, D.height - yTick - inset);
      double y = minY + (i + 1) * yDelta;
      g.drawString(df.format(y), 1, D.height - yTick - inset);
    }

    // Zoom+move
    Font savedFont = g.getFont();
    g.setFont(plusFont);
    g.drawString("+", D.width - 25, 20);
    g.setFont(minusFont);
    g.drawString("-", D.width - 25, 50);
    drawArrow(g2d, D.width - 70, 20, D.width - 70, 0, 1.0f, lineStroke); // Up
    drawArrow(g2d, D.width - 70, 30, D.width - 70, 50, 1.0f, lineStroke); // Down
    drawArrow(g2d, D.width - 65, 25, D.width - 45, 25, 1.0f, lineStroke); // Right
    drawArrow(g2d, D.width - 75, 25, D.width - 95, 25, 1.0f, lineStroke); // Left
    g.setFont(savedFont);

    // See if standard axes are in the middle.
    g.setColor(Color.gray);
    if ((minX < 0) && (maxX > 0) && (drawMiddleAxes)) {
      // Draw y-axis
      int x = (int) ((0 - minX) / (maxX - minX) * (D.width - 2 * inset));
      g.drawLine(inset + x, D.height - inset, inset + x, inset);
    }
    if ((minY < 0) && (maxY > 0) && (drawMiddleAxes)) {
      // Draw x-axis
      int y = (int) ((0 - minY) / (maxY - minY) * (D.height - 2.0 * inset));
      g.drawLine(inset, D.height - y - inset, D.width - inset, D.height - y - inset);
    }

    // Draw the objects.
    drawObjects(g, points, lines, ovals, rectangles, images, labels, eqnLines);
    if (animationMode) {
      drawObjects(g, animPoints, animLines, animOvals, animRectangles, null, labels, eqnLines);
      // No images in animation mode.
    }

    drawScribbles(g);
  }
    public PlanarImage setFront() {
      if (chroma_domain == 0 && chroma_range == 0 && luma_domain == 0 && luma_range == 0)
        return back;

      PlanarImage front = back;

      ColorScience.LinearTransform transform = new ColorScience.YST();

      double[][] rgb2yst = transform.fromRGB(back.getSampleModel().getDataType());
      double[][] yst2rgb = transform.toRGB(back.getSampleModel().getDataType());

      ParameterBlock pb = new ParameterBlock();
      pb.addSource(back);
      pb.add(rgb2yst);
      RenderedOp ystImage = JAI.create("BandCombine", pb, null);

      RenderingHints mfHints =
          new RenderingHints(
              JAI.KEY_BORDER_EXTENDER, BorderExtender.createInstance(BorderExtender.BORDER_COPY));

      if (chroma_domain != 0 && chroma_range != 0) {
        pb = new ParameterBlock();
        pb.addSource(ystImage);
        pb.add(chroma_domain * scale);
        pb.add(0.02f + 0.001f * chroma_domain);
        // pb.add(0.1f);
        ystImage = JAI.create("BilateralFilter", pb, mfHints);
        ystImage.setProperty(JAIContext.PERSISTENT_CACHE_TAG, Boolean.TRUE);
      }

      if (luma_domain != 0 && luma_range != 0) {
        pb = new ParameterBlock();
        pb.addSource(ystImage);
        pb.add(new int[] {0});
        RenderedOp y = JAI.create("bandselect", pb, null);

        pb = new ParameterBlock();
        pb.addSource(ystImage);
        pb.add(new int[] {1, 2});
        RenderedOp cc = JAI.create("bandselect", pb, JAIContext.noCacheHint);

        pb = new ParameterBlock();
        pb.addSource(y);
        pb.add((2 + luma_domain / 10f) * scale);
        pb.add(0.005f * luma_domain);
        y = JAI.create("BilateralFilter", pb, mfHints);

        RenderingHints layoutHints =
            new RenderingHints(JAI.KEY_IMAGE_LAYOUT, Functions.getImageLayout(ystImage));
        pb = new ParameterBlock();
        pb.addSource(y);
        pb.addSource(cc);
        layoutHints.add(JAIContext.noCacheHint);
        ystImage = JAI.create("BandMerge", pb, layoutHints);
      }

      pb = new ParameterBlock();
      pb.addSource(ystImage);
      pb.add(yst2rgb);
      front = JAI.create("BandCombine", pb, null);
      front.setProperty(JAIContext.PERSISTENT_CACHE_TAG, Boolean.TRUE);

      return front;
    }
示例#17
0
  /** Returns a RenderingHints parsed from the given Properties */
  public static RenderingHints parseRenderingHints(Properties preferences) {

    RenderingHints rh = new RenderingHints(null);
    String str;
    str = preferences.getProperty("rendering.antialiasing");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    }
    str = preferences.getProperty("rendering.text-antialiasing");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    }
    str = preferences.getProperty("rendering.render");
    if (str != null) {
      if (str.equals("speed"))
        rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
      else if (str.equals("quality"))
        rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    }
    str = preferences.getProperty("rendering.dither");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
    }
    str = preferences.getProperty("rendering.fractional-metrics");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
    }
    return rh;
  }
 static {
   _renderHints =
       new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   _renderHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
 }