diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-12-08 00:37:38 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-12-08 00:37:38 +0000 |
commit | c411a4ea9f23a55037b2f338b4e8baa9d156a620 (patch) | |
tree | 15ba445dcf7b6ad527aa8cb258d8357d129c9745 /src/xine-engine/osd.h | |
parent | a92ee9f39de3f3e62032f4d7ce8c893df8530680 (diff) | |
download | xine-lib-c411a4ea9f23a55037b2f338b4e8baa9d156a620.tar.gz xine-lib-c411a4ea9f23a55037b2f338b4e8baa9d156a620.tar.bz2 |
osd fonts and interface update
CVS patchset: 1174
CVS date: 2001/12/08 00:37:38
Diffstat (limited to 'src/xine-engine/osd.h')
-rw-r--r-- | src/xine-engine/osd.h | 260 |
1 files changed, 117 insertions, 143 deletions
diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h index 2e27faf93..f22924492 100644 --- a/src/xine-engine/osd.h +++ b/src/xine-engine/osd.h @@ -1,159 +1,133 @@ -#ifndef __OSD_H__ -#define __OSD_H__ - -#ifdef __OSD_C__ +/* + * Copyright (C) 2000-2001 the xine project + * + * This file is part of xine, a unix video player. + * + * xine is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * xine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * OSD stuff (text and graphic primitives) + */ + +#ifndef HAVE_OSD_H +#define HAVE_OSD_H + +#include "video_overlay.h" typedef struct osd_object_s osd_object_t; + typedef struct osd_renderer_s osd_renderer_t; -typedef struct osd_fontchar_s osd_fontchar_t; typedef struct osd_font_s osd_font_t; -struct osd_object_s { - osd_object_t *next; - osd_renderer_t *renderer; +struct osd_renderer_s { - int width, height; /* work area dimentions */ - uint8_t *area; /* work area */ - int display_x,display_y; /* where to display it in screen */ + /* + * open a new osd object. this will allocated an empty (all zero) drawing + * area where graphic primitives may be used. + * It is ok to specify big width and height values. The render will keep + * track of the smallest changed area to not generate too big overlays. + * A default palette is initialized (i sugest keeping color 0 as transparent + * for the sake of simplicity) + */ + osd_object_t* (*new_object) (osd_renderer_t *this, int width, int height); + + /* + * free osd object + */ + void (*free_object) (osd_object_t *osd_to_close); + + + /* + * send the osd to be displayed at given pts (0=now) + * the object is not changed. there may be subsequent drawing on it. + */ + int (*show) (osd_object_t *osd, uint32_t vpts ); + + /* + * send event to hide osd at given pts (0=now) + * the object is not changed. there may be subsequent drawing on it. + */ + int (*hide) (osd_object_t *osd, uint32_t vpts ); + + /* + * Bresenham line implementation on osd object + */ + void (*line) (osd_object_t *osd, + int x1, int y1, int x2, int y2, int color ); - /* clipping box inside work area */ - int x1, y1; - int x2, y2; + /* + * filled retangle + */ + void (*filled_rect) (osd_object_t *osd, + int x1, int y1, int x2, int y2, int color ); + + /* + * set palette (color and transparency) + */ + void (*set_palette) (osd_object_t *osd, uint32_t *color, uint8_t *trans ); + + /* + * get palette (color and transparency) + */ + void (*get_palette) (osd_object_t *osd, uint32_t *color, + uint8_t *trans); + + /* + * set position were overlay will be blended + */ + void (*set_position) (osd_object_t *osd, int x, int y); + + /* + * set the font of osd object + */ + + int (*set_font) (osd_object_t *osd, char *fontname, int size); + + + /* + * render text on x,y position (8 bits version) + * no \n yet + */ + int (*render_text) (osd_object_t *osd, int x1, int y1, + char *text); + + /* + * get width and height of how text will be renderized + */ + int (*get_text_size) (osd_object_t *osd, char *text, + int *width, int *height); + + /* + * close osd rendering engine + * loaded fonts are unloaded + * osd objects are closed + */ + void (*close) (osd_renderer_t *this); - uint32_t color[16]; /* color lookup table */ - uint8_t trans[16]; /* mixer key table */ - - int32_t handle; - - osd_font_t *font; -}; - - -struct osd_renderer_s { - pthread_mutex_t osd_mutex; - video_overlay_instance_t *video_overlay; - video_overlay_event_t event; - osd_object_t *osds; - osd_font_t *fonts; -}; - -struct osd_fontchar_s { - uint16_t code; - uint16_t width; - uint16_t height; - uint8_t *bmp; -}; + /* private stuff */ -struct osd_font_s { - char name[40]; - uint16_t version; - uint16_t num_fontchars; - osd_fontchar_t *fontchar; - osd_font_t *next; + pthread_mutex_t osd_mutex; + video_overlay_instance_t *video_overlay; + video_overlay_event_t event; + osd_object_t *osds; + osd_font_t *fonts; }; -#else - -typedef void osd_object_t; -typedef void osd_renderer_t; - -#endif - /* - initialize the osd rendering engine -*/ + * initialize the osd rendering engine + */ osd_renderer_t *osd_renderer_init( video_overlay_instance_t *video_overlay ); -/* close osd rendering engine - loaded fonts are unloaded - osd objects are closed -*/ -void osd_renderer_exit( osd_renderer_t *this ); - -/* - open a new osd object. this will allocated an empty (all zero) drawing - area where graphic primitives may be used. - It is ok to specify big width and height values. The render will keep - track of the smallest changed area to not generate too big overlays. - A default palette is initialized (i sugest keeping color 0 as transparent - for the sake of simplicity) -*/ -osd_object_t *osd_open(osd_renderer_t *this, int width, int height); - - -/* - free osd object -*/ -void osd_close(osd_object_t *osd_to_close); - - -/* - send the osd to be displayed at given pts (0=now) - the object is not changed. there may be subsequent drawing on it. -*/ -int osd_show(osd_object_t *osd, uint32_t vpts ); - -/* - send event to hide osd at given pts (0=now) - the object is not changed. there may be subsequent drawing on it. -*/ -int osd_hide(osd_object_t *osd, uint32_t vpts ); - -/* - Bresenham line implementation on osd object -*/ -void osd_line(osd_object_t *osd, - int x1, int y1, int x2, int y2, int color ); - -/* - filled retangle -*/ -void osd_filled_rect(osd_object_t *osd, - int x1, int y1, int x2, int y2, int color ); - -/* - set palette (color and transparency) -*/ -void osd_set_palette(osd_object_t *osd, uint32_t *color, uint8_t *trans ); - -/* - get palette (color and transparency) -*/ -void osd_get_palette(osd_object_t *osd, uint32_t *color, uint8_t *trans ); - -/* - set position were overlay will be blended -*/ -void osd_set_position(osd_object_t *osd, int x, int y ); - -/* - load bitmap font into osd engine -*/ -char * osd_renderer_load_font(osd_renderer_t *this, char *name); - -/* - unload font -*/ -int osd_renderer_unload_font(osd_renderer_t *this, char *name ); - -/* - set the font of osd object -*/ - -int osd_set_font( osd_object_t *osd, char *fontname ); - - -/* - render text on x,y position (8 bits version) - no \n yet -*/ -int osd_render_text( osd_object_t *osd, int x1, int y1, char *text ); - -/* - get width and height of how text will be renderized -*/ -int osd_get_text_size( osd_object_t *osd, char *text, int *width, int *height ); - - #endif |