#include <frenderer.h>
Inheritance diagram for font_renderer:
Public Methods | |
font_renderer (bool use_original_colors=false) throw () | |
font_renderer constructor | |
virtual | ~font_renderer () throw () |
virtual bool | wait (int ms) throw () |
wait for some time | |
bool | set_color (int c) throw () |
change the programmable color of the font. | |
bool | draw_string_centered (const std::string &str, char *buffer, const point &size, int y, int xmin, int width, int offset) const throw (std::exception) |
draw a centered and possibly using multiple lines string. | |
bool | draw_string_absolute (const std::string &str, char *buffer, const point &size, int x, int y) const throw (std::exception) |
draw a string at an absolute position. | |
int | get_frame () const throw () |
virtual bool | init_frame (const point &size) throw (std::exception) |
start of animation output | |
virtual char * | lock_frame (int frame) throw (std::exception) |
lock a frame buffer | |
virtual bool | unlock_frame () throw () |
unlock a frame buffer | |
virtual bool | flip_frame () throw () |
flip a frame buffer | |
virtual bool | set_palette (const palette &pal) throw () |
set a new palette | |
virtual bool | start_decode (const std::string &fname, int version, int nbframes) throw () |
start of animation output | |
virtual sound_renderer * | get_sound_renderer () throw (std::exception) |
request for a sound_renderer | |
virtual bool | save_current () throw () |
debugging function : do not use | |
Protected Methods | |
virtual void | save (int frame=-1) |
int | char_width (int c) const throw (std::exception) |
get the width of a character. | |
int | string_width (const std::string &str) const throw (std::exception) |
get the width of a string. | |
int | char_height (int c) const throw (std::exception) |
get the height of a character. | |
int | string_height (const std::string &str) const throw (std::exception) |
get the height of a string. | |
int | draw_char (char *buffer, const point &size, int x, int y, int c) const throw (std::exception) |
draw a character in the given frame buffer. | |
void | draw_substring (const std::string &str, char *buffer, const point &size, int x, int y) const throw (std::exception) |
draw a string in the given frame buffer. | |
const std::string & | get_filename () const throw () |
int | get_nbframes () const throw () |
int | get_width () const throw () |
int | get_height () const throw () |
const palette & | pal () const throw () |
const char * | data () const throw () |
void | clean () throw () |
memory cleanup (deletes frame buffer) | |
void | set_frame (int f) throw () |
Private Attributes | |
int | _nb_frames |
The number of frames in the font. | |
int | _color |
A color parameter used for font printing. | |
bool | _original |
flag for color selection | |
std::vector< std::pair< int, int > > | _sizes |
array that contains the size of the different frames (i.e. characters) of the font. | |
std::vector< char * > | _chars |
array of the font data. |
This class is a valid renderer implementation. The frames are kept in memory, as bitmap representing characters, so that they can be rendered again in another frame as strings.
This class also contains some functions useful for printing strings. This is used to show subtitles and more generally texts in animations.
Definition at line 54 of file frenderer.h.
|
font_renderer constructor
Definition at line 29 of file frenderer.cpp. |
|
Definition at line 33 of file frenderer.cpp. |
|
get the height of a character.
Definition at line 53 of file frenderer.cpp. |
|
get the width of a character.
Definition at line 48 of file frenderer.cpp. |
|
memory cleanup (deletes frame buffer)
Reimplemented in window_renderer. Definition at line 25 of file brenderer.cpp. |
|
Definition at line 54 of file brenderer.h. References base_renderer::_data. Referenced by save(). |
|
draw a character in the given frame buffer.
Definition at line 76 of file frenderer.cpp. |
|
draw a string at an absolute position.
Definition at line 137 of file frenderer.cpp. Referenced by player::handleTextResource(). |
|
draw a centered and possibly using multiple lines string. This method performs calculation of the string size before choosing where to draw it. As I still not have figured out exactly what is the meaning of the fields in the TRES chunck, the real meaning of the parameters can be quite difficult to understand.
Definition at line 142 of file frenderer.cpp. References split(). Referenced by player::handleTextResource(). |
|
draw a string in the given frame buffer.
Definition at line 128 of file frenderer.cpp. |
|
flip a frame buffer This is called by the animation player when the current frame should be shown.
Implements renderer. Definition at line 65 of file brenderer.cpp. |
|
Definition at line 49 of file brenderer.h. References base_renderer::_fname. |
|
Definition at line 58 of file brenderer.h. References base_renderer::_frame. |
|
Definition at line 52 of file brenderer.h. References base_renderer::_height. Referenced by save(). |
|
Definition at line 50 of file brenderer.h. References base_renderer::_nbframes. |
|
request for a sound_renderer This is called by the animation player when sound output is required by the animation.
Implements renderer. Reimplemented in window_renderer. Definition at line 68 of file brenderer.h. |
|
Definition at line 51 of file brenderer.h. References base_renderer::_width. Referenced by save(). |
|
start of animation output This is called by the animation player when the frame size is changing.
Implements renderer. Reimplemented in bitmap_renderer, bitmap_file_renderer, and window_renderer. Definition at line 45 of file brenderer.cpp. Referenced by bitmap_renderer::init_frame(). |
|
lock a frame buffer This is called by the animation player when a frame is going to be decoded.
Implements renderer. Definition at line 55 of file brenderer.cpp. |
|
Definition at line 53 of file brenderer.h. |
|
Implements base_renderer. Definition at line 39 of file frenderer.cpp. References _chars, _nb_frames, _sizes, base_renderer::data(), base_renderer::get_height(), and base_renderer::get_width(). |
|
debugging function : do not use
Reimplemented in bitmap_file_renderer. Definition at line 151 of file renderer.h. |
|
change the programmable color of the font.
Definition at line 130 of file frenderer.h. References _color. Referenced by player::handleTextResource(). |
|
Definition at line 56 of file brenderer.h. References base_renderer::_frame. |
|
set a new palette This is called by the animation player when the palette is changing.
Implements renderer. Reimplemented in bitmap_renderer. Definition at line 70 of file brenderer.cpp. Referenced by bitmap_renderer::set_palette(). |
|
start of animation output This is called by the animation player when output is going to start.
Implements renderer. Definition at line 67 of file brenderer.h. References base_renderer::_fname, and base_renderer::_nbframes. |
|
get the height of a string.
Definition at line 67 of file frenderer.cpp. |
|
get the width of a string.
Definition at line 58 of file frenderer.cpp. |
|
unlock a frame buffer This is called by the animation player when a frame has been decoded.
Implements renderer. Definition at line 61 of file brenderer.cpp. |
|
wait for some time This is called by the animation player when the animation should stay idle.
Implements renderer. Definition at line 68 of file frenderer.h. |
|
array of the font data.
Definition at line 60 of file frenderer.h. Referenced by save(). |
|
A color parameter used for font printing.
Definition at line 57 of file frenderer.h. Referenced by set_color(). |
|
The number of frames in the font.
Definition at line 56 of file frenderer.h. Referenced by save(). |
|
flag for color selection
Definition at line 58 of file frenderer.h. |
|
array that contains the size of the different frames (i.e. characters) of the font.
Definition at line 59 of file frenderer.h. Referenced by save(). |