summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-10-24Fix some Ghent overprint test files.Robin Watts
Fix Ghent_V3.0/070_OutputIntent_ISOCoated-v1_x3.pdf. Partially Fix Ghent_V5.0/GWG190_DeviceN_Overprint_Black_X1a.pdf Cope with 'All' and 'None' colorants. Files with 'All' and 'None' colorants can still count as being "entirely CMYK" for the purposes of color conversion. There is a still an overprint problem with the 3rd swatch of Ghent_V5.0/GWG190_DeviceN_Overprint_Black_X1a.pdf.
2017-10-24Fix overprinting simulation in RGB output with no spots.Robin Watts
Running Ghent_V5.0/GWG010_CMYK_OP_x3.pdf to PNG produces 'X' marks, where Acrobat does not. This is expected if overprint similation is turned off, but not if it is enabled. The file does not define a colorspace for the initial page, uses no transparency, and has no spots defined. Accordingly, when we clone the page fz_separation object, we end up with no object at all. The draw device therefore doesn't even attempt to do overprint simulation. We fix this by ensuring that we always have a non-NULL separation object. Possibly we should make fz_page_separations return a non-NULL, but empty object? Even with this change, running to PNG still does not give the required rendering. This is because PNGs use RGB, rather than CMYK, and overprint is disabled for non-subtractive spaces. We therefore adjust the code in push_group_for_separations that decides whether it can avoid pushing an extra group. If the basic pixmap is RGB, then we never skip the extra group.
2017-10-24Fix "CompatibleOverprint" blend mode.Robin Watts
This is a wierd one. After much panicing about this, it seems that all that is required to get the correct result is to ensure that the groups used by MuPDF to wrap graphical objects displayed in non-Normal blend modes is a non-isolated (non-knockout) one. The PDF spec is written assuming that blending happens at object plotting time. MuPDF does not work in this way. We only support normal blend mode plotting. To achieve non-normal blend modes, we therefore wrap each object in a group. The object is plotted 'normally', and then the end of the group causes the blend to be applied as required. Our plotters *do* know about overprinting, hence only the required components are changed. By using a non-isolated group, the background is copied in, and overprint correctly chooses not to alter the appropriate components. This means that when blending back, the background components match the source components for overprinted components. Thus (to put it in terms used in the PDF spec) cb = cs for all overprinted components. Hence if we use B(cb,cs) = cs (i.e. normal blend mode), we get what is required by CompatibleOverprint mode. Thus plotting into our group 'Normally, with overprint', and then blending back with the specified blend mode, appears to give exactly what we need.
2017-10-24Fix knockout operation.Robin Watts
The "blend back" at the end of the inner knockout groups was attempting to reuse the existing blending code. This was going wrong for all sorts of reasons (not least the uncomposition phase) for knockout groups containing alpha, such as found on page 7 of Altona_Technical_v20_x4.pdf. Use a dedicated routine. This is much simpler as it doesn't have to cope with blend modes etc.
2017-10-24Add support for use of proofing profile.Robin Watts
This is a first cut to get us to demo-ability. There will likely be a few changes as we do a bit more testing with different scenarios with Gray, RGB, CMYK combos of destination, proof and output intent ICC profiles.
2017-10-24Add group_alpha plane to draw device and painters.Robin Watts
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-24Fix fz_paint_pixmap alpha blending.Robin Watts
We were failing to allow for the fact that the source pixmap is premultiplied, meaning we were squaring the alpha each time.
2017-10-24Move to be more like Ghostscript in the handling of shapes.Robin Watts
When pushing a transparency group, MuPDF used to always create a shape plane if there was one before. Ghostscript works differently, and only creates a shape plane if we are in a non-isolated group. This means that when blending an isolated group back to a non isolated group, GS uses the "source alpha" in place of the "shape alpha" to modify the non-isolated groups shape plane. We update MuPDF to do the same here - it requires some new (small) routines to do this new type of shape update, but means we carry smaller amounts of data around overall. Also, for what little remains of my sanities sake, this helps by making it easier to compare the debug output from the 2 different renderers.
2017-10-24Clear isolated flag within 'inner' knockout groups.Robin Watts
Knockout groups are only created temporarily, and this solves problems in Altona_Technical_v20_x4.pdf on page 7 on the 'B'. It seems reasonable that we shouldn't need to have isolated enabled here, because it's really required for blending the whole isolated group back. While we don't propagate "isolated" into "inner" knockout groups, we DO need to use the incoming isolated value to correctly establish the backdrop to use.
2017-10-24Update blend mode debug dumps to include group backdrops.Robin Watts
2017-10-24Make sure shades use proper "default" color space.Michael Vrhel
Fixes some issues in Altona test file.
2017-10-24Avoid using overprinting routines unnecessarily.Robin Watts
2017-10-24Only allow overprint when color spaces are subtractive.Michael Vrhel
Fixes on issue on page 14 of altona test.
2017-10-24Fix separation finding code.Robin Watts
2017-10-24Look for changes to Default colorspaces in XObjects.Robin Watts
2017-10-24Fix overprint color component detection.Robin Watts
If a colorant is not an explicit separation, then it will be mapped down to process colorants. These cannot be protected from overprint. Incorporates a fix for a problem with shades seen on page 8 of. Altona_Technical_v20_x4. This shows a problem where we were failing to correctly overprint a grey gradient with a spot color one. The overprint setup code was checking for 'Orange' being one of the process colours, and not finding it. Consequently it was deciding that Orange would have to be mapped to a process color, and so the process colors could not be protected from overprint. The code should have spotted that 'Orange' was one of the spot colors. With this added, it works correctly.
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-24Only do proof conversion in final pop.Michael Vrhel
The proof conversion should only be done after we have done all our drawing in the separations group. Fixes issue in page 7 of Altona test.
2017-10-24Fix overprint with shadings.Robin Watts
2017-10-24Add FZ_ENABLE_SPOT_RENDERING define.Robin Watts
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-24Overprint support.Robin Watts
Introduce an fz_overprint bitmap (currently just a uint32_t, but it'll grow to be an array of them if FZ_MAX_COLOR is increased). Pointers to this are passed into all our painting routines. NULL means "Do what you've always done before, with no overprint". non NULL, means that every set bit means "don't ever alter this component". We therefore set the overprint bitmap up according to the input color/colorspace/colorparams before calling each routine.
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-16Print warning when PDF version number is not a known version.Tor Andersson
2017-10-16Check for integer overflow when validating new style xref Index.Tor Andersson
2017-10-16Add missing pdfsign.c file to MSVC project.Robin Watts
2017-10-13Add fz_deflate family of functions.Robin Watts
This gives us a friendlier interface to zlib. Simplifies PNG output and PCLM output code.
2017-10-13Rename internals of flate filter.Robin Watts
This is to avoid conflict with the next commit.
2017-10-13Simple PCLm device.Robin Watts
Both bandwriter and document_writer interfaces cope with multi page docs. Update mudraw to output pclm format too. Incorporates fixes from Tor.
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-12Don't cache page count in pdf_document.Tor Andersson
Make sure any changes to the page tree are always reflected immediately. The rev_page_map lookup cache exists when we load the outlines in order to resolve links faster, so we don't need to worry about that one. The linear_page_refs stuff is more troublesome, so don't mix editing a PDF with progressive loading!
2017-10-12Fix reference counting error in pdf_add_page.Tor Andersson
2017-10-12mutool run: Take reference to global colorspaces.Tor Andersson
Avoid double freeing the device colorspaces.
2017-10-12Refactor image format magic signature recognition into its own function.Tor Andersson
2017-10-12Change default scalable SVG resolution.Tor Andersson
HTML doesn't respect the DPI setting, so SVG images end up too big.
2017-10-12Purge out of date separation bindings.Tor Andersson
2017-10-12Add 'mutool sign' tool for verifying digital PDF signatures.Tor Andersson
2017-10-12Fix pdf_widget/pdf_annot typedefs. They are the same struct.Tor Andersson
2017-10-12Fix bug in murun when creating buffers from strings.Tor Andersson
The code only worked for string literals, not garbage collected or short strings.
2017-10-12Some more consts.Tor Andersson
2017-10-12Make fz_open_memory take a const buffer.Tor Andersson
2017-10-12Make image loading use const data pointers.Tor Andersson
2017-10-05Fix out of bounds check in pnm parser.Sebastian Rasmussen
2017-10-05Remove unused code.Sebastian Rasmussen
2017-10-05Remove shadowed variables.Sebastian Rasmussen
2017-10-05Avoid double literals and double math functions.Sebastian Rasmussen