sub_arctic.output
Class linear_gradient_text

java.lang.Object
  |
  +--sub_arctic.output.simple_text_renderer
        |
        +--sub_arctic.output.gradient_text_renderer
              |
              +--sub_arctic.output.linear_gradient_text
Direct Known Subclasses:
shadow_lin_grad_text

public class linear_gradient_text
extends gradient_text_renderer

Object for drawing of text with a linear gradient pattern in one of several standard styles.


Field Summary
protected  int _draw_style
          Drawing style used for gradient.
static int BL_DIAG_GRAD
          Style code constant for bottom-left to top-right diagonal gradient
static int HORIZ_GRAD
          Style code constant for horizontal gradient
static int LAST_GRAD_STYLE
          Last valid style code value
static int TL_DIAG_GRAD
          Style code constant for top-left to bottom-right diagonal gradient
static int VERT_GRAD
          Style code constant for vertical gradient
 
Fields inherited from class sub_arctic.output.gradient_text_renderer
_draw_gradient
 
Fields inherited from class sub_arctic.output.simple_text_renderer
_draw_color, _draw_font, _metrics
 
Constructor Summary
linear_gradient_text(java.awt.Font in_font, gradient in_grad, int in_style)
          Construct a renderer given a Font, a gradient, and a style code.
 
Method Summary
 int draw_style()
          Drawing style used for gradient.
 void draw_text(drawable on_surface, int at_x, int at_y, java.lang.String txt)
          Render text onto the given drawable object at the given location.
 void set_draw_gradient(gradient grad)
          Set the gradient to draw text in.
 void set_draw_gradient(linear_gradient grad)
          Set the gradient to draw text in.
 void set_draw_style(int style_code)
          Set the drawing style used for gradient.
 
Methods inherited from class sub_arctic.output.gradient_text_renderer
draw_gradient
 
Methods inherited from class sub_arctic.output.simple_text_renderer
baseline, draw_color, draw_font, h, leading, set_draw_color, set_draw_font, w
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TL_DIAG_GRAD

public static final int TL_DIAG_GRAD
Style code constant for top-left to bottom-right diagonal gradient

BL_DIAG_GRAD

public static final int BL_DIAG_GRAD
Style code constant for bottom-left to top-right diagonal gradient

HORIZ_GRAD

public static final int HORIZ_GRAD
Style code constant for horizontal gradient

VERT_GRAD

public static final int VERT_GRAD
Style code constant for vertical gradient

LAST_GRAD_STYLE

public static final int LAST_GRAD_STYLE
Last valid style code value

_draw_style

protected int _draw_style
Drawing style used for gradient. This must be one of TL_DIAG_GRAD, BL_DIAG_GRAD, HORIZ_GRAD, or VERT_GRAD.
Constructor Detail

linear_gradient_text

public linear_gradient_text(java.awt.Font in_font,
                            gradient in_grad,
                            int in_style)
Construct a renderer given a Font, a gradient, and a style code. A clone of the gradient will be adjusted to match the style and set to span the size of the text.
Parameters:
Font - in_font font that this renderer uses.
linear_gradient - in_grad gradient that the actual text is drawn with.
int - in_style style code indicating direction of gradient. Must be one of: TL_DIAG_GRAD, BL_DIAG_GRAD, HORIZ_GRAD, or VERT_GRAD.
Method Detail

set_draw_gradient

public void set_draw_gradient(gradient grad)
Set the gradient to draw text in. Gradient must be a linear_gradient or an error is thrown.
Parameters:
gradient - grad the new linear gradient for drawing
Overrides:
set_draw_gradient in class gradient_text_renderer

set_draw_gradient

public void set_draw_gradient(linear_gradient grad)
Set the gradient to draw text in.
Parameters:
linear_gradient - grad the new gradient for drawing

draw_style

public int draw_style()
Drawing style used for gradient. This will be one of TL_DIAG_GRAD, BL_DIAG_GRAD, HORIZ_GRAD, or VERT_GRAD.

set_draw_style

public void set_draw_style(int style_code)
Set the drawing style used for gradient. If this is not one of TL_DIAG_GRAD, BL_DIAG_GRAD, HORIZ_GRAD, or VERT_GRAD, an error will be thrown.
Parameters:
int - style_code the new drawing style code.

draw_text

public void draw_text(drawable on_surface,
                      int at_x,
                      int at_y,
                      java.lang.String txt)
Render text onto the given drawable object at the given location.
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 gradient_text_renderer