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
|
/*
* 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
#ifdef GLX
#include <GL/gl.h>
#include "Draw.h"
#endif
#include "Types.h"
typedef struct {
#ifdef GLX
unsigned char *t_bits; /* Should be kept in sync with same part of */
GLuint texture; /* ImageBits */
ZnReal t;
ZnReal s;
#endif
int width;
int height;
unsigned char *pixels;
int rowstride;
} BitmapBits;
typedef struct _ImageBits {
#ifdef GLX
unsigned char *t_bits; /* Should be kept in sync with same part of */
GLuint texture; /* BitmapBits */
ZnReal t;
ZnReal s;
#endif
int width;
int height;
XImage *pixels;
XImage *mask;
BitmapBits *b_bits;
struct _ImagePixmap *pixmaps;
} ImageBits;
struct _WidgetInfo;
int
ValidateImage(struct _WidgetInfo */* wi */,
void */* item_or_field */,
char */* image_name */,
Tk_ImageChangedProc */* image_proc */,
Tk_Image */* image_ref */,
char */* msg */);
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)
#ifdef GLX
TexFont *
GetTexFont(ZnWindow /* win */,
ZnFont /* font */);
ImageBits *
GetImageTexture(ZnWindow /* win */,
char */* image_name */,
ZnImage /* image */);
BitmapBits *
GetBitmapTexture(Display */* dpy */,
Pixmap /* bitmap */);
#endif
#endif /* _Image_h */
|