FreeHEP API
Version current

org.freehep.graphicsio
Class ImageGraphics2D

java.lang.Object
  extended byjava.awt.Graphics
      extended byjava.awt.Graphics2D
          extended byorg.freehep.graphics2d.VectorGraphics
              extended byorg.freehep.graphics2d.AbstractVectorGraphics
                  extended byorg.freehep.graphics2d.PixelGraphics2D
                      extended byorg.freehep.graphicsio.ImageGraphics2D
All Implemented Interfaces:
VectorGraphicsConstants
Direct Known Subclasses:
GIFGraphics2D

public class ImageGraphics2D
extends PixelGraphics2D

Generic class for generating bitmap outputs from an image.

Version:
$Id: ImageGraphics2D.java,v 1.14 2003/06/05 09:10:46 duns Exp $
Author:
Mark Donszelmann
Source Code:
ImageGraphics2D.java

Field Summary
static String ANTIALIAS
           
static String ANTIALIAS_TEXT
           
static String BACKGROUND
           
static String BACKGROUND_COLOR
           
protected  Component component
           
static String COMPRESS
           
static String COMPRESS_DESCRIPTION
           
static String COMPRESS_MODE
           
static String COMPRESS_QUALITY
           
protected  String format
           
protected  BufferedImage image
           
protected  OutputStream os
           
static String PROGRESSIVE
           
static String rootKey
           
static String TRANSPARENT
           
 
Fields inherited from class org.freehep.graphics2d.PixelGraphics2D
hostGraphics, KEY_SYMBOL_BLIT, lineWidth, resolution, tagHandler, VALUE_SYMBOL_BLIT_OFF, VALUE_SYMBOL_BLIT_ON
 
Fields inherited from interface org.freehep.graphics2d.VectorGraphicsConstants
NUMBER_OF_HORIZ_ALIGNMENTS, NUMBER_OF_SYMBOLS, NUMBER_OF_VERTICAL_ALIGNMENTS, SYMBOL_BOX, SYMBOL_CIRCLE, SYMBOL_CROSS, SYMBOL_DIAMOND, SYMBOL_DN_TRIANGLE, SYMBOL_HLINE, SYMBOL_PLUS, SYMBOL_STAR, SYMBOL_UP_TRIANGLE, SYMBOL_VLINE, TEXT_BASELINE, TEXT_BOTTOM, TEXT_CENTER, TEXT_LEFT, TEXT_RIGHT, TEXT_TOP
 
Constructor Summary
  ImageGraphics2D(File file, Component component, String format)
           
  ImageGraphics2D(File file, Dimension size, String format)
           
protected ImageGraphics2D(ImageGraphics2D graphics)
           
  ImageGraphics2D(OutputStream os, Component component, String format)
           
  ImageGraphics2D(OutputStream os, Dimension size, String format)
           
 
Method Summary
static boolean canWriteTransparent(String format)
           
static boolean canWriteUncompressed(String format)
           
 void closeStream()
           
 Graphics create()
           
 Graphics create(double x, double y, double width, double height)
           
static BufferedImage createBufferedImage(String format, int width, int height)
           
 void endExport()
           
static BufferedImage generateThumbnail(Component component, Dimension size)
           
static Properties getDefaultProperties(String format)
           
static ImageWriter getPreferredImageWriter(String format)
           
static ImageWriter getPreferredImageWriterForMIMEType(String mimeType)
           
protected  void handleException(Exception exception)
          Handles an exception which has been caught.
static BufferedImage readImage(String format, InputStream is)
           
 void setProperties(Properties newProperties)
           
 void startExport()
           
protected  void write()
           
static void writeImage(Image image, String format, Properties properties, OutputStream os)
           
static void writeImage(RenderedImage image, String format, Properties properties, OutputStream os)
           
 
Methods inherited from class org.freehep.graphics2d.PixelGraphics2D
addRenderingHints, clearRect, clearRect, clip, clipRect, clipRect, copyArea, createShape, dispose, draw, drawArc, drawGlyphVector, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolygon, drawPolyline, drawRect, drawRenderableImage, drawRenderedImage, drawString, drawString, drawString, drawString, drawString, drawString, drawString, drawString, drawSymbol, fill, fillAndDrawSymbol, fillArc, fillOval, fillPolygon, fillPolygon, fillRect, fillSymbol, getClip, getClipBounds, getClipBounds, getComposite, getDeviceConfiguration, getFontMetrics, getFontRenderContext, getRenderingHint, getRenderingHints, getStroke, getTransform, hit, isDisplayLocal, isDisplayX11, printComment, rotate, rotate, scale, setBackground, setClip, setClip, setClip, setColor, setComposite, setFont, setHostGraphics, setLineWidth, setPaint, setPaintMode, setRenderingHint, setRenderingHints, setStroke, setTransform, setXORMode, shear, toString, transform, translate, translate
 
Methods inherited from class org.freehep.graphics2d.AbstractVectorGraphics
createShape, drawArc, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawRoundRect, drawString, drawString, drawSymbol, drawSymbol, fillAndDraw, fillAndDrawSymbol, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, fillRoundRect, fillSymbol, fillSymbol, getBackground, getColor, getColorMode, getCreator, getFont, getPaint, getPrintColor, getProperties, getProperty, getPropertyColor, getPropertyDimension, getPropertyDouble, getPropertyInsets, getPropertyInt, getPropertyRectangle, initProperties, isDeviceIndependent, isProperty, setColorMode, setCreator, setDeviceIndependent, setLineWidth
 
Methods inherited from class org.freehep.graphics2d.VectorGraphics
create, create, getSymbol, getTextAlignment, getXalignment, getYalignment
 
Methods inherited from class java.awt.Graphics2D
draw3DRect, fill3DRect
 
Methods inherited from class java.awt.Graphics
drawBytes, drawChars, finalize, getClipRect, getFontMetrics, hitClip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rootKey

public static final String rootKey
See Also:
Constant Field Values

TRANSPARENT

public static final String TRANSPARENT
See Also:
Constant Field Values

BACKGROUND

public static final String BACKGROUND
See Also:
Constant Field Values

BACKGROUND_COLOR

public static final String BACKGROUND_COLOR
See Also:
Constant Field Values

ANTIALIAS

public static final String ANTIALIAS
See Also:
Constant Field Values

ANTIALIAS_TEXT

public static final String ANTIALIAS_TEXT
See Also:
Constant Field Values

PROGRESSIVE

public static final String PROGRESSIVE
See Also:
Constant Field Values

COMPRESS

public static final String COMPRESS
See Also:
Constant Field Values

COMPRESS_MODE

public static final String COMPRESS_MODE
See Also:
Constant Field Values

COMPRESS_DESCRIPTION

public static final String COMPRESS_DESCRIPTION
See Also:
Constant Field Values

COMPRESS_QUALITY

public static final String COMPRESS_QUALITY
See Also:
Constant Field Values

os

protected OutputStream os

image

protected BufferedImage image

format

protected String format

component

protected Component component
Constructor Detail

ImageGraphics2D

public ImageGraphics2D(File file,
                       Dimension size,
                       String format)
                throws FileNotFoundException

ImageGraphics2D

public ImageGraphics2D(File file,
                       Component component,
                       String format)
                throws FileNotFoundException

ImageGraphics2D

public ImageGraphics2D(OutputStream os,
                       Dimension size,
                       String format)

ImageGraphics2D

public ImageGraphics2D(OutputStream os,
                       Component component,
                       String format)

ImageGraphics2D

protected ImageGraphics2D(ImageGraphics2D graphics)
Method Detail

getDefaultProperties

public static Properties getDefaultProperties(String format)

setProperties

public void setProperties(Properties newProperties)
Overrides:
setProperties in class AbstractVectorGraphics

create

public Graphics create()
Overrides:
create in class PixelGraphics2D

create

public Graphics create(double x,
                       double y,
                       double width,
                       double height)
Overrides:
create in class PixelGraphics2D

startExport

public void startExport()
Overrides:
startExport in class PixelGraphics2D

endExport

public void endExport()
Overrides:
endExport in class PixelGraphics2D

write

protected void write()
              throws IOException
Throws:
IOException

closeStream

public void closeStream()
                 throws IOException
Throws:
IOException

handleException

protected void handleException(Exception exception)
Handles an exception which has been caught. Dispatches exception to writeWarning for UnsupportedOperationExceptions and writeError for others

Parameters:
exception - to be handled

createBufferedImage

public static BufferedImage createBufferedImage(String format,
                                                int width,
                                                int height)

generateThumbnail

public static BufferedImage generateThumbnail(Component component,
                                              Dimension size)

writeImage

public static void writeImage(Image image,
                              String format,
                              Properties properties,
                              OutputStream os)
                       throws IOException
Throws:
IOException

writeImage

public static void writeImage(RenderedImage image,
                              String format,
                              Properties properties,
                              OutputStream os)
                       throws IOException
Throws:
IOException

getPreferredImageWriter

public static ImageWriter getPreferredImageWriter(String format)

getPreferredImageWriterForMIMEType

public static ImageWriter getPreferredImageWriterForMIMEType(String mimeType)

readImage

public static BufferedImage readImage(String format,
                                      InputStream is)
                               throws IOException
Throws:
IOException

canWriteUncompressed

public static boolean canWriteUncompressed(String format)

canWriteTransparent

public static boolean canWriteTransparent(String format)

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.