1 /*********************************************************************
2 
3   artwork.h
4 
5   Generic backdrop/overlay functions.
6 
7   Be sure to include driver.h before including this file.
8 
9   Created by Mike Balfour - 10/01/1998
10 *********************************************************************/
11 
12 #ifndef ARTWORK_H
13 
14 #define ARTWORK_H 1
15 
16 /*********************************************************************
17   artwork
18 
19   This structure is a generic structure used to hold both backdrops
20   and overlays.
21 *********************************************************************/
22 
23 struct artwork
24 {
25 	/* Publically accessible */
26 	struct osd_bitmap *artwork;
27 	struct osd_bitmap *artwork1;
28 	struct osd_bitmap *alpha;
29 	struct osd_bitmap *orig_artwork;   /* needed for palette recalcs */
30 	struct osd_bitmap *vector_bitmap;  /* needed to buffer the vector image in vg with overlays */
31 	UINT8 *orig_palette;               /* needed for restoring the colors after special effects? */
32 	int num_pens_used;
33 	UINT8 *transparency;
34 	int num_pens_trans;
35 	int start_pen;
36 	UINT8 *brightness;                 /* brightness of each palette entry */
37 	UINT64 *rgb;
38 	UINT8 *pTable;                     /* Conversion table usually used for mixing colors */
39 };
40 
41 
42 struct artwork_element
43 {
44 	struct rectangle box;
45 	UINT8 red,green,blue;
46 	UINT16 alpha;   /* 0x00-0xff or OVERLAY_DEFAULT_OPACITY */
47 };
48 
49 #define OVERLAY_DEFAULT_OPACITY         0xffff
50 
51 #ifndef MIN
52 #define MIN(x,y) ((x)<(y)?(x):(y))
53 #endif
54 #ifndef MAX
55 #define MAX(x,y) ((x)>(y)?(x):(y))
56 #endif
57 
58 extern struct artwork *artwork_backdrop;
59 extern struct artwork *artwork_overlay;
60 extern struct osd_bitmap *overlay_real_scrbitmap;
61 
62 /*********************************************************************
63   functions that apply to backdrops AND overlays
64 *********************************************************************/
65 void overlay_load(const char *filename, unsigned int start_pen, unsigned int max_pens);
66 void overlay_create(const struct artwork_element *ae, unsigned int start_pen, unsigned int max_pens);
67 void backdrop_load(const char *filename, unsigned int start_pen, unsigned int max_pens);
68 void artwork_load(struct artwork **a,const char *filename, unsigned int start_pen, unsigned int max_pens);
69 void artwork_load_size(struct artwork **a,const char *filename, unsigned int start_pen, unsigned int max_pens, int width, int height);
70 void artwork_elements_scale(struct artwork_element *ae, int width, int height);
71 void artwork_free(struct artwork **a);
72 
73 /*********************************************************************
74   functions that are backdrop-specific
75 *********************************************************************/
76 void backdrop_refresh(struct artwork *a);
77 void backdrop_refresh_tables (struct artwork *a);
78 void backdrop_set_palette(struct artwork *a, unsigned char *palette);
79 int backdrop_black_recalc(void);
80 void draw_backdrop(struct osd_bitmap *dest,const struct osd_bitmap *src,int sx,int sy,
81 		   const struct rectangle *clip);
82 void drawgfx_backdrop(struct osd_bitmap *dest,const struct GfxElement *gfx,
83 		      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
84 		      const struct rectangle *clip,const struct osd_bitmap *back);
85 
86 /*********************************************************************
87   functions that are overlay-specific
88 *********************************************************************/
89 int overlay_set_palette (unsigned char *palette, int num_shades);
90 
91 #endif
92 
93