summaryrefslogtreecommitdiff
path: root/fitz/fitz-internal.h
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-04-05 15:49:10 +0100
committerRobin Watts <robin.watts@artifex.com>2013-04-11 19:00:39 +0100
commit53b5ede268394d651df1f12da490884bf870006a (patch)
tree72145964ff775415674c73b1e05ea18669238278 /fitz/fitz-internal.h
parent05f9887c211fff4195b5959bc71d2ef4b773fdc2 (diff)
downloadmupdf-53b5ede268394d651df1f12da490884bf870006a.tar.xz
Move pdf_image to fz_image.
In order to be able to output images (either in the pdfwrite device or in the html conversion), we need to be able to get to the original compressed data stream (or else we're going to end up recompressing images). To do that, we need to expose all of the contents of pdf_image into fz_image, so it makes sense to just amalgamate the two. This has knock on effects for the creation of indexed colorspaces, requiring some of that logic to be moved. Also, we need to make xps use the same structures; this means pushing PNG and TIFF support into the decoding code. Also we need to be able to load just the headers from PNG/TIFF/JPEGs as xps doesn't include dimension/resolution information. Also, separate out all the fz_image stuff into fitz/res_image.c rather than having it in res_pixmap.
Diffstat (limited to 'fitz/fitz-internal.h')
-rw-r--r--fitz/fitz-internal.h47
1 files changed, 40 insertions, 7 deletions
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index d427fa7b..17a7cb8e 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -608,6 +608,16 @@ struct fz_buffer_s
fz_buffer *fz_new_buffer(fz_context *ctx, int capacity);
/*
+ fz_new_buffer: Create a new buffer.
+
+ capacity: Initial capacity.
+
+ Returns pointer to new buffer. Throws exception on allocation
+ failure.
+*/
+fz_buffer *fz_new_buffer_from_data(fz_context *ctx, unsigned char *data, int size);
+
+/*
fz_resize_buffer: Ensure that a buffer has a given capacity,
truncating data if required.
@@ -814,8 +824,6 @@ fz_stream *fz_open_jbig2d(fz_stream *chain, fz_buffer *global);
* Resources and other graphics related objects.
*/
-enum { FZ_MAX_COLORS = 32 };
-
int fz_lookup_blendmode(char *name);
char *fz_blendmode_name(int blendmode);
@@ -913,7 +921,9 @@ enum
FZ_IMAGE_RAW = 5,
FZ_IMAGE_RLD = 6,
FZ_IMAGE_FLATE = 7,
- FZ_IMAGE_LZW = 8
+ FZ_IMAGE_LZW = 8,
+ FZ_IMAGE_PNG = 9,
+ FZ_IMAGE_TIFF = 10
};
struct fz_compression_params_s
@@ -963,19 +973,40 @@ struct fz_compressed_buffer_s
void fz_free_compressed_buffer(fz_context *ctx, fz_compressed_buffer *buf);
+fz_image *fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace, int xres, int yres, int interpolate, int imagemask, float *decode, int *colorkey, fz_compressed_buffer *buffer, fz_image *mask);
+fz_image *fz_new_image_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, fz_image *mask);
+fz_image *fz_new_image_from_buffer(fz_context *ctx, unsigned char *buf, int len);
+fz_pixmap *fz_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h);
+void fz_free_image(fz_context *ctx, fz_storable *image);
+fz_pixmap *fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, int in_line, int indexed, int l2factor, int native_l2factor);
+fz_pixmap *fz_expand_indexed_pixmap(fz_context *ctx, fz_pixmap *src);
+
struct fz_image_s
{
fz_storable storable;
- int w, h, bpc;
+ int w, h, n, bpc;
fz_image *mask;
fz_colorspace *colorspace;
fz_pixmap *(*get_pixmap)(fz_context *, fz_image *, int w, int h);
+ fz_compressed_buffer *buffer;
+ int colorkey[FZ_MAX_COLORS * 2];
+ float decode[FZ_MAX_COLORS * 2];
+ int imagemask;
+ int interpolate;
+ int usecolorkey;
+ fz_pixmap *tile; /* Private to the implementation */
+ int xres; /* As given in the image, not necessarily as rendered */
+ int yres; /* As given in the image, not necessarily as rendered */
};
fz_pixmap *fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *cs, int indexed);
-fz_pixmap *fz_load_jpeg(fz_context *doc, unsigned char *data, int size);
-fz_pixmap *fz_load_png(fz_context *doc, unsigned char *data, int size);
-fz_pixmap *fz_load_tiff(fz_context *doc, unsigned char *data, int size);
+fz_pixmap *fz_load_jpeg(fz_context *ctx, unsigned char *data, int size);
+fz_pixmap *fz_load_png(fz_context *ctx, unsigned char *data, int size);
+fz_pixmap *fz_load_tiff(fz_context *ctx, unsigned char *data, int size);
+
+void fz_load_jpeg_info(fz_context *ctx, unsigned char *data, int size, int *w, int *h, int *xres, int *yres, fz_colorspace **cspace);
+void fz_load_png_info(fz_context *ctx, unsigned char *data, int size, int *w, int *h, int *xres, int *yres, fz_colorspace **cspace);
+void fz_load_tiff_info(fz_context *ctx, unsigned char *data, int size, int *w, int *h, int *xres, int *yres, fz_colorspace **cspace);
struct fz_halftone_s
{
@@ -1002,10 +1033,12 @@ struct fz_colorspace_s
};
fz_colorspace *fz_new_colorspace(fz_context *ctx, char *name, int n);
+fz_colorspace *fz_new_indexed_colorspace(fz_context *ctx, fz_colorspace *base, int high, unsigned char *lookup);
fz_colorspace *fz_keep_colorspace(fz_context *ctx, fz_colorspace *colorspace);
void fz_drop_colorspace(fz_context *ctx, fz_colorspace *colorspace);
void fz_free_colorspace_imp(fz_context *ctx, fz_storable *colorspace);
+
void fz_convert_color(fz_context *ctx, fz_colorspace *dsts, float *dstv, fz_colorspace *srcs, float *srcv);
typedef struct fz_color_converter_s fz_color_converter;