Package java.awt.image

Examples of java.awt.image.BufferedImage


   * @param width target width
   * @param height target height
   * @return new BI
   */
  protected BufferedImage createBufferedImage(int width, int height) {
    BufferedImage image = ImageUtil.createCompatibleBufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    ImageUtil.clearImage(image);
    return image;
  }
View Full Code Here


  }

  private void init(float dotsPerPoint, int dotsPerPixel) {
    this.dotsPerPoint = dotsPerPoint;

    BufferedImage outputImage = ImageUtil.createCompatibleBufferedImage(DEFAULT_DOTS_PER_POINT, DEFAULT_DOTS_PER_POINT);
    outputDevice = new Java2DOutputDevice(outputImage);

    UserAgentCallback userAgent = new NaiveUserAgent();
        sharedContext = newSharedContext(dotsPerPixel, userAgent);
        layoutContext = newLayoutContext();
View Full Code Here

            - raPath.y);
        mGhostRect.setRect(ptOffset.x, ptOffset.y,
            lbl2.getPreferredSize().width, lbl2.getPreferredSize().height);

        lbl2.setSize(lbl2.getPreferredSize());
        mGhostImage = new BufferedImage(lbl2.getWidth(), lbl2
            .getHeight(), BufferedImage.TYPE_INT_ARGB_PRE);

        mTreeImage = new BufferedImage(this.getWidth(), this.getHeight(),
            BufferedImage.TYPE_INT_ARGB_PRE);
        Graphics2D g2t = mTreeImage.createGraphics();
        this.paint(g2t);
        g2t.dispose();
View Full Code Here

                .getWidth(), mGhostImage.getHeight());

            Rectangle2D target = (Rectangle2D) old.clone();
            target.add(mGhostRect);

            BufferedImage bf = new BufferedImage((int) target.getWidth(),
                (int) target.getHeight(), BufferedImage.TYPE_INT_ARGB_PRE);
            Graphics2D g2b = bf.createGraphics();

            int width = ((int) (mTreeImage.getWidth() - (target.getX() + target
                .getWidth()))) > 0 ? (int) target.getWidth()
                : (int) (mTreeImage.getWidth() - (target.getX()));
            int height = ((int) (mTreeImage.getHeight() - (target.getY() + target
View Full Code Here

        if(!img_dir.mkdirs())
          throw new IOException("Cannot make directory: " + img_dir.getParent());
      }
    }
    //�ж�ͼ��Ĵ�С��������Ҫ���е���
    BufferedImage orig_portrait = (BufferedImage)ImageIO.read(pFile.getInputStream());
    int preview_width = Math.min(PORTRAIT_WIDTH, orig_portrait.getWidth());
    int preview_height= Math.min(PORTRAIT_HEIGHT,orig_portrait.getHeight());
    if(preview_width != orig_portrait.getWidth() || preview_height!=orig_portrait.getHeight()){
      ImageUtils.createPreviewImage(pFile.getInputStream(), img_path,
          preview_width, preview_height);
    }
    else{
      ImageUtils.writeToFile(pFile, img_path);
View Full Code Here

          }

          String text = node.getNodeFormatter().format((ProgramItem)node.getUserObject());

          // use an image to be able to display HTML content on the node
          BufferedImage textImage = getImage(bounds);
          Graphics lg = textImage.getGraphics();

          mProgramLabel.setFont(tree.getFont());
          mProgramLabel.setForeground(g.getColor());
          mProgramLabel.setBackground(UIManager.getColor("Tree.background"));
          mProgramLabel.setText(text);
View Full Code Here

     * @param bounds
     * @return BufferedImage
     */
    private BufferedImage getImage(Rectangle bounds) {
      GraphicsConfiguration gc = getGraphicsConfiguration();
      BufferedImage textImage = gc.createCompatibleImage(bounds.width, bounds.height, Transparency.TRANSLUCENT);
      return textImage;
    }
View Full Code Here

        try {
            Java2DRenderer j2d = new Java2DRenderer(page, width);

            // this renders and returns the image, which is stored in the J2R; will not
            // be re-rendered, calls to getImage() return the same instance
            BufferedImage img = j2d.getImage();

            // write it out, full size, PNG
            // FSImageWriter instance can be reused for different ../images,
            // defaults to PNG
            FSImageWriter imageWriter = new FSImageWriter();
View Full Code Here

            throws Exception {
        Document doc = XMLUtil.documentFromFile(xhtml);
        Graphics2DRenderer renderer = new Graphics2DRenderer();
        renderer.setDocument(doc, new File(xhtml).toURI().toURL().toString());

        BufferedImage buff = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
        Graphics2D g = (Graphics2D) buff.getGraphics();

        Dimension dim = new Dimension(width, height);
        renderer.layout(g, dim);
        renderer.render(g);
View Full Code Here

import java.io.File;

public class Graphics2DRendererTest {

    public static void main(String[] args) throws Exception {
        BufferedImage img = Graphics2DRenderer.renderToImageAutoSize(new File("demos/splash/splash.html").toURI().toURL().toExternalForm(),
                700, BufferedImage.TYPE_INT_ARGB);
        ImageIO.write(img, "png", new File("test.png"));
    }
View Full Code Here

TOP

Related Classes of java.awt.image.BufferedImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.