xcf.c File Reference

#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include "afterbase.h"
#include "asimage.h"
#include "xcf.h"

Go to the source code of this file.

Typedefs

typedef void(*) decode_xcf_tile_func (FILE *fp, XcfTile *tile, int bpp, ASScanline *buf, CARD8 *tile_buf, int offset_x, int offset_y, int width, int height)

Functions

static XcfPropertyread_xcf_props (FILE *fp)
static XcfListElemread_xcf_list_offsets (FILE *fp, size_t elem_size)
static void read_xcf_layers (XcfImage *xcf_im, FILE *fp, XcfLayer *head)
static void read_xcf_channels (XcfImage *xcf_im, FILE *fp, XcfChannel *head)
static XcfHierarchyread_xcf_hierarchy (XcfImage *xcf_im, FILE *fp, CARD8 opacity, ARGB32 colormask)
static void read_xcf_levels (XcfImage *xcf_im, FILE *fp, XcfLevel *head)
static void read_xcf_tiles (XcfImage *xcf_im, FILE *fp, XcfTile *head)
static void read_xcf_tiles_rle (XcfImage *xcf_im, FILE *fp, XcfTile *head)
static size_t xcf_read8 (FILE *fp, CARD8 *data, int count)
static size_t xcf_read32 (FILE *fp, CARD32 *data, int count)
static void xcf_skip_string (FILE *fp)
void print_xcf_layers (char *prompt, XcfLayer *head)
XcfImageread_xcf_image (FILE *fp)
void print_xcf_properties (char *prompt, XcfProperty *prop)
void print_xcf_hierarchy (char *prompt, XcfHierarchy *h)
void print_xcf_channels (char *prompt, XcfChannel *head, Bool mask)
void print_xcf_image (XcfImage *xcf_im)
void free_xcf_properties (XcfProperty *head)
void free_xcf_hierarchy (XcfHierarchy *hierarchy)
void free_xcf_channels (XcfChannel *head)
void free_xcf_layers (XcfLayer *head)
void free_xcf_image (XcfImage *xcf_im)
void decode_xcf_tile (FILE *fp, XcfTile *tile, int bpp, ASScanline *buf, CARD8 *tile_buf, int offset_x, int offset_y, int width, int height)
void decode_xcf_tile_rle (FILE *fp, XcfTile *tile, int bpp, ASScanline *buf, CARD8 *tile_buf, int offset_x, int offset_y, int width, int height)
Bool fix_xcf_image_line (ASScanline *buf, int bpp, unsigned int width, CARD8 *cmap, CARD8 opacity, ARGB32 color)
static void store_colors (CARD8 *data, ASScanline *curr_buf, int bpp, int comp, int offset_x, int width)


Typedef Documentation

typedef void(*) decode_xcf_tile_func(FILE *fp, XcfTile *tile, int bpp, ASScanline *buf, CARD8 *tile_buf, int offset_x, int offset_y, int width, int height)

Definition at line 569 of file xcf.c.


Function Documentation

void decode_xcf_tile ( FILE *  fp,
XcfTile tile,
int  bpp,
ASScanline buf,
CARD8 *  tile_buf,
int  offset_x,
int  offset_y,
int  width,
int  height 
)

Definition at line 745 of file xcf.c.

References buf, MIN, store_colors(), xcf_read8(), and y.

Referenced by read_xcf_hierarchy().

void decode_xcf_tile_rle ( FILE *  fp,
XcfTile tile,
int  bpp,
ASScanline buf,
CARD8 *  tile_buf,
int  offset_x,
int  offset_y,
int  width,
int  height 
)

Definition at line 769 of file xcf.c.

References buf, i, int, len, store_colors(), x, xcf_read8(), XCF_TILE_WIDTH, and y.

Referenced by read_xcf_hierarchy().

Bool fix_xcf_image_line ( ASScanline buf,
int  bpp,
unsigned int  width,
CARD8 *  cmap,
CARD8  opacity,
ARGB32  color 
)

Definition at line 845 of file xcf.c.

References buf, False, i, int, and True.

Referenced by read_xcf_hierarchy().

void free_xcf_channels ( XcfChannel head  ) 

Definition at line 353 of file xcf.c.

References free(), free_xcf_hierarchy(), free_xcf_properties(), XcfChannel::hierarchy, XcfChannel::next, and XcfChannel::properties.

Referenced by free_xcf_image(), and free_xcf_layers().

void free_xcf_hierarchy ( XcfHierarchy hierarchy  ) 

Definition at line 327 of file xcf.c.

References destroy_asimage(), free(), XcfHierarchy::image, level, and XcfHierarchy::levels.

Referenced by free_xcf_channels(), and free_xcf_layers().

void free_xcf_image ( XcfImage xcf_im  ) 

Definition at line 384 of file xcf.c.

References XcfImage::channels, XcfImage::colormap, free(), free_scanline(), free_xcf_channels(), free_xcf_layers(), free_xcf_properties(), i, XcfImage::layers, XcfImage::properties, XcfImage::scanline_buf, True, and XCF_TILE_HEIGHT.

Referenced by ASImage2xcf(), and xcf2ASImage().

void free_xcf_layers ( XcfLayer head  ) 

Definition at line 368 of file xcf.c.

References free(), free_xcf_channels(), free_xcf_hierarchy(), free_xcf_properties(), XcfLayer::hierarchy, XcfLayer::mask, XcfLayer::next, and XcfLayer::properties.

Referenced by free_xcf_image().

void free_xcf_properties ( XcfProperty head  ) 

Definition at line 314 of file xcf.c.

References XcfProperty::buffer, XcfProperty::data, free(), XcfProperty::len, and XcfProperty::next.

Referenced by free_xcf_channels(), free_xcf_image(), and free_xcf_layers().

void print_xcf_channels ( char *  prompt,
XcfChannel head,
Bool  mask 
)

Definition at line 236 of file xcf.c.

References XcfChannel::color, fprintf(), XcfChannel::height, XcfChannel::hierarchy, XcfChannel::hierarchy_offset, i, XcfChannel::next, XcfChannel::offset, XcfChannel::opacity, p, print_xcf_hierarchy(), print_xcf_properties(), XcfChannel::properties, sprintf(), XcfChannel::visible, and XcfChannel::width.

Referenced by print_xcf_image(), and print_xcf_layers().

void print_xcf_hierarchy ( char *  prompt,
XcfHierarchy h 
)

Definition at line 205 of file xcf.c.

References XcfTile::estimated_size, fprintf(), h, i, k, level, XcfTile::next, and XcfTile::offset.

Referenced by print_xcf_channels(), and print_xcf_layers().

void print_xcf_image ( XcfImage xcf_im  ) 

Definition at line 295 of file xcf.c.

References XcfImage::channels, XcfImage::compression, False, fprintf(), XcfImage::height, XcfImage::layers, XcfImage::num_cols, print_xcf_channels(), print_xcf_layers(), print_xcf_properties(), XcfImage::properties, XcfImage::type, XcfImage::version, and XcfImage::width.

Referenced by ASImage2xcf(), and xcf2ASImage().

void print_xcf_layers ( char *  prompt,
XcfLayer head 
)

Definition at line 264 of file xcf.c.

References fprintf(), XcfLayer::height, XcfLayer::hierarchy, XcfLayer::hierarchy_offset, i, XcfLayer::mask, XcfLayer::mask_offset, XcfLayer::mode, XcfLayer::next, XcfLayer::offset, XcfLayer::offset_x, XcfLayer::offset_y, XcfLayer::opacity, p, XcfLayer::preserve_transparency, print_xcf_channels(), print_xcf_hierarchy(), print_xcf_properties(), XcfLayer::properties, sprintf(), True, XcfLayer::type, XcfLayer::visible, and XcfLayer::width.

Referenced by print_xcf_image().

void print_xcf_properties ( char *  prompt,
XcfProperty prop 
)

Definition at line 183 of file xcf.c.

References XcfProperty::data, fprintf(), i, XcfProperty::id, k, XcfProperty::len, and XcfProperty::next.

Referenced by print_xcf_channels(), print_xcf_image(), and print_xcf_layers().

static void read_xcf_channels ( XcfImage xcf_im,
FILE *  fp,
XcfChannel head 
) [static]

Definition at line 525 of file xcf.c.

References as_ntohl, XcfChannel::color, XcfProperty::data, fseek, XcfChannel::height, XcfChannel::hierarchy, XcfChannel::hierarchy_offset, XcfProperty::id, MAKE_ARGB32, XcfChannel::next, XcfProperty::next, NULL, XcfChannel::offset, XcfChannel::opacity, pd, XcfChannel::properties, read_xcf_hierarchy(), read_xcf_props(), SEEK_SET, XcfChannel::visible, XcfChannel::width, XCF_PROP_COLOR, XCF_PROP_OPACITY, XCF_PROP_VISIBLE, xcf_read32(), and xcf_skip_string().

Referenced by read_xcf_image(), and read_xcf_layers().

static XcfHierarchy * read_xcf_hierarchy ( XcfImage xcf_im,
FILE *  fp,
CARD8  opacity,
ARGB32  colormask 
) [static]

Definition at line 582 of file xcf.c.

References asimage_add_line(), buf, XcfImage::colormap, XcfImage::compression, create_asimage(), decode_xcf_tile(), decode_xcf_tile_rle(), False, fix_xcf_image_line(), free(), free_scanline(), fseek, h, i, IC_ALPHA, IC_BLUE, IC_GREEN, IC_RED, MIN, XcfTile::next, NULL, XcfTile::offset, prepare_scanline(), read_xcf_levels(), read_xcf_list_offsets(), safecalloc, safemalloc, XcfImage::scanline_buf, SEEK_SET, show_error, XcfImage::tile_buf, True, XcfImage::width, width, XCF_COMPRESS_NONE, XCF_COMPRESS_RLE, xcf_read32(), XCF_TILE_HEIGHT, XCF_TILE_WIDTH, and y.

Referenced by read_xcf_channels(), and read_xcf_layers().

XcfImage* read_xcf_image ( FILE *  fp  ) 

Definition at line 113 of file xcf.c.

References as_ntohl, XcfImage::channels, XcfImage::colormap, XcfImage::compression, XcfProperty::data, False, free(), i, XcfProperty::id, int, XcfImage::layers, XcfProperty::len, MAX, MIN, mystrncasecmp, n, XcfProperty::next, NULL, XcfImage::num_cols, prepare_scanline(), XcfImage::properties, read_xcf_channels(), read_xcf_layers(), read_xcf_list_offsets(), read_xcf_props(), safecalloc, safemalloc, XcfImage::scanline_buf, show_error, XcfImage::version, XcfImage::width, XCF_COLORMAP_SIZE, XCF_PROP_COLORMAP, XCF_PROP_COMPRESSION, xcf_read32(), xcf_read8(), XCF_SIGNATURE, XCF_SIGNATURE_FULL_LEN, XCF_SIGNATURE_LEN, and XCF_TILE_HEIGHT.

Referenced by xcf2ASImage().

static void read_xcf_layers ( XcfImage xcf_im,
FILE *  fp,
XcfLayer head 
) [static]

Definition at line 460 of file xcf.c.

References as_ntohl, XcfProperty::data, XcfImage::floating_selection, fseek, XcfLayer::height, XcfLayer::hierarchy, XcfLayer::hierarchy_offset, XcfProperty::id, XcfLayer::mask, XcfLayer::mask_offset, XcfLayer::mode, XcfProperty::next, XcfLayer::next, NULL, XcfLayer::offset, XcfChannel::offset, XcfLayer::offset_x, XcfLayer::offset_y, XcfLayer::opacity, pd, XcfLayer::preserve_transparency, XcfLayer::properties, read_xcf_channels(), read_xcf_hierarchy(), read_xcf_props(), safecalloc, SEEK_SET, XcfLayer::type, XcfLayer::visible, XcfLayer::width, XCF_PROP_FLOATING_SELECTION, XCF_PROP_MODE, XCF_PROP_OFFSETS, XCF_PROP_OPACITY, XCF_PROP_PRESERVE_TRANSPARENCY, XCF_PROP_VISIBLE, xcf_read32(), and xcf_skip_string().

Referenced by read_xcf_image().

static void read_xcf_levels ( XcfImage xcf_im,
FILE *  fp,
XcfLevel head 
) [static]

Definition at line 673 of file xcf.c.

References XcfImage::compression, fseek, XcfLevel::height, XcfLevel::next, XcfLevel::offset, read_xcf_list_offsets(), read_xcf_tiles(), read_xcf_tiles_rle(), SEEK_SET, XcfLevel::tiles, XcfLevel::width, XCF_COMPRESS_NONE, XCF_COMPRESS_RLE, and xcf_read32().

Referenced by read_xcf_hierarchy().

static XcfListElem * read_xcf_list_offsets ( FILE *  fp,
size_t  elem_size 
) [static]

Definition at line 439 of file xcf.c.

References NULL, safecalloc, and xcf_read32().

Referenced by read_xcf_hierarchy(), read_xcf_image(), and read_xcf_levels().

static XcfProperty * read_xcf_props ( FILE *  fp  )  [static]

Definition at line 409 of file xcf.c.

References NULL, safecalloc, safemalloc, xcf_read32(), and xcf_read8().

Referenced by read_xcf_channels(), read_xcf_image(), and read_xcf_layers().

static void read_xcf_tiles ( XcfImage xcf_im,
FILE *  fp,
XcfTile head 
) [static]

Definition at line 698 of file xcf.c.

References XcfTile::estimated_size, XcfTile::next, XCF_TILE_HEIGHT, and XCF_TILE_WIDTH.

Referenced by read_xcf_levels().

static void read_xcf_tiles_rle ( XcfImage xcf_im,
FILE *  fp,
XcfTile head 
) [static]

Definition at line 709 of file xcf.c.

References XcfTile::estimated_size, XcfTile::next, XcfTile::offset, XCF_TILE_HEIGHT, and XCF_TILE_WIDTH.

Referenced by read_xcf_levels().

static void store_colors ( CARD8 *  data,
ASScanline curr_buf,
int  bpp,
int  comp,
int  offset_x,
int  width 
) [inline, static]

Definition at line 724 of file xcf.c.

References ASScanline::alpha, ASScanline::blue, ASScanline::green, i, NULL, out, and ASScanline::red.

Referenced by decode_xcf_tile(), and decode_xcf_tile_rle().

static size_t xcf_read32 ( FILE *  fp,
CARD32 *  data,
int  count 
) [static]

Definition at line 79 of file xcf.c.

References size_t, total, and xcf_read8().

Referenced by read_xcf_channels(), read_xcf_hierarchy(), read_xcf_image(), read_xcf_layers(), read_xcf_levels(), read_xcf_list_offsets(), read_xcf_props(), and xcf_skip_string().

static size_t xcf_read8 ( FILE *  fp,
CARD8 *  data,
int  count 
) [static]

Definition at line 63 of file xcf.c.

References fread, size_t, and total.

Referenced by decode_xcf_tile(), decode_xcf_tile_rle(), read_xcf_image(), read_xcf_props(), and xcf_read32().

static void xcf_skip_string ( FILE *  fp  )  [static]

Definition at line 100 of file xcf.c.

References fseek, SEEK_CUR, size, and xcf_read32().

Referenced by read_xcf_channels(), and read_xcf_layers().


Generated on Tue Jul 5 15:58:18 2011 for ROOT_528-00b_version by  doxygen 1.5.1