From 0b674e357f620a2e0810cf74f3e66e8072d9bb86 Mon Sep 17 00:00:00 2001 From: bernie Date: Tue, 11 Apr 2006 00:08:24 +0000 Subject: [PATCH] text_offset(): New function, but I'm not quite confident with the design. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@594 38d2e660-2303-0410-9eaa-f027e97ec537 --- gfx/gfx.h | 5 ++++- gfx/text.c | 15 +++++++++++++-- gfx/text.h | 4 ++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/gfx/gfx.h b/gfx/gfx.h index 6e812a96..2cfe5b5f 100755 --- a/gfx/gfx.h +++ b/gfx/gfx.h @@ -14,6 +14,9 @@ /*#* *#* $Log$ + *#* Revision 1.13 2006/04/11 00:08:24 bernie + *#* text_offset(): New function, but I'm not quite confident with the design. + *#* *#* Revision 1.12 2006/03/27 04:48:56 bernie *#* gfx_blitImage(): New function; gfx_blitRaster(): Fix clipping bug. *#* @@ -164,7 +167,7 @@ typedef struct Image coord_t width; /*!< Raster width in pixels. */ coord_t height; /*!< Raster height in pixels. */ coord_t stride; /*!< Bytes per row. */ -}; +} Image; #if CONFIG_BITMAP_FMT == BITMAP_FMT_PLANAR_H_MSB /** diff --git a/gfx/text.c b/gfx/text.c index 08d3ae61..a9f653c4 100755 --- a/gfx/text.c +++ b/gfx/text.c @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.9 2006/04/11 00:08:24 bernie + *#* text_offset(): New function, but I'm not quite confident with the design. + *#* *#* Revision 1.8 2006/03/22 09:50:37 bernie *#* Use the same format for fonts and rasters. *#* @@ -107,6 +110,14 @@ /*! ANSI escape sequences flag: true for ESC state on */ static bool ansi_mode = false; +// FIXME: move in bitmap? +static coord_t text_xoff, text_yoff; + +void text_offset(Bitmap *bm, coord_t x, coord_t y) +{ + text_xoff = x; + text_yoff = y; +} /*! * Move (imaginary) cursor to column and row specified. @@ -119,8 +130,8 @@ void text_moveto(struct Bitmap *bm, int row, int col) ASSERT(row >= 0); ASSERT(row < bm->height / bm->font->height); - bm->penX = col * bm->font->width; - bm->penY = row * bm->font->height; + bm->penX = col * bm->font->width + text_xoff; + bm->penY = row * bm->font->height + text_yoff; } diff --git a/gfx/text.h b/gfx/text.h index 1f00e7fa..76ffa55d 100755 --- a/gfx/text.h +++ b/gfx/text.h @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.5 2006/04/11 00:08:24 bernie + *#* text_offset(): New function, but I'm not quite confident with the design. + *#* *#* Revision 1.4 2006/03/07 22:18:04 bernie *#* Correctly compute text width for prop fonts; Make styles a per-bitmap attribute. *#* @@ -107,6 +110,7 @@ struct Bitmap; /* Low-level text functions (mware/text.c) */ +void text_offset(struct Bitmap *bm, coord_t x, coord_t y); void text_moveto(struct Bitmap *bm, int row, int col); void text_setcoord(struct Bitmap *bm, int x, int y); int text_putchar(char c, struct Bitmap *bm); -- 2.25.1