X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=images%2Fimages.h;h=5449519c172b5abc4dd9816a5c55c7f708ca1ec4;hb=c6b2cc1263543e7b84a247c965d21f87c3b8feaf;hp=f35caf59156623e9729952575c445c64264265de;hpb=f784f9b6365d92dac7b10ab2e589d02c7445e987;p=libucw.git diff --git a/images/images.h b/images/images.h index f35caf59..5449519c 100644 --- a/images/images.h +++ b/images/images.h @@ -68,12 +68,22 @@ enum image_flag { IMAGE_INTERNAL_FLAGS = IMAGE_NEED_DESTROY | IMAGE_GAPS_PROTECTED, }; +#define IMAGE_MAX_CHANNELS 4 +#define IMAGE_CHANNELS_FORMAT_MAX_SIZE 128 +byte *image_channels_format_to_name(uns format, byte *buf); +uns image_name_to_channels_format(byte *name); + +struct color { + byte c[IMAGE_MAX_CHANNELS]; + byte color_space; +}; + struct image { byte *pixels; /* aligned top left pixel, there are at least sizeof(uns) unused bytes after the buffer (possible optimizations) */ uns cols; /* number of columns */ uns rows; /* number of rows */ - uns channels; /* number of color channels */ + uns channels; /* number of color channels including the alpha channel */ uns pixel_size; /* size of pixel in bytes (1, 2, 3 or 4) */ uns row_size; /* scanline size in bytes */ uns row_pixels_size; /* scanline size in bytes excluding rows gaps */ @@ -93,25 +103,11 @@ image_dimensions_valid(uns cols, uns rows) { return cols && rows && cols <= image_max_dim && rows <= image_max_dim; } - -#define IMAGE_CHANNELS_FORMAT_MAX_SIZE 128 -byte *image_channels_format_to_name(uns format, byte *buf); -uns image_name_to_channels_format(byte *name); - -struct color { - byte c[3]; - byte color_space; -} PACKED; - /* scale.c */ int image_scale(struct image_context *ctx, struct image *dest, struct image *src); void image_dimensions_fit_to_box(uns *cols, uns *rows, uns max_cols, uns max_rows, uns upsample); -/* alpha.c */ - -int image_apply_background(struct image_context *ctx, struct image *dest, struct image *src, struct color *background); - /* image-io.c */ enum image_format {