Krita Source Code Documentation
Loading...
Searching...
No Matches
pixels.c
Go to the documentation of this file.
1/* Pixel and tile functions for xcftools
2 *
3 * This file was written by Henning Makholm <henning@makholm.net>
4 * It is hereby in the public domain.
5 *
6 * In jurisdictions that do not recognise grants of copyright to the
7 * public domain: I, the author and (presumably, in those jurisdictions)
8 * copyright holder, hereby permit anyone to distribute and use this code,
9 * in source code or binary form, with or without modifications. This
10 * permission is world-wide and irrevocable.
11 *
12 * Of course, I will not be liable for any errors or shortcomings in the
13 * code, since I give it away without asking any compenstations.
14 *
15 * If you use or distribute this code, I would appreciate receiving
16 * credit for writing it, in whichever way you find proper and customary.
17 */
18
19#define DEBUG
20#include "xcftools.h"
21#include "pixels.h"
22#include <assert.h>
23#include <string.h>
24
26unsigned colormapLength=0 ;
27
28int
30{
31 if( ((pixel >> RED_SHIFT) & 255) == ((pixel >> GREEN_SHIFT) & 255) &&
32 ((pixel >> RED_SHIFT) & 255) == ((pixel >> BLUE_SHIFT) & 255) )
33 return (pixel >> RED_SHIFT) & 255 ;
34 return -1 ;
35}
36
37/* ****************************************************************** */
38
39typedef const struct _convertParams {
40 int bpp ;
41 int shift[4] ;
42 uint32_t base_pixel ;
43 const rgba *lookup ;
45#define RGB_SHIFT RED_SHIFT, GREEN_SHIFT, BLUE_SHIFT
46#ifdef OPAQUE
47#undef OPAQUE
48#endif
49#define OPAQUE (255 << ALPHA_SHIFT)
56
57static convertParams convertColormap = { 3, {RGB_SHIFT}, 0, 0 };
59
60/* ****************************************************************** */
61
62static inline int
63tileDirectoryOneLevel(struct tileDimensions *dim,uint32_t ptr, int* ptrOut)
64{
65 if( ptr == 0 ) {
66 *ptrOut = 0;
67 return XCF_OK; /* allowed by xcf, apparently */
68 }
69 if( xcfL(ptr ) != dim->c.r - dim->c.l ||
70 xcfL(ptr+4) != dim->c.b - dim->c.t ) {
71 FatalBadXCF("Drawable size mismatch at %" PRIX32, ptr);
72 *ptrOut = XCF_PTR_EMPTY;
73 return XCF_ERROR;
74 }
75 *ptrOut = (ptr += 8) ;
76 return XCF_OK;
77}
78
79static int
80initTileDirectory(struct tileDimensions *dim,struct xcfTiles *tiles,
81 const char *type)
82{
83 uint32_t ptr ;
84 uint32_t data ;
85
86 ptr = tiles->hierarchy ;
87 tiles->hierarchy = 0 ;
88 int ptrOut;
89 if (tileDirectoryOneLevel(dim,ptr, &ptrOut) != XCF_OK) {
90 return XCF_ERROR;
91 }
92 if (ptrOut == XCF_PTR_EMPTY) {
93 return XCF_OK;
94 }
95 ptr = ptrOut;
96 if( tiles->params == &convertChannel ) {
97 /* A layer mask is a channel.
98 * Skip a name and a property list.
99 */
100 xcfString(ptr,&ptr);
101 PropType type;
102 int response;
103 while( (response = xcfNextprop(&ptr,&data, &type)) != XCF_ERROR && type != PROP_END ) {
104
105 }
106 if (response != XCF_OK) {
107 return XCF_ERROR;
108 }
109 uint32_t ptrout;
110 if(xcfOffset(ptr,4*4, &ptrout) != XCF_OK) return XCF_ERROR;
111 ptr = ptrout;
112 if (tileDirectoryOneLevel(dim,ptr, &ptrOut) != XCF_OK) {
113 return XCF_ERROR;
114 }
115 if (ptrOut == XCF_PTR_EMPTY) {
116 return XCF_OK;
117 }
118 ptr = ptrOut;
119 }
120 /* The XCF format has a dummy "hierarchy" level which was
121 * once meant to mean something, but never happened. It contains
122 * the bpp value and a list of "level" pointers; but only the
123 * first level actually contains data.
124 */
125 data = xcfL(ptr) ;
126 if( xcfL(ptr) != tiles->params->bpp ) {
127 FatalBadXCF("%" PRIuPTR " bytes per pixel for %s drawable",
128 xcfL(ptr),
129 type);
130 return XCF_ERROR;
131 }
132 uint32_t ptrout;
133 if(xcfOffset(ptr+4,3*4, &ptrout) != XCF_OK) return XCF_ERROR;
134 ptr = ptrout;
135 if (tileDirectoryOneLevel(dim,ptr, &ptrOut) != XCF_OK) {
136 return XCF_ERROR;
137 }
138 if (ptrOut == XCF_PTR_EMPTY) {
139 return XCF_OK;
140 }
141 ptr = ptrOut;
142
143 if (xcfCheckspace(ptr,dim->ntiles*4+4,"Tile directory at %" PRIX32,ptr) != XCF_OK) {
144 return XCF_ERROR;
145 }
146/* if( xcfL(ptr + dim->ntiles*4) != 0 )
147 FatalBadXCF("Wrong sized tile directory at %" PRIX32,ptr);*/
148
149#define REUSE_RAW_DATA tiles->tileptrs = (uint32_t*)(xcf_file + ptr)
150#if defined(WORDS_BIGENDIAN) && defined(CAN_DO_UNALIGNED_WORDS)
152#else
153# if defined(WORDS_BIGENDIAN)
154 if( (ptr&3) == 0 ) REUSE_RAW_DATA; else
155# endif
156 {
157 unsigned i ;
158 tiles->tileptrs = xcfmalloc(dim->ntiles * sizeof(uint32_t)) ;
159 for( i = 0 ; i < dim->ntiles ; i++ )
160 tiles->tileptrs[i] = xcfL(ptr+i*4);
161 }
162#endif
163 return XCF_OK;
164}
165
166int
167initLayer(struct xcfLayer *layer) {
168 if( layer->dim.ntiles == 0 ||
169 (layer->pixels.hierarchy == 0 && layer->mask.hierarchy == 0) )
170 return XCF_OK;
171 switch(layer->type) {
172#define DEF(X) case GIMP_##X##_IMAGE: layer->pixels.params = &convert##X; break
173 DEF(RGB);
174 DEF(RGBA);
175 DEF(GRAY);
176 DEF(GRAYA);
177 DEF(INDEXED);
178 DEF(INDEXEDA);
179 default:
180 {
181 FatalUnsupportedXCF(_("Layer type %s"),_(showGimpImageType(layer->type)));
182 return XCF_ERROR;
183 }
184
185 }
186 if (initTileDirectory(&layer->dim,&layer->pixels,
187 _(showGimpImageType(layer->type))) != XCF_OK) {
188 return XCF_ERROR;
189 }
190 layer->mask.params = &convertChannel ;
191 if (initTileDirectory(&layer->dim,&layer->mask,"layer mask") != XCF_OK) {
192 return XCF_ERROR;
193 }
194 return XCF_OK;
195}
196static int copyStraightPixels(rgba *dest,unsigned npixels,
197 uint32_t ptr,convertParams *params);
198int
200 uint32_t ncolors ;
201 if( XCF.colormapptr == 0 ) {
202 colormapLength = 0 ;
203 return XCF_OK;
204 }
205 ncolors = xcfL(XCF.colormapptr) ;
206 if( ncolors > 256 ) {
207 FatalUnsupportedXCF(_("Color map has more than 256 entries"));
208 return XCF_ERROR;
209 }
211 return XCF_ERROR;
212 }
213 colormapLength = ncolors ;
214#ifdef xDEBUG
215 {
216 unsigned j ;
217 fprintf(stderr,"Colormap decoding OK\n");
218 for( j = 0 ; j < ncolors ; j++ ) {
219 if( j % 8 == 0 ) fprintf(stderr,"\n");
220 fprintf(stderr," %08x",colormap[j]);
221 }
222 fprintf(stderr,"\n");
223 }
224#endif
225 return XCF_OK;
226}
227
228/* ****************************************************************** */
229
230struct Tile *
231newTile(struct rect r)
232{
233 unsigned npixels = (unsigned)(r.b-r.t) * (unsigned)(r.r-r.l) ;
234 struct Tile *data
235 = xcfmalloc(sizeof(struct Tile) -
236 sizeof(rgba)*(TILE_HEIGHT*TILE_WIDTH - npixels)) ;
237 data->count = npixels ;
238 data->refcount = 1 ;
239 data->summary = 0 ;
240 return data ;
241}
242
243struct Tile *
244forkTile(struct Tile* tile)
245{
246 if( ++tile->refcount <= 0 ) {
247 FatalUnsupportedXCF(_("Unbelievably many layers?\n"
248 "More likely to be a bug in %s"),progname);
249 return XCF_PTR_EMPTY;
250 }
251 return tile ;
252}
253
254void
255freeTile(struct Tile* tile)
256{
257 if( --tile->refcount == 0 )
258 xcffree(tile) ;
259}
260
262tileSummary(struct Tile *tile)
263{
264 unsigned i ;
266 if( (tile->summary & TILESUMMARY_UPTODATE) != 0 )
267 return tile->summary ;
269 for( i=0; summary && i<tile->count; i++ ) {
270 if( FULLALPHA(tile->pixels[i]) )
271 summary &= ~TILESUMMARY_ALLNULL ;
272 else if( NULLALPHA(tile->pixels[i]) )
273 summary &= ~TILESUMMARY_ALLFULL ;
274 else
275 summary = 0 ;
276 }
278 tile->summary = summary ;
279 return summary ;
280}
281
282void
283fillTile(struct Tile *tile,rgba data)
284{
285 unsigned i ;
286 for( i = 0 ; i < tile->count ; i++ )
287 tile->pixels[i] = data ;
288 if( FULLALPHA(data) )
290 else if (NULLALPHA(data) )
292 else
294}
295
296/* ****************************************************************** */
297
298static int
299copyStraightPixels(rgba *dest,unsigned npixels,
300 uint32_t ptr,convertParams *params)
301{
302 unsigned bpp = params->bpp;
303 const rgba *lookup = params->lookup;
304 rgba base_pixel = params->base_pixel ;
305 uint8_t *bp = xcf_file + ptr ;
306 int response;
307 if ((response = xcfCheckspace(ptr,bpp*npixels,
308 "pixel array (%u x %d bpp) at %"PRIX32,npixels,bpp,ptr)) != XCF_OK) {
309 return XCF_ERROR;
310 }
311 while( npixels-- ) {
312 rgba pixel = base_pixel ;
313 unsigned i ;
314 for( i = 0 ; i < bpp ; i++ ) {
315 if( params->shift[i] < 0 ) {
316 pixel += lookup[*bp++] ;
317 } else {
318 pixel += *bp++ << params->shift[i] ;
319 }
320 }
321 *dest++ = pixel ;
322 }
323 return XCF_OK;
324}
325
326static inline int
327copyRLEpixels(rgba *dest,unsigned npixels,uint32_t ptr,convertParams *params)
328{
329 unsigned i,j ;
330 rgba base_pixel = params->base_pixel ;
331
332#ifdef xDEBUG
333 fprintf(stderr,"RLE stream at %x, want %u x %u pixels, base %x\n",
334 ptr,params->bpp,npixels,base_pixel);
335#endif
336
337 /* This algorithm depends on the indexed byte always being the first one */
338 if( params->shift[0] < -1 )
339 base_pixel = 0 ;
340 for( j = npixels ; j-- ; )
341 dest[j] = base_pixel ;
342
343 for( i = 0 ; i < params->bpp ; i++ ) {
344 int shift = params->shift[i] ;
345 if( shift < 0 )
346 shift = 0 ;
347 for( j = 0 ; j < npixels ; ) {
348 int countspec ;
349 unsigned count ;
350 if (xcfCheckspace(ptr,2,"RLE data stream") != XCF_OK) {
351 return XCF_ERROR;
352 }
353 countspec = (int8_t) xcf_file[ptr++] ;
354 count = countspec >= 0 ? countspec+1 : -countspec ;
355 if( count == 128 ) {
356 if (xcfCheckspace(ptr,3,"RLE long count") != XCF_OK) {
357 return XCF_ERROR;
358 }
359 count = xcf_file[ptr++] << 8 ;
360 count += xcf_file[ptr++] ;
361 }
362 if( j + count > npixels ) {
363 FatalBadXCF("Overlong RLE run at %"PRIX32" (plane %u, %u left)",
364 ptr,i,npixels-j);
365 return XCF_ERROR;
366 }
367 if( countspec >= 0 ) {
368 rgba data = (uint32_t) xcf_file[ptr++] << shift ;
369 while( count-- )
370 dest[j++] += data ;
371 } else {
372 while( count-- )
373 dest[j++] += (uint32_t) xcf_file[ptr++] << shift ;
374 }
375 }
376 if( i == 0 && params->shift[0] < 0 ) {
377 const rgba *lookup = params->lookup ;
378 base_pixel = params->base_pixel ;
379 for( j = npixels ; j-- ; ) {
380 dest[j] = lookup[dest[j]-base_pixel] + base_pixel ;
381 }
382 }
383 }
384#ifdef xDEBUG
385 fprintf(stderr,"RLE decoding OK at %"PRIX32"\n",ptr);
386 /*
387 for( j = 0 ; j < npixels ; j++ ) {
388 if( j % 8 == 0 ) fprintf(stderr,"\n");
389 fprintf(stderr," %8x",dest[j]);
390 }
391 fprintf(stderr,"\n");
392 */
393#endif
394 return XCF_OK;
395}
396
397static inline int
398copyTilePixels(struct Tile *dest, uint32_t ptr,convertParams *params)
399{
400 if( FULLALPHA(params->base_pixel) )
402 else
403 dest->summary = 0 ;
404 switch( XCF.compression ) {
405 case COMPRESS_NONE:
406 if (copyStraightPixels(dest->pixels,dest->count,ptr,params) != XCF_OK) {
407 return XCF_ERROR;
408 }
409 break ;
410 case COMPRESS_RLE:
411 if (copyRLEpixels(dest->pixels,dest->count,ptr,params) != XCF_OK) {
412 return XCF_ERROR;
413 }
414 break ;
415 default:
416 {
417 FatalUnsupportedXCF(_("%s compression"),
419 return XCF_ERROR;
420 }
421 }
422 return XCF_OK;
423}
424
425
426struct Tile *
427getMaskOrLayerTile(struct tileDimensions *dim, struct xcfTiles *tiles,
428 struct rect want)
429{
430 struct Tile *tile = newTile(want);
431
432 if (want.l >= want.r || want.t >= want.b ) {
433 freeTile(tile);
434 return XCF_PTR_EMPTY;
435 }
436
437 if( tiles->tileptrs == 0 ) {
438 fillTile(tile,0);
439 return tile ;
440 }
441
442#ifdef xDEBUG
443 fprintf(stderr,"getMaskOrLayer: (%d-%d),(%d-%d)\n",left,right,top,bottom);
444#endif
445
446 if( isSubrect(want,dim->c) &&
447 (want.l - dim->c.l) % TILE_WIDTH == 0 &&
448 (want.t - dim->c.t) % TILE_HEIGHT == 0 ) {
449 int tx = TILE_NUM(want.l - dim->c.l);
450 int ty = TILE_NUM(want.t - dim->c.t);
451 if( want.r == TILEXn(*dim,tx+1) && want.b == TILEYn(*dim,ty+1) ) {
452 /* The common case? An entire single tile from the layer */
453 if (copyTilePixels(tile,tiles->tileptrs[tx + ty*dim->tilesx],tiles->params) != XCF_OK) {
454 freeTile(tile);
455 return XCF_PTR_EMPTY;
456 }
457 return tile ;
458 }
459 }
460
461 /* OK, we must construct the wanted tile as a jigsaw */
462 {
463 unsigned width = want.r-want.l ;
464 rgba *pixvert = tile->pixels ;
465 rgba *pixhoriz ;
466 int y, ty, l0, l1 ;
467 int x, tx, c0, c1 ;
468 unsigned lstart, lnum ;
469 unsigned cstart, cnum ;
470
471 if( !isSubrect(want,dim->c) ) {
472 if( want.l < dim->c.l ) pixvert += (dim->c.l - want.l),
473 want.l = dim->c.l ;
474 if( want.r > dim->c.r ) want.r = dim->c.r ;
475 if( want.t < dim->c.t ) pixvert += (dim->c.t - want.t) * width,
476 want.t = dim->c.t ;
477 if( want.b > dim->c.b ) want.b = dim->c.b ;
478 fillTile(tile,0);
479 } else {
480 tile->summary = -1 ; /* I.e. whatever the jigsaw pieces say */
481 }
482
483#ifdef xDEBUG
484 fprintf(stderr,"jig0 (%d-%d),(%d-%d)\n",left,right,top,bottom);
485#endif
486
487 for( y=want.t, ty=TILE_NUM(want.t-dim->c.t), l0=TILEYn(*dim,ty);
488 y<want.b;
489 pixvert += lnum*width, ty++, y=l0=l1 ) {
490 l1 = TILEYn(*dim,ty+1) ;
491 lstart = y - l0 ;
492 lnum = (l1 > want.b ? want.b : l1) - y ;
493
494 pixhoriz = pixvert ;
495 for( x=want.l, tx=TILE_NUM(want.l-dim->c.l), c0=TILEXn(*dim,tx);
496 x<want.r;
497 pixhoriz += cnum, tx++, x=c0=c1 ) {
498 c1 = TILEXn(*dim,tx+1);
499 cstart = x - c0 ;
500 cnum = (c1 > want.r ? want.r : c1) - x ;
501
502 {
503 static struct Tile tmptile ;
504 unsigned dwidth = c1-c0 ;
505 unsigned i, j ;
506 tmptile.count = (c1-c0)*(l1-l0) ;
507#ifdef xDEBUG
508 fprintf(stderr,"jig ty=%u(%u-%u-%u)(%u+%u) tx=%u(%u-%u-%u)(%u+%u)\n",
509 ty,l0,y,l1,lstart,lnum,
510 tx,c0,x,c1,cstart,cnum);
511#endif
512 if (copyTilePixels(&tmptile,
513 tiles->tileptrs[tx+ty*dim->tilesx],tiles->params) != XCF_OK) {
514 freeTile(tile);
515 return XCF_PTR_EMPTY;
516 }
517
518 for(i=0; i<lnum; i++)
519 for(j=0; j<cnum; j++)
520 pixhoriz[i*width+j]
521 = tmptile.pixels[(i+lstart)*dwidth+(j+cstart)];
522 tile->summary &= tmptile.summary ;
523 }
524 }
525 }
526 }
527 return tile ;
528}
529
530void
531applyMask(struct Tile *tile, struct Tile *mask)
532{
533 unsigned i ;
534 assertTileCompatibility(tile,mask);
535 assert( tile->count == mask->count );
537 invalidateSummary(tile,0);
538 for( i=0; i < tile->count ;i++ )
539 tile->pixels[i] = NEWALPHA(tile->pixels[i],
540 scaletable[mask->pixels[i]>>ALPHA_SHIFT]
541 [ALPHA(tile->pixels[i])]);
542 freeTile(mask);
543}
544
545struct Tile *
546getLayerTile(struct xcfLayer *layer,const struct rect *where)
547{
548 struct Tile *data ;
549
550#ifdef xDEBUG
551 fprintf(stderr,"getLayerTile(%s): (%d-%d),(%d-%d)\n",
552 layer->name,where->l,where->r,where->t,where->b);
553#endif
554
555 if( disjointRects(*where,layer->dim.c) ||
556 layer->opacity == 0 ) {
557 data = newTile(*where);
558 fillTile(data,0);
559 return data ;
560 }
561
562 data = getMaskOrLayerTile(&layer->dim,&layer->pixels,*where);
563 if (data == XCF_PTR_EMPTY) {
564 return XCF_PTR_EMPTY;
565 }
566 if( (data->summary & TILESUMMARY_ALLNULL) != 0 )
567 return data ;
568 if( layer->hasMask ) {
569 struct Tile *mask = getMaskOrLayerTile(&layer->dim,&layer->mask,*where);
570 if (mask == XCF_PTR_EMPTY) { /* error */
571 freeTile(data);
572 return XCF_PTR_EMPTY;
573 }
574 applyMask(data,mask);
575 }
576 if( layer->opacity < 255 ) {
577 const uint8_t *ourtable ;
578 int i ;
581 ourtable = scaletable[layer->opacity] ;
582 for( i=0; i < data->count; i++ )
583 data->pixels[i]
584 = NEWALPHA(data->pixels[i],ourtable[ALPHA(data->pixels[i])]) ;
585 }
586 return data ;
587}
const char * showXcfCompressionType(XcfCompressionType x)
Definition enums.c:110
const char * showGimpImageType(GimpImageType x)
Definition enums.c:54
@ COMPRESS_RLE
Definition enums.h:98
@ COMPRESS_NONE
Definition enums.h:97
PropType
Definition enums.h:59
@ PROP_END
Definition enums.h:60
static int initTileDirectory(struct tileDimensions *dim, struct xcfTiles *tiles, const char *type)
Definition pixels.c:80
static int copyRLEpixels(rgba *dest, unsigned npixels, uint32_t ptr, convertParams *params)
Definition pixels.c:327
summary_t tileSummary(struct Tile *tile)
Definition pixels.c:262
#define REUSE_RAW_DATA
struct Tile * getLayerTile(struct xcfLayer *layer, const struct rect *where)
Definition pixels.c:546
#define RGB_SHIFT
Definition pixels.c:45
int initColormap(void)
Definition pixels.c:199
static convertParams convertINDEXED
Definition pixels.c:54
unsigned colormapLength
Definition pixels.c:26
static convertParams convertRGB
Definition pixels.c:50
static int copyStraightPixels(rgba *dest, unsigned npixels, uint32_t ptr, convertParams *params)
Definition pixels.c:299
static convertParams convertColormap
Definition pixels.c:57
static convertParams convertChannel
Definition pixels.c:58
int degrayPixel(rgba pixel)
Definition pixels.c:29
static convertParams convertRGBA
Definition pixels.c:51
static convertParams convertGRAYA
Definition pixels.c:53
int initLayer(struct xcfLayer *layer)
Definition pixels.c:167
#define OPAQUE
Definition pixels.c:49
static convertParams convertGRAY
Definition pixels.c:52
void freeTile(struct Tile *tile)
Definition pixels.c:255
struct Tile * getMaskOrLayerTile(struct tileDimensions *dim, struct xcfTiles *tiles, struct rect want)
Definition pixels.c:427
static convertParams convertINDEXEDA
Definition pixels.c:55
rgba colormap[256]
Definition pixels.c:25
static int copyTilePixels(struct Tile *dest, uint32_t ptr, convertParams *params)
Definition pixels.c:398
static int tileDirectoryOneLevel(struct tileDimensions *dim, uint32_t ptr, int *ptrOut)
Definition pixels.c:63
void applyMask(struct Tile *tile, struct Tile *mask)
Definition pixels.c:531
#define DEF(X)
void fillTile(struct Tile *tile, rgba data)
Definition pixels.c:283
struct Tile * newTile(struct rect r)
Definition pixels.c:231
const struct _convertParams convertParams
struct Tile * forkTile(struct Tile *tile)
Definition pixels.c:244
#define TILESUMMARY_UPTODATE
Definition pixels.h:93
uint32_t rgba
Definition pixels.h:44
#define RED_SHIFT
Definition pixels.h:47
#define ALPHA_SHIFT
Definition pixels.h:46
#define TILESUMMARY_ALLNULL
Definition pixels.h:94
#define FULLALPHA(rgba)
Definition pixels.h:52
#define TILEYn(dim, ty)
Definition pixels.h:79
#define BLUE_SHIFT
Definition pixels.h:49
int summary_t
Definition pixels.h:89
#define TILESUMMARY_CRISP
Definition pixels.h:96
#define TILESUMMARY_ALLFULL
Definition pixels.h:95
#define GREEN_SHIFT
Definition pixels.h:48
#define ALPHA(rgba)
Definition pixels.h:51
const rgba graytable[256]
Definition table.c:6
#define NULLALPHA(rgba)
Definition pixels.h:53
#define NEWALPHA(rgb, a)
Definition pixels.h:54
#define assertTileCompatibility(t1, t2)
Definition pixels.h:110
uint8_t scaletable[256][256]
Definition scaletab.c:22
#define invalidateSummary(tile, mask)
Definition pixels.h:115
#define TILEXn(dim, tx)
Definition pixels.h:77
#define INIT_SCALETABLE_IF(foo)
Definition pixels.h:63
@ RGB
Definition psd.h:54
Definition pixels.h:97
rgba pixels[TILE_WIDTH *TILE_HEIGHT]
Definition pixels.h:101
summary_t summary
Definition pixels.h:99
unsigned count
Definition pixels.h:100
refcount_t refcount
Definition pixels.h:98
uint32_t base_pixel
Definition pixels.c:42
const rgba * lookup
Definition pixels.c:43
int shift[4]
Definition pixels.c:41
int l
Definition xcftools.h:130
int r
Definition xcftools.h:130
int t
Definition xcftools.h:130
int b
Definition xcftools.h:130
struct rect c
Definition xcftools.h:166
unsigned tilesx
Definition xcftools.h:168
unsigned ntiles
Definition xcftools.h:169
XcfCompressionType compression
Definition xcftools.h:199
uint32_t colormapptr
Definition xcftools.h:202
unsigned int opacity
Definition xcftools.h:185
struct xcfTiles pixels
Definition xcftools.h:188
int hasMask
Definition xcftools.h:186
struct tileDimensions dim
Definition xcftools.h:181
const char * name
Definition xcftools.h:182
GimpImageType type
Definition xcftools.h:184
struct xcfTiles mask
Definition xcftools.h:189
const struct _convertParams * params
Definition xcftools.h:175
uint32_t hierarchy
Definition xcftools.h:177
uint32_t * tileptrs
Definition xcftools.h:176
void FatalUnsupportedXCF(const char *format,...)
Definition utils.c:91
void * xcfmalloc(size_t size)
Definition utils.c:114
void xcffree(void *block)
Definition utils.c:125
void FatalBadXCF(const char *format,...)
Definition utils.c:66
int xcfCheckspace(uint32_t addr, int spaceafter, const char *format,...)
Definition utils.c:75
const char * progname
Definition utils.c:25
int xcfOffset(uint32_t addr, int spaceafter, uint32_t *apparent)
Definition xcf-general.c:34
int xcfNextprop(uint32_t *master, uint32_t *body, PropType *typeOut)
Definition xcf-general.c:52
struct xcfImage XCF
const char * xcfString(uint32_t ptr, uint32_t *after)
uint8_t * xcf_file
Definition xcf-general.c:29
#define isSubrect(A, B)
Definition xcftools.h:133
#define TILE_HEIGHT
Definition xcftools.h:155
#define TILE_WIDTH
Definition xcftools.h:154
#define xcfL(a)
Definition xcftools.h:91
#define TILE_NUM(x)
Definition xcftools.h:163
#define XCF_OK
Definition xcftools.h:106
#define XCF_ERROR
Definition xcftools.h:105
#define XCF_PTR_EMPTY
Definition xcftools.h:107
#define disjointRects(A, B)
Definition xcftools.h:135
#define _(s)
Definition xcftools.h:32