1import(1) AfterStep X11 window manager import(1)
2
3
4
6 import - functionality for reading images from files libAfterImâ
7 age/import.h
8
10 - Image file format autodetection, reading and decoding routines.
11
12
14 Functions :
15 file2ASImage(), get_asimage(), file2pixmap()
16
17 Other libAfterImage modules :
18 ascmap.h asfont.h asimage.h asvisual.h blender.h export.h
19 import.h transform.h ximage.h
20
22 Sasha Vasko <sasha at aftercode dot net>
23
25 - Defines default value for screen gamma correction.
26
27
29 Source :
30 #define SCREEN_GAMMA 2.2
31 #define DEFAULT_PNG_IMAGE_GAMMA 0.45455
32
34 - List of known image file formats.
35
36
38 Source :
39 typedef enum
40 {
41 ASIT_Xpm = 0,
42 ASIT_ZCompressedXpm,
43 ASIT_GZCompressedXpm,
44 ASIT_Png,
45 ASIT_Jpeg,
46 ASIT_Xcf,
47 ASIT_Ppm,
48 ASIT_Pnm,
49 ASIT_Bmp,
50 ASIT_Ico,
51 ASIT_Cur,
52 ASIT_Gif,
53 ASIT_Tiff,
54 ASIT_XMLScript,
55 ASIT_SVG,
56 /* reserved for future implementation : */
57 ASIT_Xbm,
58 ASIT_Targa,
59 ASIT_Supported = ASIT_Targa,
60 ASIT_Pcx,
61 ASIT_HTML,
62 ASIT_XML,
63 ASIT_Unknown
64 }ASImageFileTypes;
65
67 - entry in linked list of images loaded from single directory.
68
69
71 Source :
72 typedef struct ASImageListEntryBuffer
73 {
74 #define ASILEB_Dirty (0x01<<0)
75 #define ASILEB_Binary (0x01<<1)
76
77 ASFlagType flags ;
78
79 size_t size ;
80 char *data ;
81
82 }ASImageListEntryBuffer;
83
84 typedef struct ASImageListEntry
85 {
86 #define MAGIC_ASIMAGE_LIST_ENTRY 0xA3A311E4
87 #define IS_ASIMAGE_LIST_ENTRY(e) (((e)!=NULL)&&((e)->magic==MAGIC_ASIMAGE_LIST_ENTRY)&&((e)->ref_count>0))
88
89 unsigned long magic ;
90 struct ASImageListEntry *prev, *next ;
91 char *name ;
92 char *fullfilename ;
93
94 ASImageFileTypes type;
95 ASImage *preview;
96
97 mode_t d_mode;
98 time_t d_mtime;
99 off_t d_size; /* total size, in bytes */
100
101 ASImageListEntryBuffer *buffer ;
102
103 int ref_count;
104 }ASImageListEntry;
105
107 - load ASImage from file.
108
109
111 ASImage *file2ASImage( const char *file, ASFlagType what,
112 double gamma,
113 unsigned int compression, ... );
114
116 file - file name with or without directory name
117
118 what - reserved for future use
119
120 gamma - gamma value to be used to correct image
121
122 compression
123 - compression level of the resulting ASImage
124
125 ... - NULL terminated list of strings, representing arbitrary number
126 of directories to be searched each.
127
128
130 Pointer to ASImage structure holding image data on success.
131 NULL on failure
132
134 file2ASImage will attempt to interpret filename in the following way:
135 1)It will try to find file using unmodified filename in all the
136 provided search paths.
137 2)It will attempt to append .gz and then .Z to the filename and
138 find such file in all the provided search paths.
139 3)If filename ends with extension consisting of digits only - it will
140 attempt to find file with this extension stripped off. On success
141 this extension will be used to load subimage from the file with that
142 number. Subimages are supported only for XCF, GIF, BMP, ICO and CUR
143 files.
144 After the file is found file2ASImage() attempts to detect file format,
145 and if it is known it will load it into new ASImage structure.
146
148 asview.c: ASView.2
149
151 - increment reference counter if file is already loaded, or load image
152 from file.
153
154
156 ASImage *get_asimage( ASImageManager* imageman, const char *file,
157 ASFlagType what, unsigned int compression );
158
160 imageman
161 - pointer to valid ASVisual structure.
162
163 file - root window ID for the destination screen.
164
165 what - full image file's name with path.
166
167 compression
168 -
169
170
172 Pointer to ASImage structure holding image data on success.
173 NULL on failure
174
176 get_asimage will attempt check with the ASImageManager's list of load
177 images, and if image with requested filename already exists - it will
178 increment its reference count and return its pointer.
179 Otherwise it will call file2ASImage() to load image from file. It will
180 use PATH and gamma values from the ASImageManager to pass to
181 file2ASImage(). If image is successfully loaded - it will be added to
182 the ASImageManager's list and its pointer will be returned.
183
185 file2ASImage()
186
188 - convinience function to load file into X Pixmap.
189
190
192 Pixmap file2pixmap( struct ASVisual *asv, Window root,
193 const char *realfilename,
194 Pixmap *mask_out);
195
197 asv - pointer to valid ASVisual structure.
198
199 root - root window ID for the destination screen.
200
201 realfilename
202 - full image file's name with path.
203
204
206 Pixmap ID of the X Pixmap filled with loaded image. If mask_out is
207 not NULL it will point to image mask Pixmap ID if there is an alpha
208 channel in image, None otherwise.
209 On failure None will be returned.
210
212 file2pixmap() will attempt to open specified file and autodetect its
213 format. If format is known it will load it into ASImage first, and
214 then convert it into X Pixmap. In case image has alpha channel -
215 mask Pixmap will be produced if mask_out is not NULL.
216
217
218
2193rd Berkeley Distribution AfterStep v.2.2.6 import(1)