Package org.fife.ui.rtextarea
Class BufferedImageBackgroundPainterStrategy
- java.lang.Object
-
- org.fife.ui.rtextarea.ImageBackgroundPainterStrategy
-
- org.fife.ui.rtextarea.BufferedImageBackgroundPainterStrategy
-
- All Implemented Interfaces:
BackgroundPainterStrategy
public class BufferedImageBackgroundPainterStrategy extends ImageBackgroundPainterStrategy
A strategy for painting the background of anRTextAreaBaseas an image. The image is always stretched to completely fill theRTextAreaBase.A
java.awt.image.BufferedImageis used for rendering; theoretically, for performance you should usejava.awt.image.VolatileImage; seeorg.fife.ui.RTextArea.VolatileImageBackgroundPainterStrategyfor this.You can set the scaling hint used when stretching/skewing the image to fit in the
RTextAreaBase's background via thesetScalingHintmethod, but keep in mind the more accurate the scaling hint, the less responsive your application will be when stretching the window (as that's the only time the image's size is recalculated).
-
-
Field Summary
-
Fields inherited from class org.fife.ui.rtextarea.ImageBackgroundPainterStrategy
tracker
-
-
Constructor Summary
Constructors Constructor Description BufferedImageBackgroundPainterStrategy(RTextAreaBase ta)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidpaintImage(Graphics g, int x, int y)Paints the image at the specified location.protected voidrescaleImage(int width, int height, int hint)Rescales the displayed image to be the specified size.-
Methods inherited from class org.fife.ui.rtextarea.ImageBackgroundPainterStrategy
getMasterImage, getRTextAreaBase, getScalingHint, paint, setImage, setImage, setScalingHint
-
-
-
-
Constructor Detail
-
BufferedImageBackgroundPainterStrategy
public BufferedImageBackgroundPainterStrategy(RTextAreaBase ta)
Constructor.- Parameters:
ta- The text area whose background we'll be painting.
-
-
Method Detail
-
paintImage
protected void paintImage(Graphics g, int x, int y)
Paints the image at the specified location. This method assumes scaling has already been done, and simply paints the background image "as-is."- Specified by:
paintImagein classImageBackgroundPainterStrategy- Parameters:
g- The graphics context.x- The x-coordinate at which to paint.y- The y-coordinate at which to paint.
-
rescaleImage
protected void rescaleImage(int width, int height, int hint)Rescales the displayed image to be the specified size.- Specified by:
rescaleImagein classImageBackgroundPainterStrategy- Parameters:
width- The new width of the image.height- The new height of the image.hint- The scaling hint to use.
-
-