aboutsummaryrefslogtreecommitdiff
path: root/generic/Image.h
blob: b98619b2afc0ce8977adac2a46fa4041ad4d5e60 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * Image.h -- Image support routines.
 *
 * Authors		: Patrick LECOANET
 * Creation date	: Wed Dec  8 11:04:44 1999
 *
 * $Id$
 */

/*
 *  Copyright (c) 1999 CENA, Patrick Lecoanet --
 *
 * This code is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This code 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this code; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */


#ifndef _Image_h
#define _Image_h


#include <libart_lgpl/libart.h>

#include "Types.h"


typedef struct {
  unsigned char	*pixels;
  int		width;
  int		height;
  int		rowstride;
} BitmapBits;


typedef struct {
  XImage		*pixels;
  XImage		*mask;
  BitmapBits		*b_bits;
  int			width;
  int			height;
  struct _ImagePixmap	*pixmaps;
#ifdef SHM
  ArtPixBuf		*pixbuf;
#endif
} ImageBits;

typedef struct _SuckChar {
  int	width;
  int	bitmap_offset;
} SuckChar;

typedef struct _SuckFont {
  unsigned char	*bitmap;
  int		width;
  int		height;
  int		ascent;
  int		descent;
  SuckChar	chars[256];
} FontBitmap;


ImageBits *
GetImageBits(ZnWindow	/* win */,
	     char	*/* image_name */,
	     ZnImage	/* image */);
Pixmap
GetImagePixmap(ZnWindow	/* win */,
	       char	*/* image_name */,
	       ZnImage	/* image */,
	       Pixmap	*mask_pmap);
void
InvalidateImage(char	*/* image_name */);
BitmapBits *
GetBitmapMask(Display	*/* dpy */,
	      Pixmap	/* bitmap */);

#define GetBitmapPixel(bbits, x, y) (((bbits)->pixels[(y)*(bbits)->rowstride+((x)>>3)]<<((x)&7))&0x80)

FontBitmap *
GetFontBitmap(ZnWindow	win,
	      ZnFont	font);

void
rgb_text(art_u8 *dst,
	 int x0, int y0, int x1, int y1, int dst_rowstride,
	 char *text, int num_chars, int start_x, int start_y,
	 FontBitmap *fb, art_u32 rgba);
void
rgb_bitmap(art_u8 *dst,
	   int x0, int y0, int x1, int y1, int dst_rowstride,
	   art_u8 *src, int start_x, int start_y,
	   int src_width, int src_height, int src_rowstride,
	   art_u32 rgba);
void
rgb_image(art_u8 *dst,
	  int x0, int y0, int x1, int y1, int dst_rowstride,
	  ArtPixBuf *pixbuf, int start_x, int start_y, int alpha);
void
tile_svp_aa(const ArtSVP *svp,
	    int x0, int y0, int x1, int y1,
	    int tile_x, int tile_y, ArtPixBuf *tile,
	    art_u32 bg_color, art_u8 *buf, int rowstride);
void
tile_svp_alpha(const ArtSVP *svp,
	       int x0, int y0, int x1, int y1,
	       int tile_x, int tile_y, ArtPixBuf *tile,
	       art_u8 alpha, art_u8 *buf, int rowstride);

#ifdef SHM
ArtPixBuf *
GetImagePixbuf(ZnWindow	/* win */,
	       char	*/* image_name */,
	       ZnImage	/* image */);
#endif


#endif	/* _Image_h */