com.partnersoft.gui
Class ImageLib

java.lang.Object
  extended by com.partnersoft.gui.ImageLib

public class ImageLib
extends java.lang.Object

A GUI library class.

Author:
Paul Reavis Copyright 1998 Partner Software, Inc.

Field Summary
static java.lang.String[] imageFileExtensions
          The standard file extensions used for images, in the order searched.
 
Constructor Summary
ImageLib()
           
 
Method Summary
static java.awt.Image applyParameterizedColors(java.awt.Image img, java.awt.Color redColor, java.awt.Color greenColor, java.awt.Color blueColor)
           
static java.awt.Image bytesToImage(byte[] bytes)
           
static java.awt.Image bytesToImage(byte[] bytes, int start, int length)
           
static java.awt.Image bytesToImage(DynamicByteArray bytes)
           
static java.awt.Image clientLogo()
          Returns a client logo if it exists, otherwise defaults to the Partner logo.
static java.awt.Image fetchImage(java.lang.String path)
          Returns a named image from the classpath.
static java.io.File fileForImagePath(java.lang.String imagePath)
          Returns a file for an image "path".
static java.awt.Image filterImage(java.awt.Image image, java.awt.image.ImageFilter filter)
          I can never remember how to do this, so here's a convenience method.
static void forceLoadImage(java.awt.Image imagineAllThePeople)
           
static java.awt.Image getImage(java.lang.String path)
          Returns an image from the local filesystem.
static java.awt.Image getUncachedImage(java.lang.String path)
          Returns an image from the local filesystem (no caching is done).
static java.awt.Image greenBox()
          Returns a handy 4x4 green box - useful for debugging.
static java.awt.Image haloImage(java.awt.Image source)
           
static java.awt.image.BufferedImage iconToImage(javax.swing.Icon icon)
          Converts an Icon into an Image.
static java.awt.Image imageFromClasspath(java.lang.String path)
          Returns a named image from the classpath.
static java.awt.image.BufferedImage imageToBufferedImage(java.awt.Image original)
          Converts an Image to a BufferedImage.
static javax.swing.Icon imageToIcon(java.awt.Image image)
          Converts an Image into an Icon.
static java.awt.TexturePaint imageToTexturePaint(java.awt.Image original)
          Converts an Image to a TexturePaint object.
static java.awt.Image loadImageFromFile(VfsFile file)
           
static java.awt.Image offsetImage(java.awt.Image original, int deltaX, int deltaY)
          Offsets an image within a larger image.
static java.awt.Image partnerLogo()
          Returns a handy partner logo.
static java.awt.Image partnerLogoNoText()
          Returns a handy partner logo (no text).
static java.awt.Image questionMark()
          Returns a handy question mark - usually used to indicate loading errors for icons..
static java.awt.Image rotateImage(java.awt.Image original, double theta)
          Rotates an image by any angle.
static java.awt.Image rotateSquareImage(java.awt.Image source, int quarters)
          Rotates an image precisely to a cardinal direction (multiple of ninety degrees) and returns a result.
static java.awt.Image scaleImage(java.awt.Image original, double scaleFactor)
          Scales the given image.
static java.awt.Image scaleImageToFit(java.awt.Image original, int maxWidth, int maxHeight)
          Scales the given image to fit the maximum width and height given.
static void setHaloColor(java.awt.Color color)
           
static java.awt.Image smallPartnerLogo()
          Returns a handy small partner logo.
static java.awt.Image tinyPartnerLogo()
          Returns a tiny (16x16) partner logo.
static java.awt.Image titleBarIcon()
          Returns a tiny (16x16) provider logo, located in config/provider/system/images/titlebar.png, for use as a window title bar icon in some OSes (e.g.
static java.awt.Image translucentDot()
          Returns a (handy?) translucent dot.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageFileExtensions

public static final java.lang.String[] imageFileExtensions
The standard file extensions used for images, in the order searched.

Constructor Detail

ImageLib

public ImageLib()
Method Detail

fileForImagePath

public static java.io.File fileForImagePath(java.lang.String imagePath)
Returns a file for an image "path". This path can be either the full name given (assuming it has an extension like ".png") or the first version of that with the extension ".png", ".jpeg", ".jpg", or ".gif" (in that order). Returns null if none.


partnerLogoNoText

public static java.awt.Image partnerLogoNoText()
Returns a handy partner logo (no text).


partnerLogo

public static java.awt.Image partnerLogo()
Returns a handy partner logo.


smallPartnerLogo

public static java.awt.Image smallPartnerLogo()
Returns a handy small partner logo.


tinyPartnerLogo

public static java.awt.Image tinyPartnerLogo()
Returns a tiny (16x16) partner logo.


titleBarIcon

public static java.awt.Image titleBarIcon()
Returns a tiny (16x16) provider logo, located in config/provider/system/images/titlebar.png, for use as a window title bar icon in some OSes (e.g. Windows). Defaults to tinyPartnerLogo() if it can't find or load the file.


translucentDot

public static java.awt.Image translucentDot()
Returns a (handy?) translucent dot.


clientLogo

public static java.awt.Image clientLogo()
Returns a client logo if it exists, otherwise defaults to the Partner logo. Client logo lives in Shared/resources/icons/ClientLogo.*.


questionMark

public static java.awt.Image questionMark()
Returns a handy question mark - usually used to indicate loading errors for icons..


greenBox

public static java.awt.Image greenBox()
Returns a handy 4x4 green box - useful for debugging.


fetchImage

public static java.awt.Image fetchImage(java.lang.String path)
Returns a named image from the classpath.


imageFromClasspath

public static java.awt.Image imageFromClasspath(java.lang.String path)
Returns a named image from the classpath.


getImage

public static java.awt.Image getImage(java.lang.String path)
Returns an image from the local filesystem.


getUncachedImage

public static java.awt.Image getUncachedImage(java.lang.String path)
Returns an image from the local filesystem (no caching is done).


loadImageFromFile

public static java.awt.Image loadImageFromFile(VfsFile file)
                                        throws java.io.IOException
Throws:
java.io.IOException

bytesToImage

public static java.awt.Image bytesToImage(byte[] bytes)

bytesToImage

public static java.awt.Image bytesToImage(byte[] bytes,
                                          int start,
                                          int length)

bytesToImage

public static java.awt.Image bytesToImage(DynamicByteArray bytes)

forceLoadImage

public static void forceLoadImage(java.awt.Image imagineAllThePeople)

setHaloColor

public static void setHaloColor(java.awt.Color color)

filterImage

public static java.awt.Image filterImage(java.awt.Image image,
                                         java.awt.image.ImageFilter filter)
I can never remember how to do this, so here's a convenience method.


haloImage

public static java.awt.Image haloImage(java.awt.Image source)

rotateImage

public static java.awt.Image rotateImage(java.awt.Image original,
                                         double theta)
Rotates an image by any angle.


offsetImage

public static java.awt.Image offsetImage(java.awt.Image original,
                                         int deltaX,
                                         int deltaY)
Offsets an image within a larger image.


rotateSquareImage

public static java.awt.Image rotateSquareImage(java.awt.Image source,
                                               int quarters)
Rotates an image precisely to a cardinal direction (multiple of ninety degrees) and returns a result.


imageToIcon

public static javax.swing.Icon imageToIcon(java.awt.Image image)
Converts an Image into an Icon.


imageToBufferedImage

public static java.awt.image.BufferedImage imageToBufferedImage(java.awt.Image original)
Converts an Image to a BufferedImage. Always creates a new BufferedImage.


imageToTexturePaint

public static java.awt.TexturePaint imageToTexturePaint(java.awt.Image original)
Converts an Image to a TexturePaint object.


iconToImage

public static java.awt.image.BufferedImage iconToImage(javax.swing.Icon icon)
Converts an Icon into an Image.


scaleImage

public static java.awt.Image scaleImage(java.awt.Image original,
                                        double scaleFactor)
Scales the given image.


scaleImageToFit

public static java.awt.Image scaleImageToFit(java.awt.Image original,
                                             int maxWidth,
                                             int maxHeight)
Scales the given image to fit the maximum width and height given. Does not change the image if it is smaller than maxWidth, maxHeight.


applyParameterizedColors

public static java.awt.Image applyParameterizedColors(java.awt.Image img,
                                                      java.awt.Color redColor,
                                                      java.awt.Color greenColor,
                                                      java.awt.Color blueColor)