-
Notifications
You must be signed in to change notification settings - Fork 161
#7992 Isolate PDF SMask #2361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#7992 Isolate PDF SMask #2361
Changes from 15 commits
7771c4e
d6ed7b6
d667ff0
cf20a43
763abc3
2c549c1
c41585c
4357095
3d564a4
bce60ed
10fae40
10ea222
b6dbb58
8f9bcef
a8a938f
e165612
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -203,6 +203,30 @@ fz_rect *mupdf_fz_bound_page(fz_context *ctx, fz_page *page, fz_rect *r) { | |
| return r; | ||
| } | ||
|
|
||
|
|
||
| typedef struct | ||
| { | ||
| fz_device super; | ||
| fz_device* default_device; | ||
| } isolated_smask_device; | ||
|
|
||
| static void smask_fill_image(fz_context* ctx, fz_device* dev, fz_image* img, fz_matrix ctm, float alpha, fz_color_params color_params) | ||
| { | ||
| if (img->mask) { | ||
| isolated_smask_device* smask_dev = (isolated_smask_device*)dev; | ||
| float black[1] = { 0.f }; | ||
| fz_fill_image_mask(ctx, smask_dev->default_device, img->mask, ctm, fz_device_gray(ctx), black, alpha, color_params); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it correct that fz_device_gray doesn't need any cleanup?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like it. float cmyk[100][4] = { {1,0,0,0}, ...
float rgb[100][3];
fz_color_converter cc;
int i;
fz_find_color_converter(ctx,
&cc,
fz_device_cmyk(ctx),
fz_device_rgb(ctx),
NULL,
fz_default_color_params(ctx)
);
for (i = 0; i < 100; ++i)
cc.convert(ctx, &cc, cmyk[i], rgb[i]);
fz_drop_color_converter(ctx, &cc);
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /**
Retrieve global default colorspaces.
These return borrowed references that should not be dropped,
unless they are kept first.
*/
fz_colorspace *fz_device_gray(fz_context *ctx);
fz_colorspace *fz_device_rgb(fz_context *ctx);
fz_colorspace *fz_device_bgr(fz_context *ctx);
fz_colorspace *fz_device_cmyk(fz_context *ctx);
fz_colorspace *fz_device_lab(fz_context *ctx); |
||
| } | ||
| } | ||
|
|
||
| fz_device *fz_new_isolated_smask_device(fz_context* ctx, fz_device* dev) | ||
| { | ||
| isolated_smask_device* smask_dev = fz_new_derived_device(ctx, isolated_smask_device); | ||
| smask_dev->default_device = dev; | ||
| smask_dev->super.fill_image = smask_fill_image; | ||
| return (fz_device*)smask_dev; | ||
| } | ||
|
|
||
| /* wrappers for functions that throw exceptions mupdf-style (setjmp/longjmp) */ | ||
|
|
||
| #define MUPDF_DO_WRAP | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.