summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xatari/plot/font_freetype.c24
-rwxr-xr-xatari/plot/font_vdi.c25
-rwxr-xr-xatari/plot/plotter.c3
-rwxr-xr-xatari/plot/plotter.h103
-rwxr-xr-xatari/plot/plotter_vdi.c7
5 files changed, 105 insertions, 57 deletions
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 0a1addfdf..ff2be22ee 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -17,27 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <math.h>
-#include <assert.h>
-#include <string.h>
-#include <windom.h>
+
#include <ft2build.h>
#include FT_CACHE_H
-#include "desktop/plot_style.h"
-#include "image/bitmap.h"
-#include "atari/bitmap.h"
#include "atari/plot/plotter.h"
#include "atari/plot/font_freetype.h"
-#include "atari/gui.h"
-#include "atari/font.h"
-#include "atari/options.h"
-#include "atari/findfile.h"
-#include "utils/utf8.h"
-#include "utils/log.h"
+
#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
@@ -65,7 +51,7 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle,
static int str_split( FONT_PLOTTER self, const plot_font_style_t *fstyle,
const char *string, size_t length,int x,
size_t *char_offset, int *actual_x );
-static int pixel_position( FONT_PLOTTER self, const plot_font_style_t *fstyle,
+static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *fstyle,
const char *string, size_t length,int x,
size_t *char_offset, int *actual_x );
static int text( FONT_PLOTTER self, int x, int y, const char *text,
@@ -361,7 +347,7 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t *fstyle,
}
-static int pixel_position( FONT_PLOTTER self, const plot_font_style_t *fstyle,
+static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *fstyle,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x)
{
@@ -490,7 +476,7 @@ int ctor_font_plotter_freetype( FONT_PLOTTER self )
self->dtor = dtor;
self->str_width = str_width;
self->str_split = str_split;
- self->pixel_position = pixel_position;
+ self->pixel_pos = pixel_pos;
self->text = text;
LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));
if( !init ) {
diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c
index 7d6a3f494..d5cdc4eac 100755
--- a/atari/plot/font_vdi.c
+++ b/atari/plot/font_vdi.c
@@ -15,21 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <math.h>
-#include <assert.h>
-#include <string.h>
-#include <windom.h>
-
-#include "desktop/plot_style.h"
-#include "atari/bitmap.h"
+
+
#include "atari/plot/plotter.h"
#include "atari/plot/font_vdi.h"
+
#include "utils/utf8.h"
#include "utils/log.h"
+
static char * lstr = NULL;
@@ -37,7 +31,7 @@ static int dtor( FONT_PLOTTER self );
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const char * str, size_t length, int * width );
static int str_split( FONT_PLOTTER self, const plot_font_style_t *fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x );
-static int pixel_position( FONT_PLOTTER self, const plot_font_style_t *fstyle,const char *string,
+static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x );
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle );
@@ -45,14 +39,13 @@ static bool init = false;
static int vdih;
extern struct s_vdi_sysinfo vdi_sysinfo;
-extern unsigned short gdosversion;
int ctor_font_plotter_vdi( FONT_PLOTTER self )
{
self->dtor = dtor;
self->str_width = str_width;
self->str_split = str_split;
- self->pixel_position = pixel_position;
+ self->pixel_pos = pixel_pos;
self->text = text;
LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));
if( !init ) {
@@ -141,7 +134,7 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
return( 0 );
}
-static int pixel_position( FONT_PLOTTER self, const plot_font_style_t * fstyle,const char *string,
+static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x )
{
short cw, ch, cellw, cellh;
@@ -211,13 +204,13 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
vst_effects( self->vdi_handle, fx );
vst_alignment(vdih, 0, 4, &cw, &ch );
vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
- vswr_mode( self->vdi_handle, MD_TRANS );
+ vswr_mode( self->vdi_handle, MD_TRANS );
if( vdi_sysinfo.scr_bpp >= 4 ){
vst_color( self->vdi_handle, RGB_TO_VDI(fstyle->foreground) );
} else {
vst_color( self->vdi_handle, BLACK );
}
- if( gdosversion > 0x03000 ){
+ if( atari_sysinfo.gdosversion > 0x03000 ){
v_ftext( self->vdi_handle, x, y, (char*)&textcpy );
} else {
v_gtext( self->vdi_handle, x, y, (char*)&textcpy );
diff --git a/atari/plot/plotter.c b/atari/plot/plotter.c
index a54c15f6d..712499a77 100755
--- a/atari/plot/plotter.c
+++ b/atari/plot/plotter.c
@@ -37,8 +37,7 @@
#include "atari/gui.h"
#include "utils/log.h"
#include "atari/misc.h"
-
-extern unsigned short gdosversion;
+#include "atari/osspec.h"
unsigned char rgb_web_pal[216][3] = {
diff --git a/atari/plot/plotter.h b/atari/plot/plotter.h
index 973b70058..7f4794086 100755
--- a/atari/plot/plotter.h
+++ b/atari/plot/plotter.h
@@ -17,9 +17,24 @@
*/
#ifndef _GEM_PLOTTER_API_H_
#define _GEM_PLOTTER_API_H_
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <math.h>
+#include <assert.h>
+#include <string.h>
#include <windom.h>
-
+#include "desktop/plot_style.h"
+#include "image/bitmap.h"
+#include "atari/bitmap.h"
+#include "atari/osspec.h"
+#include "atari/gui.h"
+#include "atari/font.h"
+#include "atari/options.h"
+#include "atari/findfile.h"
+#include "utils/utf8.h"
+#include "utils/log.h"
#ifndef ceilf
#define ceilf(x) (float)ceil((double)x)
@@ -56,6 +71,22 @@ static const char * plot_error_codes[] =
typedef struct s_font_plotter * FONT_PLOTTER;
typedef struct s_gem_plotter * GEM_PLOTTER;
typedef struct s_font_plotter * GEM_FONT_PLOTTER; /* for public use ... */
+
+
+/* declaration of font plotter member functions: (_fpmf_ prefix) */
+
+typedef int (*_fpmf_str_width)( FONT_PLOTTER self, const plot_font_style_t *fstyle,
+ const char * str, size_t length, int * width);
+typedef int (*_fpmf_str_split)( FONT_PLOTTER self, const plot_font_style_t *fstyle,
+ const char *string, size_t length,
+ int x, size_t *char_offset, int *actual_x);
+typedef int (*_fpmf_pixel_pos)( FONT_PLOTTER self, const plot_font_style_t *fstyle,
+ const char *string, size_t length,
+ int x, size_t *char_offset, int *actual_x);
+typedef int (*_fpmf_text)( FONT_PLOTTER self, int x, int y, const char *text,
+ size_t length, const plot_font_style_t *fstyle);
+typedef int (*_fpmf_dtor)( FONT_PLOTTER self );
+
struct s_font_plotter
{
char * name;
@@ -63,17 +94,12 @@ struct s_font_plotter
int vdi_handle;
void * priv_data;
GEM_PLOTTER plotter;
-
- bool (*str_width)(FONT_PLOTTER self, const plot_font_style_t *fstyle,
- const char * str, size_t length, int * width);
- bool (*str_split)(FONT_PLOTTER self, const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x);
- bool (*pixel_position)(FONT_PLOTTER self, const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x);
- void (*text)(FONT_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle);
- void (*dtor)(FONT_PLOTTER self );
+
+ _fpmf_str_width str_width;
+ _fpmf_str_split str_split;
+ _fpmf_pixel_pos pixel_pos;
+ _fpmf_text text;
+ _fpmf_dtor dtor;
};
@@ -124,6 +150,32 @@ struct s_frame_buf
void * mem;
};
+/* declaration of plotter member functions ( _pmf_ prefix )*/
+typedef int (*_pmf_resize)(GEM_PLOTTER self, int w, int h);
+typedef int (*_pmf_move)(GEM_PLOTTER self, short x, short y );
+typedef void * (*_pmf_lock)(GEM_PLOTTER self);
+typedef void * (*_pmf_create_framebuffer)(GEM_PLOTTER self);
+typedef void * (*_pmf_switch_to_framebuffer)(GEM_PLOTTER self);
+typedef int (*_pmf_unlock)(GEM_PLOTTER self);
+typedef int (*_pmf_update_region)(GEM_PLOTTER self, GRECT region);
+typedef int (*_pmf_update_screen_region)( GEM_PLOTTER self, GRECT region );
+typedef int (*_pmf_update_screen)(GEM_PLOTTER self);
+typedef int (*_pmf_put_pixel)(GEM_PLOTTER self, int x, int y, int color );
+typedef int (*_pmf_copy_rect)(GEM_PLOTTER self, GRECT src, GRECT dst );
+typedef int (*_pmf_clip)(GEM_PLOTTER self, int x0, int y0, int x1, int y1);
+typedef int (*_pmf_arc)(GEM_PLOTTER self, int x, int y, int radius, int angle1, int angle2, const plot_style_t * pstyle);
+typedef int (*_pmf_disc)(GEM_PLOTTER self, int x, int y, int radius, const plot_style_t * pstyle);
+typedef int (*_pmf_line)(GEM_PLOTTER self, int x0, int y0, int x1, int y1, const plot_style_t * pstyle);
+typedef int (*_pmf_rectangle)(GEM_PLOTTER self, int x0, int y0, int x1, int y1, const plot_style_t * pstyle);
+typedef int (*_pmf_polygon)(GEM_PLOTTER self, const int *p, unsigned int n, const plot_style_t * pstyle);
+typedef int (*_pmf_path)(GEM_PLOTTER self, const float *p, unsigned int n, int fill, float width, int c, const float transform[6]);
+typedef int (*_pmf_bitmap_resize) ( GEM_PLOTTER self, struct bitmap * bm, int nw, int nh );
+typedef int (*_pmf_bitmap)(GEM_PLOTTER self, struct bitmap * bmp, int x, int y,
+ unsigned long bg, unsigned long flags );
+typedef int (*_pmf_text)(GEM_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle);
+typedef int (*_pmf_dtor)(GEM_PLOTTER self);
+
+
struct s_gem_plotter
{
@@ -138,8 +190,29 @@ struct s_gem_plotter
int cfbi; /* current framebuffer index */
FONT_PLOTTER font_plotter;
- int (*dtor)(GEM_PLOTTER self);
- int (*resize)(GEM_PLOTTER self, int w, int h);
+ _pmf_resize resize;
+ _pmf_move move;
+ _pmf_lock lock;
+ _pmf_unlock unlock;
+ _pmf_create_framebuffer create_framebuffer;
+ _pmf_switch_to_framebuffer switch_to_framebuffer;
+ _pmf_update_region update_region;
+ _pmf_update_screen update_screen;
+ _pmf_update_screen_region update_screen_region;
+ _pmf_put_pixel put_pixel;
+ _pmf_copy_rect copy_rect;
+ _pmf_clip clip;
+ _pmf_arc arc;
+ _pmf_disc disc;
+ _pmf_line line;
+ _pmf_rectangle rectangle;
+ _pmf_polygon polygon;
+ _pmf_path path;
+ _pmf_bitmap_resize bitmap_resize;
+ _pmf_bitmap bitmap;
+ _pmf_text text;
+ _pmf_dtor dtor;
+/*
int (*move)(GEM_PLOTTER self, short x, short y );
void * (*lock)(GEM_PLOTTER self);
void * (*create_framebuffer)(GEM_PLOTTER self);
@@ -161,6 +234,8 @@ struct s_gem_plotter
int (*bitmap)(GEM_PLOTTER self, struct bitmap * bmp, int x, int y,
unsigned long bg, unsigned long flags );
int (*text)(GEM_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle);
+ int (*dtor)(GEM_PLOTTER self);
+*/
};
diff --git a/atari/plot/plotter_vdi.c b/atari/plot/plotter_vdi.c
index 60153f64c..45640df57 100755
--- a/atari/plot/plotter_vdi.c
+++ b/atari/plot/plotter_vdi.c
@@ -24,15 +24,10 @@
#include <windom.h>
#include <Hermes/Hermes.h>
-#include "desktop/plot_style.h"
-#include "image/bitmap.h"
-#include "atari/bitmap.h"
#include "atari/plot/eddi.h"
#include "atari/plot/plotter.h"
#include "atari/plot/plotter_vdi.h"
#include "atari/plot/font_vdi.h"
-#include "atari/bitmap.h"
-#include "utils/log.h"
/* assign vdi line style to dst ( netsurf type ) */
#define NSLT2VDI(dst, src) \
@@ -41,7 +36,7 @@
dst = 3; \
break;\
case PLOT_OP_TYPE_DASH:\
- dst = 4; \
+ dst = 5; \
break;\
case PLOT_OP_TYPE_SOLID:\
case PLOT_OP_TYPE_NONE:\