summaryrefslogtreecommitdiff
path: root/source/fitz/colorspace.c
AgeCommit message (Collapse)Author
2018-11-07Fix 700140: Ask LCMS transform to copy alpha channels.Tor Andersson
2018-10-25Handle premultiplied alpha in generic pixmap color conversion.Tor Andersson
2018-10-25Handle premultiplied alpha in pixmap color conversions (CMYK only).Tor Andersson
2018-10-25Fix asserts and checks in fast_xxx_to_yyy functions.Tor Andersson
fast_rgb_to_cmyk had || instead of && so always triggered incorrectly. Only throw, no need to both assert and throw.
2018-10-25Drop SLOWCMYK path.Tor Andersson
If you want accurate CMYK, don't build with FZ_ENABLE_ICC=0.
2018-10-25Make alpha channel unmultiply and premultiply utility functions public.Tor Andersson
2018-10-25Rename NO_ICC to FZ_ENABLE_ICC=0|1 to match other config.h options.Tor Andersson
2018-10-23Drop hash table upon exception.Sebastian Rasmussen
2018-10-23Remove extra blank lines.Tor Andersson
2018-10-23Dynamically allocate colorspace name, to allow arbitrary lengths.Sebastian Rasmussen
2018-10-12Revert to no CMM if the new CMM engine fails midway.Sebastian Rasmussen
The exception is still thrown, however. This just ensures that CMM is not left in an unknown state.
2018-10-12Keep cmm instance around until all colorspaces have been dropped.Sebastian Rasmussen
By setting ctx->cmm_instance == NULL we actively made sure that fz_cmm_fin_profile() would never call ->fin_profile() to actually clean up the ICC profiles. This could be triggered by doing mutool draw -N even without a file name, triggering a memory leak.
2018-10-12Rethrow exception when unable to create new ICC colorspace.Sebastian Rasmussen
2018-09-12Set the profile BGR flag for non-default ICC colorspaces too.Sebastian Rasmussen
2018-09-06Fix typo in size field of ICC profile colorspace.Sebastian Rasmussen
2018-09-05Take colorspace name from ICC profile.Sebastian Rasmussen
2018-09-05Use colorspace type enum instead of magic profile names.Tor Andersson
2018-08-28Bug 699675: Handle lack of default colorspaces when rendering type 3 font glyph.Sebastian Rasmussen
Previously this would result in trying to dereference a NULL pointer. Thanks to oss-fuzz for reporting.
2018-07-05Pass matrices by value: device and document interface.Tor Andersson
2018-07-05Pass rect and matrix by value in geometry functions.Tor Andersson
Several things irk me about passing values as const pointers: * They can be NULL, which is not a valid value. * They require explicit temporary variables for storage. * They don't compose easily in a legible manner, requiring weird pointer passing semantics where the variable being assigned is hidden as an argument in the innermost function call. * We can't change the value through the pointer, requiring yet more local variables to hold copies of the input value. In the device interface where we pass a matrix to a function, we often find ourselves making a local copy of the matrix so we can concatenate other transforms to it. This copying is a lot of unnecessary busywork that I hope to eventually avoid by laying the groundwork with this commit. This is a rather large API change, so I apologize for the inconvenience, but I hope the end result and gain in legibility will be worth the pain.
2018-06-22Don't pollute namespace with our 'restrict' macro. Use FZ_RESTRICT instead.Tor Andersson
2018-05-16Purge unused functions.Tor Andersson
2018-04-25Check in generated ICC profiles.Tor Andersson
2018-04-19Support CalRGB (and CalGray) as destination color spacesMichael Vrhel
I did not foresee the case where a transparency groups color space could be a Cal color space. I had always thought of them as only be source color spaces not destination color spaces. This commit makes sure that we have the equivalent ICC profile when the destination is a Cal space.
2018-01-24Bug 698904: Upon error both free color converter and clear its pointer.Sebastian Rasmussen
Without this change future calls to fz_fin_cached_color_converter() will try to dereference the already freed pointer.
2018-01-10Add colorspace type enum and use it instead of hardcoded checks on N.Tor Andersson
2017-12-06Ensure that our ICC base spaces have colorant names.Robin Watts
2017-11-15Bug 698745: Avoid broken colorspaces in NO_ICC builds.Robin Watts
If we attempt to make an icc colorspace in a NO_ICC build, throw an exception. This stops us ending up with 'UNKNOWN' colorspaces in the system.
2017-10-25Fix pgm corruption with spots files.Robin Watts
When converting from a source space to a destination space with spots for our "overprint" group push, we were hitting problems in our use of the pixmap converters. Pixmap converters with copy_spots set can assume that the source and destination spots are the same - when copy spots is NOT set, we cannot assume this. This was leading us to have uninitialised group backgrounds. I believe we were only seeing this with pgm because of the device k to cmyk as K only special case. Also fix an error in the fast_gray_to_cmyk routine that failed to account for the change from subtractive to additive.
2017-10-25Add fz_new_icc_colorspace_from_stream.Robin Watts
2017-10-24Add proper handling of bgr<->rgb for pixmap conversionsMichael Vrhel
2017-10-24Add interface for setting icc space to bgr formatMichael Vrhel
This is needed so that we can have bgr formatting with something other than the default sRGB
2017-10-24Handle DeviceBGR <-> DeviceRGB properlyMichael Vrhel
2017-10-24Don't override non-default Device{Gray,RGB,CMYK} by OI.Robin Watts
If the OutputIntent is set, we used to set Device{Gray,RGB,CMYK} (as appopriate) to match it. Don't do this if it's already been set to something other than our defaults.
2017-10-24mudraw: Add ability to specify icc profile for target colorspace.Michael Vrhel
2017-10-24Make a public fz_new_icc_colorspace_from_file function.Tor Andersson
2017-10-24Look for changes to Default colorspaces in XObjects.Robin Watts
2017-10-24Don't apply default decode array to ICC Lab image data.Robin Watts
Adjust the decode array to allow for the fact that the default decode is done by the ICC code.
2017-10-24Implement DeviceGray to KMichael Vrhel
When source color is DeviceGray, and the destination color CMYK we should map the gray values to K. See note in Section 6.3 of PDF spec.
2017-10-24Change colorspace 'device_n' field to be a flags word.Robin Watts
2017-10-24Logic for Sep and DeviceN colorspaces with C,M,Y, or K.Michael Vrhel
Special care is required when the DeviceN color space has cyan, magenta, yellow or black. For example, even if we support separations in the destination, if the color space has CMY or K as one of its colorants and we are drawing to an RGB or Gray pixmap we will want to do the tint transform. Also if the pixmap has no seps memember present, we support the separations if the destination is CMYK and the DeviceN colorspace has no "Spot" (non-CMYK) colorants.
2017-10-13Fix further problem seen in PDF_2.0_FTS/fts_23_2311.pdfRobin Watts
This file has a type 3 font in it. It first uses a 'd1' glyph, that uses a pattern. Accordingly, we we render that pattern to a mask tile and store that tile. Then it uses a 'd0' glyph, which uses the same pattern. The cache is checked, and we erroneously pick up the cached tile to reuse it - but this is not a colored rendering, so we assert on plotting. The fix is to ensure that the required colorspaces match. This requires us to add the colorspace to the tile key. Unfortunately, this means that colorspaces have to become key_storable, so the patch is slightly larger than would otherwise be the case.
2017-10-13Fix assert in fts_23_2311.pdfRobin Watts
Ensure that if we ask for a color converter for a NULL colorspace, that we treat it as devicegray. This copes with the mask cases.
2017-10-05Avoid double literals and double math functions.Sebastian Rasmussen
2017-09-08Ensure colorspace colorants are named for ICC spaces too.Robin Watts
2017-09-08Update draw device to cope with spots.Robin Watts
If draw device is passed a pixmap with disabled separations, it may have to push an extra group at the top to allow for the actual rendering to properly happen in cmyk+spots, and then get folded down at the end. This pushing cannot happen at create time, due to it being dependent on the defualt_cs settings. Accordingly, we push it (just once) on the first drawing operation. This means we need to be able to convert from "colorspace + set of spots" to "different colorspace + different set of spots". This in turn means we need to be able to drive lcms slightly differently (to tell it whether to copy the spots unchanged or not), so we have to amend the CMS interface code a bit for that. Currently we lack plotters to properly cope with plotting images and shades with spots, so this will give a warning and do nothing. To be filled in in future commits. Ensure fz_get_icc_link accepts NULL to mean default color params. Incorporates fixes from Michel Vrhel: With transparency groups we can have RGB + spot pixmaps. When drawing into those we need a mixture of colorant polarity. Ensure that fz_convert_separation_colors takes account of this. Fix C1 of Altona_Technical_1v1_x3.pdf (allow for output intent in fz_clone_pixmap_area_with_different_seps).
2017-09-07Initialize variables to appease clang scan-build.Sebastian Rasmussen
2017-08-17Remove redundant NULL check.Tor Andersson
fz_colorspace.name is an array, not a pointer, so will never be NULL.
2017-08-16Allow access to an indexed colorspace's color entries.Sebastian Rasmussen
2017-07-19Add some consts to color conversions.Robin Watts