summaryrefslogtreecommitdiff
path: root/amiga/iff_dr2d.h
blob: 7ef562215d01be8a92f878c4bb73932731a754db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
 * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
 *
 * This file is part of NetSurf, http://www.netsurf-browser.org/
 *
 * NetSurf 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; version 2 of the License.
 *
 * NetSurf 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, see <http://www.gnu.org/licenses/>.
 */

#ifdef WITH_NS_SVG
#ifndef AMIGA_IFF_DR2D_H
#define AMIGA_IFF_DR2D_H
#include <proto/iffparse.h>
#include <datatypes/pictureclass.h>
#include <stdbool.h>
#ifndef AMIGA_DR2D_STANDALONE
#include "content/content.h"
#include "amiga/download.h"
#endif

#define ID_DR2D MAKE_ID('D','R','2','D')
#define ID_DRHD MAKE_ID('D','R','H','D')
#define ID_ATTR MAKE_ID('A','T','T','R')
#define ID_CPLY MAKE_ID('C','P','L','Y')
#define ID_OPLY MAKE_ID('O','P','L','Y')
#define ID_STXT MAKE_ID('S','T','X','T')
#define ID_DASH MAKE_ID('D','A','S','H')
//#define ID_CMAP MAKE_ID('C','M','A','P')  in dt/pictureclass
//#define ID_NAME MAKE_ID('N','A','M','E')  in dt/datatypes
#define ID_ANNO MAKE_ID('A','N','N','O')
#define ID_FONS MAKE_ID('F','O','N','S')

struct drhd_struct {
	float	XLeft, YTop, XRight, YBot;
};

struct poly_struct {
    USHORT	NumPoints;
//	    float	PolyPoints[]; // 2*numpoints
};

#define INDICATOR  0xFFFFFFFF
#define IND_SPLINE 0x00000001
#define IND_MOVETO 0x00000002
#define IND_CURVE  0x00000001

struct fons_struct {
    UBYTE	FontID;	/* ID the font is referenced by */
    UBYTE	Pad1;          	/* Always 0 */
    UBYTE	Proportional;	/* Is it proportional? */
    UBYTE	Serif;	/* does it have serifs? */
};

struct stxt_struct {
    UBYTE	Pad0;	/* Always 0 (for future expansion) */
    UBYTE	WhichFont;      /* Which font to use */
    float	CharW, CharH,  	/* W/H of an individual char */
	BaseX, BaseY,  	/* Start of baseline */
	Rotation;      	/* Angle of text (in degrees) */
    uint16	NumChars;
    //char	TextChars[NumChars];
};

/* Various fill types */
#define FT_NONE	0    /* No fill	*/
#define FT_COLOR    	1    /* Fill with color from palette */
#define FT_OBJECTS	2    /* Fill with tiled objects	*/

struct attr_struct {
    UBYTE	FillType;    /* One of FT_*, above	*/
    UBYTE	JoinType;    /* One of JT_*, below	*/
    UBYTE	DashPattern; /* ID of edge dash pattern */
    UBYTE	ArrowHead;   /* ID of arrowhead to use  */
    USHORT	FillValue;   /* Color or object with which to fill */
    USHORT	EdgeValue;   /* Edge color index	*/
    USHORT	WhichLayer;  /* ID of layer it's in	*/
    float	EdgeThick;   /* Line width	*/
};

/* Join types */
#define JT_NONE	   0    	/* Don't do line joins */
#define JT_MITER  	1    	/* Mitered join */
#define JT_BEVEL  	2    	/* Beveled join */
#define JT_ROUND  	3    	/* Round join */

struct dash_struct {
    USHORT	DashID;	/* ID of the dash pattern */
    USHORT	NumDashes; 	/* Should always be even */
//	    IEEE	Dashes[NumDashes];  	/* On-off pattern */
};

bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
		uint32 size, const char *url);
#ifndef AMIGA_DR2D_STANDALONE
bool ami_save_svg(struct hlcache_handle *c, char *filename);
#endif
#endif // AMIGA_IFF_DR2D_H
#endif // WITH_NS_SVG