sub_arctic.output
Class stipple_text_renderer
java.lang.Object
|
+--sub_arctic.output.simple_text_renderer
|
+--sub_arctic.output.stipple_text_renderer
- public class stipple_text_renderer
- extends simple_text_renderer
This object can draw text as if through a stipple pattern. This is not
cheap in the current implementation of AWT (1.02), but is sufficiently
necessary in some cases to merit its use. It does this by drawing into
an "extra" bitmap and then sub_sampling the drawn values. You can
provide a "skip" value which is effectively how many pixels get skipped
between each one that is drawn. If you make this value 0, you are
getting the normal drawing (albeit a REALLY slow version). If you make
this 1 (the most common value) you'll get a 50% filter.
Constructor Summary |
stipple_text_renderer(java.awt.Font in_font,
java.awt.Color in_color,
int skip)
Construct a new stipple text renderer given a font, a color, and
skip value. |
Method Summary |
void |
draw_text(drawable on_surface,
int at_x,
int at_y,
java.lang.String txt)
We override the actual text rendering to do our magic with the stippling. |
void |
handle_pixels(java.awt.Image img,
int x,
int y,
int w,
int h,
drawable on_surface,
int at_x,
int at_y,
int rgb_value)
This is the code that grabs the pixels from the offscreen image. |
void |
handle_single_pixel(int at_x,
int at_y,
drawable on_surface,
int x,
int y,
int pixel,
int rgb_value)
This is what we do for a single pixel in the result image. |
void |
set_skip(int s)
Set the skip value. |
int |
skip()
Return the skip value. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
stipple_text_renderer
public stipple_text_renderer(java.awt.Font in_font,
java.awt.Color in_color,
int skip)
- Construct a new stipple text renderer given a font, a color, and
skip value.
skip
public int skip()
- Return the skip value.
set_skip
public void set_skip(int s)
- Set the skip value. Note: Although this change affects the text_renderer
immediately, the users of the text_renderer are not notified of the
change and may continue to have cached images which were generated with
the old skip value.
draw_text
public void draw_text(drawable on_surface,
int at_x,
int at_y,
java.lang.String txt)
- We override the actual text rendering to do our magic with the stippling.
- Parameters:
drawable
- on_surface the drawing surface where we draw the result.int
- at_x x coordinate to draw at.int
- at_y y coordinate to draw at.String
- txt the text to draw.- Overrides:
- draw_text in class simple_text_renderer
handle_single_pixel
public void handle_single_pixel(int at_x,
int at_y,
drawable on_surface,
int x,
int y,
int pixel,
int rgb_value)
- This is what we do for a single pixel in the result image.
This is stolen right out of the AWT docs.
handle_pixels
public void handle_pixels(java.awt.Image img,
int x,
int y,
int w,
int h,
drawable on_surface,
int at_x,
int at_y,
int rgb_value)
- This is the code that grabs the pixels from the offscreen image.
This is stolen right out of the AWT docs.