diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2015-12-30 13:49:53 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-01-05 14:47:37 +0100 |
commit | d521de5ffad2dcc6c151e25373dd8a26a84440eb (patch) | |
tree | 8867964f50123897b2d45d28b9c927b500cc1f04 | |
parent | 39b7ee963183e02ae44c4d55607d4fdb7759e585 (diff) | |
download | mupdf-d521de5ffad2dcc6c151e25373dd8a26a84440eb.tar.xz |
Add pixmap struct accessors.
-rw-r--r-- | include/mupdf/fitz/pixmap.h | 8 | ||||
-rw-r--r-- | source/fitz/bitmap.c | 21 | ||||
-rw-r--r-- | source/fitz/pixmap.c | 40 |
3 files changed, 48 insertions, 21 deletions
diff --git a/include/mupdf/fitz/pixmap.h b/include/mupdf/fitz/pixmap.h index 64f60e03..42a70c7b 100644 --- a/include/mupdf/fitz/pixmap.h +++ b/include/mupdf/fitz/pixmap.h @@ -30,6 +30,9 @@ int fz_pixmap_width(fz_context *ctx, fz_pixmap *pix); */ int fz_pixmap_height(fz_context *ctx, fz_pixmap *pix); +int fz_pixmap_x(fz_context *ctx, fz_pixmap *pix); +int fz_pixmap_y(fz_context *ctx, fz_pixmap *pix); + /* fz_new_pixmap: Create a new pixmap, with it's origin at (0,0) @@ -143,6 +146,11 @@ int fz_pixmap_components(fz_context *ctx, fz_pixmap *pix); */ unsigned char *fz_pixmap_samples(fz_context *ctx, fz_pixmap *pix); +/* + fz_pixmap_stride: Return the number of bytes in a row in the pixmap. +*/ +int fz_pixmap_stride(fz_context *ctx, fz_pixmap *pix); + void fz_pixmap_set_resolution(fz_pixmap *pix, int res); /* diff --git a/source/fitz/bitmap.c b/source/fitz/bitmap.c index 2e6cdfcc..b6eba35f 100644 --- a/source/fitz/bitmap.c +++ b/source/fitz/bitmap.c @@ -78,27 +78,6 @@ fz_save_bitmap_as_pbm(fz_context *ctx, fz_bitmap *bitmap, char *filename) fz_rethrow(ctx); } -fz_colorspace *fz_pixmap_colorspace(fz_context *ctx, fz_pixmap *pix) -{ - if (!pix) - return NULL; - return pix->colorspace; -} - -int fz_pixmap_components(fz_context *ctx, fz_pixmap *pix) -{ - if (!pix) - return 0; - return pix->n; -} - -unsigned char *fz_pixmap_samples(fz_context *ctx, fz_pixmap *pix) -{ - if (!pix) - return NULL; - return pix->samples; -} - void fz_bitmap_details(fz_bitmap *bit, int *w, int *h, int *n, int *stride) { if (!bit) diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c index 3096b6b3..faabea2c 100644 --- a/source/fitz/pixmap.c +++ b/source/fitz/pixmap.c @@ -121,6 +121,26 @@ fz_pixmap_bbox_no_ctx(fz_pixmap *pix, fz_irect *bbox) return bbox; } +fz_colorspace * +fz_pixmap_colorspace(fz_context *ctx, fz_pixmap *pix) +{ + if (!pix) + return NULL; + return pix->colorspace; +} + +int +fz_pixmap_x(fz_context *ctx, fz_pixmap *pix) +{ + return pix->x; +} + +int +fz_pixmap_y(fz_context *ctx, fz_pixmap *pix) +{ + return pix->y; +} + int fz_pixmap_width(fz_context *ctx, fz_pixmap *pix) { @@ -133,6 +153,26 @@ fz_pixmap_height(fz_context *ctx, fz_pixmap *pix) return pix->h; } +int +fz_pixmap_components(fz_context *ctx, fz_pixmap *pix) +{ + return pix->n; +} + +int +fz_pixmap_stride(fz_context *ctx, fz_pixmap *pix) +{ + return pix->w * pix->n; +} + +unsigned char * +fz_pixmap_samples(fz_context *ctx, fz_pixmap *pix) +{ + if (!pix) + return NULL; + return pix->samples; +} + void fz_clear_pixmap(fz_context *ctx, fz_pixmap *pix) { |