Make centerCoord take a font size parameter to fix centering when using large font.
parent
1c2dd92d31
commit
b27eac3cbf
|
@ -1850,10 +1850,10 @@ void Image::Delta( const Image &image, Image* targetimage) const {
|
|||
#endif
|
||||
}
|
||||
|
||||
const Coord Image::centreCoord( const char *text ) const {
|
||||
const Coord Image::centreCoord( const char *text, int size=1 ) const {
|
||||
int index = 0;
|
||||
int line_no = 0;
|
||||
int text_len = strlen( text );
|
||||
int text_len = strlen(text);
|
||||
int line_len = 0;
|
||||
int max_line_len = 0;
|
||||
const char *line = text;
|
||||
|
@ -1869,8 +1869,8 @@ const Coord Image::centreCoord( const char *text ) const {
|
|||
line = text+index;
|
||||
line_no++;
|
||||
}
|
||||
int x = (width - (max_line_len * ZM_CHAR_WIDTH) ) / 2;
|
||||
int y = (height - (line_no * LINE_HEIGHT) ) / 2;
|
||||
int x = (width - (max_line_len * ZM_CHAR_WIDTH * size) ) / 2;
|
||||
int y = (height - (line_no * LINE_HEIGHT * size) ) / 2;
|
||||
return Coord(x, y);
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ public:
|
|||
//Image *Delta( const Image &image ) const;
|
||||
void Delta( const Image &image, Image* targetimage) const;
|
||||
|
||||
const Coord centreCoord( const char *text ) const;
|
||||
const Coord centreCoord( const char *text, const int size ) const;
|
||||
void MaskPrivacy( const unsigned char *p_bitmask, const Rgb pixel_colour=0x00222222 );
|
||||
void Annotate( const char *p_text, const Coord &coord, const unsigned int size=1, const Rgb fg_colour=RGB_WHITE, const Rgb bg_colour=RGB_BLACK );
|
||||
Image *HighlightEdges( Rgb colour, unsigned int p_colours, unsigned int p_subpixelorder, const Box *limits=0 );
|
||||
|
|
Loading…
Reference in New Issue