diff options
author | Kristian Høgsberg <krh@redhat.com> | 2005-03-11 16:42:20 +0000 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2005-03-11 16:42:20 +0000 |
commit | e2af71338fd89760c4ac76999985efc5eb92817f (patch) | |
tree | f9240c795970de3e8a0e4b36da6acf82ce95c50f /poppler/CairoOutputDev.cc | |
parent | 3dc52373346e448077d2539163e873eef6406ed7 (diff) |
2005-03-10 Kristian Høgsberg <krh@redhat.com>
From Jeff Muizelaar <jrmuizel@nit.ca>:
* poppler/CairoFontEngine.cc (CairoFontEngine::getFont):
Don't print "Type 3 font!" message.
* poppler/CairoOutputDev.cc (CairoOutputDev::drawImageMask):
Enable image mask drawing and do it properly, albeit slowly.
* poppler/CairoOutputDev.h
(CairoOutputDev::interpretType3Chars): Return true so that
Gfx.cc turns type3 characters into calls to drawImageMask
Diffstat (limited to 'poppler/CairoOutputDev.cc')
-rw-r--r-- | poppler/CairoOutputDev.cc | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index a830a083..19b0e81f 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -467,12 +467,7 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, double *ctm; cairo_matrix_t *mat; - /* TODO: I'm not sure how to implement this, and its currently crashing. - Disabling for now */ - - return; - - buffer = (char *)malloc (width * height); + buffer = (char *)malloc (width * height * 4); if (buffer == NULL) { error(-1, "Unable to allocate memory for image."); @@ -485,16 +480,21 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, imgStr->reset(); for (y = 0; y < height; y++) { - dest = buffer + y * width; + dest = buffer + y * width * 4; for (x = 0; x < width; x++) { imgStr->getPixel(&pix); + + *dest++ = soutRound(255 * fill_color.b); + *dest++ = soutRound(255 * fill_color.g); + *dest++ = soutRound(255 * fill_color.r); + if (invert) pix ^= 1; if (pix) - *dest++ = 255; - else *dest++ = 0; + else + *dest++ = 255; } } @@ -514,14 +514,9 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, cairo_concat_matrix (cairo, mat); cairo_matrix_destroy (mat); - /* TODO: Should we use A1 here? I assume that is bit-packed */ image = cairo_surface_create_for_image ( - buffer, CAIRO_FORMAT_A8, width, height, width); + buffer, CAIRO_FORMAT_ARGB32, width, height, width * 4); cairo_surface_set_filter (image, CAIRO_FILTER_BEST); - - /* TODO: Is this the right way to do image masks? */ - cairo_set_rgb_color (cairo, - fill_color.r, fill_color.g, fill_color.b); cairo_show_surface (cairo, image, width, height); cairo_restore (cairo); |