You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PDFGraphics2D.java 66KB

Merged branch https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_ImagePackageRedesign (revs 594558 to 611138) into Trunk: A new image loading framework has been introduced to fix various problems with external graphics and improve performance. Switched to Batik 1.7. Added xml-apis-ext.jar as needed by Batik 1.7. Updated to latest XML Graphics Commons snapshot. Changelog of branch: ------------------------------------------------------------------------ r594558 | jeremias | 2007-11-13 16:04:56 +0100 (Di, 13 Nov 2007) | 1 line Branch for image package redesign ------------------------------------------------------------------------ r594560 | jeremias | 2007-11-13 16:10:35 +0100 (Di, 13 Nov 2007) | 1 line Implementation of Dijkstra's algorithm for finding the shortest path. Used in the new image package to find the best combination of image loaders and image converters to provide an image in the optimal form for a renderer. ------------------------------------------------------------------------ r594848 | jeremias | 2007-11-14 13:12:50 +0100 (Mi, 14 Nov 2007) | 3 lines Initial upload of what I have already for the image package redesign. For now, it's in a parallel package (image2). The final package name is TBD. The code isn't hooked into the renderers, yet, and there's no image cache. This is still all work in progress. ------------------------------------------------------------------------ r594851 | jeremias | 2007-11-14 13:20:12 +0100 (Mi, 14 Nov 2007) | 1 line Test cases and additional test files for the new image package. ------------------------------------------------------------------------ r595305 | jeremias | 2007-11-15 15:01:37 +0100 (Do, 15 Nov 2007) | 1 line Small mistake while reimplementing JPEG. ------------------------------------------------------------------------ r595308 | jeremias | 2007-11-15 15:13:36 +0100 (Do, 15 Nov 2007) | 5 lines Introduced a usage penalty for ImageLoaders so we can calculate an overall penalty for a pipeline. Multiple image flavors can be passed to ImageManager.getImage() if the caller supports multiple formats. The image package chooses the best pipeline. Implemented a converter from RenderedImage to PNG. Implemented loaders for raw formats (EMF, JPEG and PNG). Hooked the new image package into the RTF handler as first real proof-of-concept. ------------------------------------------------------------------------ r596240 | jeremias | 2007-11-19 11:02:13 +0100 (Mo, 19 Nov 2007) | 1 line Fixed bug in pipeline selection. ------------------------------------------------------------------------ r596242 | jeremias | 2007-11-19 11:03:06 +0100 (Mo, 19 Nov 2007) | 1 line MIME type in parentheses behind the URI makes more sense. ------------------------------------------------------------------------ r599430 | jeremias | 2007-11-29 14:08:01 +0100 (Do, 29 Nov 2007) | 1 line Support for baseline information (needed by at least MathML). ------------------------------------------------------------------------ r599433 | jeremias | 2007-11-29 14:09:04 +0100 (Do, 29 Nov 2007) | 1 line Bugfix: BMP don't all have resolution information. ------------------------------------------------------------------------ r599434 | jeremias | 2007-11-29 14:10:54 +0100 (Do, 29 Nov 2007) | 1 line Change MIME type ------------------------------------------------------------------------ r599436 | jeremias | 2007-11-29 14:17:14 +0100 (Do, 29 Nov 2007) | 3 lines Started integrating into Java2D and PostScript renderers and ExternalGraphic. Added support for EPS graphics. Added support for raw embedding of JPEG images (for PostScript). ------------------------------------------------------------------------ r600821 | jeremias | 2007-12-04 08:51:06 +0100 (Di, 04 Dez 2007) | 5 lines Clean up Javadocs Generally make more useful. Reuse FOProcessor instance for the whole run to actually feel the effect of an image cache attached to the FopFactory. Add option to prompt the user before actually starting (in order to connect a VM monitor). ------------------------------------------------------------------------ r600870 | jeremias | 2007-12-04 11:27:51 +0100 (Di, 04 Dez 2007) | 14 lines Note: The API of the new image package has changed a bit. (it became necessary when I introduced caching) The direct dependency on FOUserAgent has been removed to make the image package more universally usable. Instead an ImageContext (provided by FopFactory in FOP) and ImageSessionContext (provided by FOUserAgent in FOP) was introduced. Introduced image caching with soft references (I didn't reintroduce the FOUserAgent lock, yet, because it doesn't help much) ImageInfo doesn't carry the Source for the image anymore. The Source is provided by the new ImageSessionContext.java and only shared within the same thread to make things simpler and to avoid complex synchronization and cleanup. Image instances now indicate whether they are cacheable (not all Image instances are cacheable, for example when they just carry an InputStream). Moved the converter pipeline functionality into its own subpackage to keep "spi" clean. Added checks in ImageSize to detect incomplete Preloaders. ImageSource can now indicate whether its a fast source (loading from local file) or a slow source (loading over the network). (but this isn't used, yet) Fixed a bug in WMF and SVG preloaders: they didn't close their Sources after fully loading the images. Bugfix in ImageRawJPEG: it illegally reported being an EPS file ImageRawStream got an "InputStreamFactory" so it is possible to reuse raw images if they have been loaded into memory (or to a local file which hasn't been implemented, yet). The pipeline code now converts single-use raw images to reusable raw images when possible. But there's nothing built in to restrict the image size to a maximum, yet. Improved JPEG preloader so it can stop early an deal with images that have to APP0 segment. Images from digicams are such an example. They carry the resolution info in the EXIF block which is currently not interpreted. Fallback is to the configured source resolution. ------------------------------------------------------------------------ r600930 | jeremias | 2007-12-04 14:25:43 +0100 (Di, 04 Dez 2007) | 1 line Package HTML Files. ------------------------------------------------------------------------ r600934 | jeremias | 2007-12-04 14:34:41 +0100 (Di, 04 Dez 2007) | 1 line Javadoc fixes ------------------------------------------------------------------------ r602023 | jeremias | 2007-12-07 09:46:56 +0100 (Fr, 07 Dez 2007) | 2 lines Bugfix for bug in SVG preloader which didn't calculate the size of an SVG correctly when there's no explicit size. ------------------------------------------------------------------------ r602024 | jeremias | 2007-12-07 09:49:49 +0100 (Fr, 07 Dez 2007) | 1 line Some small javadoc and logging improvements/refinements. ------------------------------------------------------------------------ r602025 | jeremias | 2007-12-07 09:50:22 +0100 (Fr, 07 Dez 2007) | 1 line Enable assert keyword for javadoc production. ------------------------------------------------------------------------ r602032 | jeremias | 2007-12-07 09:59:10 +0100 (Fr, 07 Dez 2007) | 11 lines Added color space information and an optional ICC color profile to the basic Image interface. Reimplemented transparency support (for now only for ImageIO loader and PDF output) ImageIO preloader passes the already loaded metadata to the ImageIO loader through the "custom objects" so it doesn't have to load them again. PDF library: Corrected the naming of the method indicating the "bits per component" (bits per component != bits per pixel) PDF library: Added a method which lets a user override values in an XObject's dictionary after the major values have been set (useful not to make the PDFImage interface more complicated). PDF library: Support for gray transparent colors. PDF library: Added a convenience class for alpha channel bitmaps (AlphaRasterImage) Integration of the new image package into the PDFRenderer (currently supports all previous embedding methods except deprecated EPS embedding and CCITT embedding, now supports even more transparency options than before) ------------------------------------------------------------------------ r602033 | jeremias | 2007-12-07 09:59:57 +0100 (Fr, 07 Dez 2007) | 1 line Small optimization from my failed experiments to support native PNG embedding. ------------------------------------------------------------------------ r602034 | jeremias | 2007-12-07 10:01:34 +0100 (Fr, 07 Dez 2007) | 1 line Don't use "content" filter for ICC profiles. Instead compress using "default". "content" is for page content. ------------------------------------------------------------------------ r602036 | jeremias | 2007-12-07 10:02:25 +0100 (Fr, 07 Dez 2007) | 1 line Added general key for precompressed content of any kind. ------------------------------------------------------------------------ r602037 | jeremias | 2007-12-07 10:03:39 +0100 (Fr, 07 Dez 2007) | 1 line Various variants of the FOP logo for testing. Some of them have transparency info. ------------------------------------------------------------------------ r602228 | jeremias | 2007-12-07 22:30:17 +0100 (Fr, 07 Dez 2007) | 4 lines Discarded PreloaderPNG in favor of PreloaderImageIO which now supports all formats supported by ImageIO (meaning that you can uses JPEG-2000 images if you have a suitable ImageIO codec installed). ImagePreloader.getMimeType() removed because it isn't really used in the new setup. ImagePreloader.getPriority() introduced which allows to prioritize preloaders and thus gives the opportunity to tweak the order in which the preloaders are checked when an image is inspected. ImageLoaderImageIO can now use multiple Readers if one fails (one codec may not support all format variants, for example). ------------------------------------------------------------------------ r602229 | jeremias | 2007-12-07 22:30:48 +0100 (Fr, 07 Dez 2007) | 1 line Added a toString() impl for debugging. ------------------------------------------------------------------------ r602442 | jeremias | 2007-12-08 11:36:32 +0100 (Sa, 08 Dez 2007) | 6 lines Support handling images with no associated URI (from instream-foreign-object). These images are not cached. Add support for plain image conversion (i.e. with no loading) for instream-foreign-object. Add convenience writeTo() methods in ImageRawStream to save a few lines of code. Support for instream-foreign-object in RTF output. Teach RTF library to handle images without an associated URL. ------------------------------------------------------------------------ r603191 | jeremias | 2007-12-11 11:03:32 +0100 (Di, 11 Dez 2007) | 2 lines Bugfix: Graphics2DAdapter didn't do the graphics state save correct so subsequent images may have been painted with the wrong transformation matrix. Bugfix: bitmap images didn't scale correctly when the resolutions were changed. ------------------------------------------------------------------------ r603207 | jeremias | 2007-12-11 12:08:36 +0100 (Di, 11 Dez 2007) | 1 line Convenience method for obtaining the image size in points. ------------------------------------------------------------------------ r603208 | jeremias | 2007-12-11 12:12:50 +0100 (Di, 11 Dez 2007) | 3 lines Precisely define the expectations for the area parameter in Graphics2DImagePainter. New ImageConverter: Bitmap -> Graphics2D ------------------------------------------------------------------------ r603209 | jeremias | 2007-12-11 12:15:49 +0100 (Di, 11 Dez 2007) | 3 lines Refine pipeline building: Expose a method to allow the PS Renderer to predict what kind of pipeline will be selected (because it doesn't support all image types as PostScript forms) If there are multiple candidate pipelines for one conversion type, choose the one with the lowest penalty, not just the one that happens to be first. ------------------------------------------------------------------------ r603250 | jeremias | 2007-12-11 15:17:32 +0100 (Di, 11 Dez 2007) | 1 line Removing failed experiment: raw PNG embedding didn't work out. ------------------------------------------------------------------------ r603254 | jeremias | 2007-12-11 15:29:48 +0100 (Di, 11 Dez 2007) | 2 lines Plugged new image package into form generation for PostScript. XML images and EPS files are currently supported as forms. They are added inline. ------------------------------------------------------------------------ r603256 | jeremias | 2007-12-11 15:34:52 +0100 (Di, 11 Dez 2007) | 1 line Embedding EPS in PDF is no longer implemented as it is a deprecated feature in PDF. Therefore, this test is not needed anymore. The PDF renderer will say: "Cannot load image (no suitable loader/converter combination available) for myfile.eps (application/postscript)" ------------------------------------------------------------------------ r603266 | jeremias | 2007-12-11 16:16:22 +0100 (Di, 11 Dez 2007) | 1 line Size calculation for images can be slightly different after the redesign due to different rounding. Give a little tolerance. ------------------------------------------------------------------------ r603271 | jeremias | 2007-12-11 16:24:08 +0100 (Di, 11 Dez 2007) | 1 line Bugfix: Only generate the FixedLength if there is baseline information. ------------------------------------------------------------------------ r603358 | jeremias | 2007-12-11 22:13:22 +0100 (Di, 11 Dez 2007) | 1 line Switched background images to new image package. ------------------------------------------------------------------------ r603632 | jeremias | 2007-12-12 15:52:09 +0100 (Mi, 12 Dez 2007) | 1 line Switch to new image package for PDF/SVG support. ------------------------------------------------------------------------ r603642 | jeremias | 2007-12-12 16:30:16 +0100 (Mi, 12 Dez 2007) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-594557" from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ------------------------------------------------------------------------ r603656 | jeremias | 2007-12-12 17:13:06 +0100 (Mi, 12 Dez 2007) | 307 lines Merged revisions 594558-603642 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r594571 | vhennebert | 2007-11-13 17:24:32 +0100 (Di, 13 Nov 2007) | 7 lines Moved the creation of grid units to the FO tree building stage. Brought a few improvements along with the move: - bugfix: border-resolution for border-end on row-spanning cells was wrong - bugfix: in case of missing cells the border-end of the table was applied to an inner cell, instead of the cell in the last column (but missing cells aren't painted yet :-\) - bugfix: in collapsing-border model, border-before and -after specified on table-column were applied to every cell of the column, instead of only the first and the last ones - border resolution is now made progressively when possible, and no longer triggers the fetching of all the rows of the table Added testcases for the border conflict resolution (between the various elements of a table and not only the cells) ........ r594578 | vhennebert | 2007-11-13 17:50:09 +0100 (Di, 13 Nov 2007) | 2 lines Moved *GridUnit from layoutmgr/table to fo/flow/table ........ r594579 | vhennebert | 2007-11-13 17:55:54 +0100 (Di, 13 Nov 2007) | 2 lines Changed back visibility of fields from public to package-private, due to the move of *GridUnit in the fo.flow.table package ........ r594584 | vhennebert | 2007-11-13 18:13:19 +0100 (Di, 13 Nov 2007) | 2 lines Use a singleton for a default BorderInfo of style none, instead of every time a new instance ........ r594592 | vhennebert | 2007-11-13 18:39:17 +0100 (Di, 13 Nov 2007) | 2 lines Cleaned up RowGroupLayoutManager and TableRowIterator ........ r594821 | vhennebert | 2007-11-14 11:18:45 +0100 (Mi, 14 Nov 2007) | 2 lines Moved EffRow to the fo.flow.table package ........ r594829 | vhennebert | 2007-11-14 11:41:52 +0100 (Mi, 14 Nov 2007) | 2 lines Reduced visibility of some methods and constructors from public to package-private, as a consequence of the move of *GridUnit to the fo.flow.table package ........ r594836 | vhennebert | 2007-11-14 12:14:03 +0100 (Mi, 14 Nov 2007) | 2 lines Restored the setting of the parent table-row element on grid units ........ r594852 | vhennebert | 2007-11-14 13:21:53 +0100 (Mi, 14 Nov 2007) | 2 lines Restored the setting of rowIndex on primary grid units (although testcases were already working...) ........ r595297 | jeremias | 2007-11-15 14:28:58 +0100 (Do, 15 Nov 2007) | 2 lines Bugzilla #43143: Had to remove the Expert(Subset) Encoding detection as this caused problems with a barcode font that used dfCharset=2 but was not using ExpertSubset encoding. To detect Expert(Subset)Encoding, the AFM needs to be parsed. And since we don't support that encoding, yet, the fallback to WinAnsiEncoding should work well enough. ........ r595637 | acumiskey | 2007-11-16 13:12:52 +0100 (Fr, 16 Nov 2007) | 3 lines This should improve the ability of the FontLoader when resolving PFM files for Type 1 fonts on case sensitive Unix systems. ........ r596072 | jeremias | 2007-11-18 11:48:53 +0100 (So, 18 Nov 2007) | 4 lines ApacheCon US is over. OSSSummit was cancelled/postponed. Added example for total page count using XSL 1.1 Adjusted total page count example to new FOP API. (Thanks to Miroslav Gregan for the hint) ........ r596097 | jeremias | 2007-11-18 17:56:09 +0100 (So, 18 Nov 2007) | 6 lines Bugzilla #43605: Added methods for page-number-citation and page-number-citation-last in FOEventHandler.java Submitted by: V. Schappert <vschappert.at.bloomberg.net> Patch modified by Jeremias: Bugfix: FOEventHandler.startPageNumberCitation() was also called in the case of a page-number-citation-last. Introduced abstract base classes to avoid this. ........ r596100 | jeremias | 2007-11-18 18:17:24 +0100 (So, 18 Nov 2007) | 1 line Added sample as suggested by Kumar Puppala. ........ r596390 | vhennebert | 2007-11-19 19:25:27 +0100 (Mo, 19 Nov 2007) | 2 lines Bugzilla #43766: breaks generated by the merging algorithm for table rows containing empty cells has always a penalty of 900 ........ r596554 | jeremias | 2007-11-20 08:14:33 +0100 (Di, 20 Nov 2007) | 2 lines Bugzilla #43904: Buffer the OutputStreams in our transcoders if the users forget. ........ r596600 | jeremias | 2007-11-20 11:20:29 +0100 (Di, 20 Nov 2007) | 3 lines Bugzilla #43910: Avoid a NullPointerException in AreaTreeHandler.endDocument(). Submitted by: David Delbecq <delbd.at.oma.be> ........ r596724 | jeremias | 2007-11-20 16:56:33 +0100 (Di, 20 Nov 2007) | 3 lines Bugfix: Bugfix for URI resolution: Make StreamSources without system identifier work again. Bugfix: Close streams opened by test font resolution in font configuration (the font URIs will be resolved again later anyway). Better error message when the loading of font metric files doesn't work due to missing information in the returned Source instances. ........ r596727 | vhennebert | 2007-11-20 17:07:32 +0100 (Di, 20 Nov 2007) | 2 lines Bugfix in tables: wrong element generation by the merging algorithm when glues must be produced to cope with conditional spaces. The corresponding length was added twice: one in the glue itself and one in the following box. ........ r596739 | cbowditch | 2007-11-20 17:49:13 +0100 (Di, 20 Nov 2007) | 1 line bug fix: memory leak in PropertyCache. Fix provided by Jeremias. There are still some thread synchronization issues to be addressed in the PropertyCache. See the following thread for details: http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-dev/200711.mbox/%3cBAY117-DAV109E36CC066889386AB917FB870@phx.gbl%3e ........ r596742 | vhennebert | 2007-11-20 18:08:46 +0100 (Di, 20 Nov 2007) | 2 lines Added a news entry about Max Berger becoming a committer. Welcome Max! ........ r596776 | vhennebert | 2007-11-20 19:47:39 +0100 (Di, 20 Nov 2007) | 2 lines Bugzilla #43803: table cells having no children are allowed in relaxed validation mode. ........ r597052 | vhennebert | 2007-11-21 13:23:59 +0100 (Mi, 21 Nov 2007) | 2 lines Bugfix: the last element generated by the merging algorithm may now be a glue ........ r597448 | jeremias | 2007-11-22 17:13:05 +0100 (Do, 22 Nov 2007) | 2 lines First draft of a possible new intermediate format for Apache FOP. Details on: http://wiki.apache.org/xmlgraphics-fop/AreaTreeIntermediateXml/NewDesign ........ r598558 | jeremias | 2007-11-27 09:36:23 +0100 (Di, 27 Nov 2007) | 6 lines Bugzilla #40230: Bugfix: no empty page is generated anymore if there's no content after a break-after. Bugzilla #43917: Bugfix for border-after painting and element list generation when a forced break is involved. ........ r599536 | vhennebert | 2007-11-29 19:31:13 +0100 (Do, 29 Nov 2007) | 4 lines Added fixes-bug attributes for: - wrong element generation in table when glues are produced - border-resolution on row-spanning cells ........ r599746 | jeremias | 2007-11-30 10:04:54 +0100 (Fr, 30 Nov 2007) | 2 lines Bugzilla #37993: Bugfix: allow multiple bookmarks to point at the same destination. ........ r600195 | adelmelle | 2007-12-01 22:11:53 +0100 (Sa, 01 Dez 2007) | 1 line Correction and simplification of the PropertyCache: subclass WeakReference and remove internal threading ........ r600467 | jeremias | 2007-12-03 11:16:27 +0100 (Mo, 03 Dez 2007) | 2 lines Log RuntimeExceptions during rendering so that they are at least visible somewhere if someone doesn't set an ErrorListener on the XSLT processor (this could lead to exceptions being swallowed). This is a temporary measure until we have time to improve the exception handling in FOP. The original problem that led to this change was: "The number of this PDFNumber must not be empty" while producing a PDF/A with customized filter entries in the PDF configuration. The exception was a follow-up exception after a PDFConformanceException that was swallowed by a default ErrorListener. ........ r600521 | jeremias | 2007-12-03 14:21:06 +0100 (Mo, 03 Dez 2007) | 1 line Added a possibility to rerun the whole run a defined number of times to test for possible issues outside a single rendering run. ........ r600529 | jeremias | 2007-12-03 14:32:04 +0100 (Mo, 03 Dez 2007) | 1 line Oops. ........ r601413 | vhennebert | 2007-12-05 17:56:47 +0100 (Mi, 05 Dez 2007) | 2 lines Typo in property: svn:kewords -> svn:keywords ........ r601415 | acumiskey | 2007-12-05 18:11:44 +0100 (Mi, 05 Dez 2007) | 2 lines Corrected javadocs ........ r601416 | acumiskey | 2007-12-05 18:12:54 +0100 (Mi, 05 Dez 2007) | 2 lines Corrected javadoc ........ r601417 | acumiskey | 2007-12-05 18:13:31 +0100 (Mi, 05 Dez 2007) | 2 lines Corrected javadoc ........ r601419 | acumiskey | 2007-12-05 18:15:46 +0100 (Mi, 05 Dez 2007) | 2 lines Improved use of logging ........ r601423 | acumiskey | 2007-12-05 18:19:43 +0100 (Mi, 05 Dez 2007) | 2 lines Corrected javadoc, fixed checkstyle issues, and now also correctly caters for negative number conversions ........ r601424 | acumiskey | 2007-12-05 18:21:15 +0100 (Mi, 05 Dez 2007) | 2 lines Fixed checkstyle issues ........ r601426 | acumiskey | 2007-12-05 18:24:15 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601427 | acumiskey | 2007-12-05 18:25:07 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601428 | acumiskey | 2007-12-05 18:25:58 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601429 | acumiskey | 2007-12-05 18:27:06 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601430 | acumiskey | 2007-12-05 18:28:03 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601431 | acumiskey | 2007-12-05 18:28:48 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601432 | acumiskey | 2007-12-05 18:29:31 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601433 | acumiskey | 2007-12-05 18:30:04 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601434 | acumiskey | 2007-12-05 18:31:20 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601435 | acumiskey | 2007-12-05 18:32:29 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601436 | acumiskey | 2007-12-05 18:34:44 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601437 | acumiskey | 2007-12-05 18:35:31 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601438 | acumiskey | 2007-12-05 18:36:12 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes and cleanup ........ r601439 | acumiskey | 2007-12-05 18:37:40 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601440 | acumiskey | 2007-12-05 18:39:54 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601442 | acumiskey | 2007-12-05 18:42:13 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601443 | acumiskey | 2007-12-05 18:42:48 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601444 | acumiskey | 2007-12-05 18:43:46 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601445 | acumiskey | 2007-12-05 18:44:36 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601446 | acumiskey | 2007-12-05 18:45:20 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601447 | acumiskey | 2007-12-05 18:47:44 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601448 | acumiskey | 2007-12-05 18:48:56 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601449 | acumiskey | 2007-12-05 18:49:46 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601712 | acumiskey | 2007-12-06 12:57:14 +0100 (Do, 06 Dez 2007) | 2 lines Temporary fix to the build ........ r602045 | jeremias | 2007-12-07 10:20:28 +0100 (Fr, 07 Dez 2007) | 1 line Avoid a NPE in toString(). ........ r602125 | maxberger | 2007-12-07 16:36:53 +0100 (Fr, 07 Dez 2007) | 6 lines Updated xmlgraphics from SVN Added autodetection of fonts in jar files (x-font and x-font-truetype) Added files needed for testcase Please note: Actual testcase is still missing! ........ r602898 | maxberger | 2007-12-10 14:35:33 +0100 (Mo, 10 Dez 2007) | 2 lines Added documentation for font-in-jar-files ........ r603590 | acumiskey | 2007-12-12 13:24:10 +0100 (Mi, 12 Dez 2007) | 4 lines * Added an SVG handler and Graphics2D implementation for AFP which injects AFP GOCA structured fields into the AFPDataStream. * Fixed many checkstyle problems. * Updated xmlgraphics-commons-1.3svn.jar to include changes to TextHandler ........ r603592 | acumiskey | 2007-12-12 13:26:39 +0100 (Mi, 12 Dez 2007) | 2 lines Updated status with SVG support for AFP. ........ ------------------------------------------------------------------------ r603661 | jeremias | 2007-12-12 17:20:09 +0100 (Mi, 12 Dez 2007) | 1 line Fix javadoc ------------------------------------------------------------------------ r603886 | jeremias | 2007-12-13 12:15:48 +0100 (Do, 13 Dez 2007) | 1 line Copy/paste programming is dangerous. :-) ------------------------------------------------------------------------ r603902 | jeremias | 2007-12-13 13:17:56 +0100 (Do, 13 Dez 2007) | 2 lines Factored out all image handling code in the PDFRenderer into PDFImageHandler classes. The interface was introduced to handle PDF-in-PDF images. The PDFImageHandler interface changes in a backwards-incompatible way but since the PDF-in-PDF plug-in probably has the only implementation, that's not very problematic. I'll release a new version as soon as the image stuff is merged back into Trunk. ------------------------------------------------------------------------ r603937 | jeremias | 2007-12-13 16:20:46 +0100 (Do, 13 Dez 2007) | 1 line Some cleanup ------------------------------------------------------------------------ r603938 | jeremias | 2007-12-13 16:23:23 +0100 (Do, 13 Dez 2007) | 2 lines Switch PCL renderer to new image package. Add an option to force a color canvas (RGB) instead of a gray canvas. Set this to true for all SVG graphics since Batik does not seem to support gradients on a grayscale canvas (IllegalArgumentException). ------------------------------------------------------------------------ r604122 | jeremias | 2007-12-14 08:58:56 +0100 (Fr, 14 Dez 2007) | 1 line Stupid copy/paste again. ------------------------------------------------------------------------ r604135 | jeremias | 2007-12-14 10:04:43 +0100 (Fr, 14 Dez 2007) | 1 line Preliminary changes to switch to the new image library. TIFF optimizations still missing. Untested. ------------------------------------------------------------------------ r604144 | jeremias | 2007-12-14 11:12:41 +0100 (Fr, 14 Dez 2007) | 1 line Switch to new image package. At some point we will probably want to remove this example as JEuclid has a better plug-in now. ------------------------------------------------------------------------ r604150 | jeremias | 2007-12-14 11:27:39 +0100 (Fr, 14 Dez 2007) | 1 line Old JEuclid doesn't notice itself if no MathML document is loaded. ------------------------------------------------------------------------ r604155 | jeremias | 2007-12-14 11:48:07 +0100 (Fr, 14 Dez 2007) | 2 lines Switched to new image package. The preloader simply loads the full document and converts it to SVG. That's the only way to determine the intrinsic size of the image. ------------------------------------------------------------------------ r604157 | jeremias | 2007-12-14 11:51:21 +0100 (Fr, 14 Dez 2007) | 1 line No longer needed. ------------------------------------------------------------------------ r604214 | jeremias | 2007-12-14 17:07:30 +0100 (Fr, 14 Dez 2007) | 1 line Added work-around for decoding CMYK JPEGs with ImageIO (no guarantees for color fidelity but it's better than not being able to use CMYK images). ------------------------------------------------------------------------ r604297 | jeremias | 2007-12-14 22:14:12 +0100 (Fr, 14 Dez 2007) | 68 lines Merged revisions 603643-604293 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r603890 | vhennebert | 2007-12-13 12:35:17 +0100 (Do, 13 Dez 2007) | 2 lines Fixed @throws statements in javadoc ........ r603926 | adelmelle | 2007-12-13 15:43:08 +0100 (Do, 13 Dez 2007) | 4 lines Minor tweaks: * only add text to a fo:wrapper if it is not a direct flow-descendant * error if an fo:wrapper that is a direct flow-descendant contains inline-level children ........ r603943 | vhennebert | 2007-12-13 16:55:29 +0100 (Do, 13 Dez 2007) | 2 lines Removed calls to removeLegalBreaks since they aren't necessary (the whole content is put in a single box anyway) and the method is buggy. ........ r603945 | vhennebert | 2007-12-13 17:10:32 +0100 (Do, 13 Dez 2007) | 2 lines Implemented the resolution of collapsing borders in the FO tree, for every situation (normal, cell at the top of a page, cell broken), taking conditionality, headers and footers into account. ........ r603959 | vhennebert | 2007-12-13 18:21:24 +0100 (Do, 13 Dez 2007) | 2 lines Reverted change accidentally introduced in the previous commit. A proper fix needs to be found for this one. ........ r603961 | vhennebert | 2007-12-13 18:31:26 +0100 (Do, 13 Dez 2007) | 2 lines Ok, now /really/ revert the previous commit :-\ ........ r603962 | vhennebert | 2007-12-13 18:32:43 +0100 (Do, 13 Dez 2007) | 2 lines Style only: removed trailing white spaces ........ r603968 | vhennebert | 2007-12-13 19:28:56 +0100 (Do, 13 Dez 2007) | 2 lines Fixed the handling of columns in the border resolution, especially in case of column-spanning cells ........ r603975 | vhennebert | 2007-12-13 19:52:48 +0100 (Do, 13 Dez 2007) | 2 lines Removed parameter from the endPart method, since the part is already passed as a parameter of the previously called startPart method ........ r603979 | vhennebert | 2007-12-13 19:57:25 +0100 (Do, 13 Dez 2007) | 2 lines Removed parameter from the endTablePart method, as the part is already passed as as a parameter of the previously called startTablePart method ........ r603990 | vhennebert | 2007-12-13 20:17:12 +0100 (Do, 13 Dez 2007) | 2 lines Throw a ValidationException if table-footer is put after table-body and the table uses the collapsing border model. The footer must be known to properly resolve borders. ........ r604171 | vhennebert | 2007-12-14 12:32:51 +0100 (Fr, 14 Dez 2007) | 2 lines Clean up: removed all reset and resetPosition methods, which pre-date the Knuth era and are no longer needed ........ r604180 | vhennebert | 2007-12-14 13:23:10 +0100 (Fr, 14 Dez 2007) | 2 lines Reduced visibility of methods from public to package-private ........ r604185 | acumiskey | 2007-12-14 14:16:06 +0100 (Fr, 14 Dez 2007) | 2 lines Fixed copy constructor ........ r604293 | jeremias | 2007-12-14 21:58:53 +0100 (Fr, 14 Dez 2007) | 2 lines Bugfix: DecodeParms -> DecodeParams (introduced when I changed to generic PDF structures) (fixes CCITT encoded images) ........ ------------------------------------------------------------------------ r604301 | jeremias | 2007-12-14 22:26:27 +0100 (Fr, 14 Dez 2007) | 9 lines Merged revisions 604294-604299 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r604299 | jeremias | 2007-12-14 22:24:14 +0100 (Fr, 14 Dez 2007) | 1 line Don't hack when you're tired! Reverting r604293 and instead fixing the right value. It's DecodeParams -> DecodeParms! ........ ------------------------------------------------------------------------ r604930 | jeremias | 2007-12-17 18:05:47 +0100 (Mo, 17 Dez 2007) | 2 lines Dispose ImageReader when done reading. Don't close streams as some codecs appear to do "late reading" of the image, i.e. only when the rasters are accessed, at which point they still seek on the stream. For this, the streams must remain open. I hope the codecs all properly close the streams once they don't need them anymore. The javadocs are not clear enough in this regards, IMO. ------------------------------------------------------------------------ r604968 | jeremias | 2007-12-17 20:03:45 +0100 (Mo, 17 Dez 2007) | 3 lines Added an isSupported() method to ImageLoaderFactory so we can check early if an ImageLoader may or may not support a particular subformat. This is used to allow optimized loading of CCITT compressed TIFF images. Support for undecoded embedding of single-strip CCITT compressed images for PDF, PostScript and AFP. Added a fallback mechanism for ImageLoaders: if one ImageLoader cannot load a particular image, try equivalent others registered for the same format. ------------------------------------------------------------------------ r604972 | jeremias | 2007-12-17 20:07:43 +0100 (Mo, 17 Dez 2007) | 1 line Update Commons ------------------------------------------------------------------------ r605138 | jeremias | 2007-12-18 09:42:41 +0100 (Di, 18 Dez 2007) | 2 lines Support for specifying a particular page number of a multi-page image (such as TIFF). Format: http://localhost/images/scan1.tif#page=3 ------------------------------------------------------------------------ r605479 | jeremias | 2007-12-19 10:18:33 +0100 (Mi, 19 Dez 2007) | 3 lines Removed new image package after the copying it to XML Graphics Commons. Adjusted to use the Commons' version. Batik-dependent plugins remain but will eventually need a different resting place. ------------------------------------------------------------------------ r605486 | jeremias | 2007-12-19 10:39:33 +0100 (Mi, 19 Dez 2007) | 1 line Adjust the (pre)loader registration for the demo extensions. ------------------------------------------------------------------------ r605567 | jeremias | 2007-12-19 16:03:25 +0100 (Mi, 19 Dez 2007) | 1 line Fixed scaling and translation (didn't work correctly in certain situations) ------------------------------------------------------------------------ r607034 | jeremias | 2007-12-27 11:47:12 +0100 (Do, 27 Dez 2007) | 71 lines Merged revisions 604300-607033 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r604475 | vhennebert | 2007-12-15 19:16:01 +0100 (Sa, 15 Dez 2007) | 2 lines Testcase for the resolution of collapsed and conditional borders in the FO tree ........ r604678 | adelmelle | 2007-12-16 20:54:00 +0100 (So, 16 Dez 2007) | 8 lines Streamlining/Correction of the changes made in r603926 - delegate validation of the fo:wrapper's children to the parent: added static FONode.validateChildNode() - narrow the condition for processing text-childnodes: this is not only constrained to fo:flow and fo:static-content, but the same goes for a fo:wrapper that is a direct descendant of a fo:block-container or fo:inline-container, which only allow block-level content (interpretation) - minor javadoc fixups/improvements ........ r604814 | vhennebert | 2007-12-17 11:21:04 +0100 (Mo, 17 Dez 2007) | 2 lines Organized imports ........ r604965 | vhennebert | 2007-12-17 19:56:46 +0100 (Mo, 17 Dez 2007) | 2 lines Renaming GridUnitPart into the more accurate CellPart. Moreover I was always making the confusion between gup and pgu ........ r604970 | vhennebert | 2007-12-17 20:05:27 +0100 (Mo, 17 Dez 2007) | 2 lines Simplified addAreasAndFlushRow: there can no longer be null GridUnits, every hole in the grid is now filled with an EmptyGridUnit ........ r605195 | vhennebert | 2007-12-18 12:56:38 +0100 (Di, 18 Dez 2007) | 2 lines Reset previousRowsLength before a new row-group is handled ........ r605246 | vhennebert | 2007-12-18 17:48:03 +0100 (Di, 18 Dez 2007) | 2 lines Simplification in RowPainter: avoid the use of an array to store rowOffsets and firstRow index for each part of the table (header, footer, body). One at a time is enough. ........ r605253 | vhennebert | 2007-12-18 18:01:45 +0100 (Di, 18 Dez 2007) | 2 lines Renamed firstRow into firstRowIndex and moved its initialization into handeTableContentPosition ........ r605295 | vhennebert | 2007-12-18 19:58:29 +0100 (Di, 18 Dez 2007) | 2 lines Streamlined the recording of row offsets, by replacing Map with a List. Fixed bug #43633 in the same time. ........ r605297 | vhennebert | 2007-12-18 20:02:02 +0100 (Di, 18 Dez 2007) | 3 lines SVG support for AFP is an important addition IMO. IIUC it will have to be advertised in the next release as "Support for SVG images using primitive AFP graphics commands instead of bitmap images", or something like that? ........ r605517 | vhennebert | 2007-12-19 12:47:38 +0100 (Mi, 19 Dez 2007) | 2 lines I said currentGU can no longer be null ........ r605978 | jeremias | 2007-12-20 18:00:46 +0100 (Do, 20 Dez 2007) | 1 line Remove commented code. ........ r606004 | jeremias | 2007-12-20 20:19:19 +0100 (Do, 20 Dez 2007) | 1 line Added support for scale-down-to-fit and scale-up-to-fit. ........ r607032 | jeremias | 2007-12-27 11:34:15 +0100 (Do, 27 Dez 2007) | 4 lines Added new extension element: fox:external-document. It allows to add whole documents such as multi-page TIFF images to be inserted as peers to a page-sequence. Each image will make up an entire page. See the documentation for details. ATM, only single pages are possible. Multi-page images will be supported with the new image package. Some preparations for page-position="only" but the implementation is incomplete and "only" has no effect, yet. (Just uploaded some stuff I once started) Some javadoc cleanups. ........ ------------------------------------------------------------------------ r607091 | jeremias | 2007-12-27 18:13:45 +0100 (Do, 27 Dez 2007) | 1 line Avoid cutting away the URI fragment when building URLs from filenames. ------------------------------------------------------------------------ r607092 | jeremias | 2007-12-27 18:15:49 +0100 (Do, 27 Dez 2007) | 3 lines Switched fox:external-document to new image package. Added multi-page support for fox:external-document. Changed multi-page.tiff: page 4 is now bigger than all other pages. (to make sure that individually sized pages are handled properly) ------------------------------------------------------------------------ r607188 | jeremias | 2007-12-28 09:38:26 +0100 (Fr, 28 Dez 2007) | 2 lines Throwing IllegalStateException causes a prior exception to be swallowed by Xalan-J. Need to throw a SAXException instead. Instead of logging an error about the element mismatch throw a SAXException because the logging only confuses the user as it's practically always a follow-up exception of an exception happening earlier in the respective startElement() event. ------------------------------------------------------------------------ r607249 | jeremias | 2007-12-28 15:27:39 +0100 (Fr, 28 Dez 2007) | 1 line Metadata didn't get transported to the renderer when only fox:external-document is used. ------------------------------------------------------------------------ r607256 | jeremias | 2007-12-28 16:06:35 +0100 (Fr, 28 Dez 2007) | 1 line Corrected content model. ------------------------------------------------------------------------ r607261 | jeremias | 2007-12-28 16:11:56 +0100 (Fr, 28 Dez 2007) | 1 line Added -imagein to command-line so (multi-page) images such as TIFF files can be converted to PDF and other formats supported by FOP. The default stylesheet can be overwritten (with -xslt) if desired. ------------------------------------------------------------------------ r609530 | jeremias | 2008-01-07 09:16:09 +0100 (Mo, 07 Jan 2008) | 1 line Fixed copy/paste mistake. Thanks for spotting it, Vincent. ------------------------------------------------------------------------ r609600 | jeremias | 2008-01-07 14:28:53 +0100 (Mo, 07 Jan 2008) | 1 line Removed "image2" package again and moved the Batik-dependent implementations under the old "image" package. In this form, the deprecated code doesn't conflict with the new implementations anymore. ------------------------------------------------------------------------ r610029 | jeremias | 2008-01-08 16:48:53 +0100 (Di, 08 Jan 2008) | 3 lines Added minimal support for the .minimum/.maximum components of block/inline-progression-dimension on fo:external-graphic and fo:instream-foreign-object. This will only constrain the image itself but not allow the layout engine itself to resize the image as seen fit. Added missing Javadocs in ImageLayout.java. ------------------------------------------------------------------------ r611120 | jeremias | 2008-01-11 10:20:57 +0100 (Fr, 11 Jan 2008) | 100 lines Merged revisions 607034-611115 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r607036 | jeremias | 2007-12-27 11:51:11 +0100 (Do, 27 Dez 2007) | 1 line Don't just exit with no error message if the document contains no content. Pretty irritating if it does so. ........ r608812 | acumiskey | 2008-01-04 13:14:33 +0100 (Fr, 04 Jan 2008) | 3 lines The fonts variable would have always had an empty Configuration node (non-null value) even if a <fonts/> wasn't present in the fop configuration. ........ r609567 | jeremias | 2008-01-07 11:52:09 +0100 (Mo, 07 Jan 2008) | 4 lines Reenabled documentation for fox:destination. Enabled intermediate format functionality for fox:destination. Added a test case to check fox:destination. Deprecated FOP's XMLizable in favor of the XML Graphics Commons variant (and extend that variant). ........ r609627 | jeremias | 2008-01-07 16:06:24 +0100 (Mo, 07 Jan 2008) | 5 lines Bugzilla #44176: Support for custom fonts in Java2DRenderer and derived renderers. Submitted by: Patrick Jaromin <patrick.at.jgsullivan.dot.com> Patch modified slightly by jeremias. ........ r610020 | acumiskey | 2008-01-08 16:27:02 +0100 (Di, 08 Jan 2008) | 2 lines cleaned up ........ r610021 | acumiskey | 2008-01-08 16:28:56 +0100 (Di, 08 Jan 2008) | 2 lines Appears to be unused/referenced and superceeded by PageGroup ........ r610022 | acumiskey | 2008-01-08 16:34:07 +0100 (Di, 08 Jan 2008) | 2 lines cleaned up ........ r610023 | acumiskey | 2008-01-08 16:35:18 +0100 (Di, 08 Jan 2008) | 2 lines fixed javadoc ........ r610337 | vhennebert | 2008-01-09 12:02:08 +0100 (Mi, 09 Jan 2008) | 2 lines Fixed checkstyle issues: tabs and trailing spaces ........ r610355 | vhennebert | 2008-01-09 13:01:21 +0100 (Mi, 09 Jan 2008) | 2 lines keep-together is an inherited property ........ r610420 | acumiskey | 2008-01-09 16:40:25 +0100 (Mi, 09 Jan 2008) | 2 lines cleanup ........ r610704 | jeremias | 2008-01-10 08:38:47 +0100 (Do, 10 Jan 2008) | 1 line Added basic support for PDF page labels. ........ r610739 | jeremias | 2008-01-10 11:13:21 +0100 (Do, 10 Jan 2008) | 1 line PostScript output now generates the bounding box DSC comments for the whole document. ........ r610821 | vhennebert | 2008-01-10 16:53:20 +0100 (Do, 10 Jan 2008) | 4 lines - renamed variables for clarity - moved the computation of a cell's content length in PrimaryGridUnit - better javadoc for getHeight method in EffRow ........ r610848 | vhennebert | 2008-01-10 18:41:52 +0100 (Do, 10 Jan 2008) | 2 lines No need to check if the end of the cell is reached when creating the areas for a row ........ r610853 | vhennebert | 2008-01-10 18:54:16 +0100 (Do, 10 Jan 2008) | 2 lines Simplified addAreasAndFlushRow ........ r610886 | vhennebert | 2008-01-10 20:23:56 +0100 (Do, 10 Jan 2008) | 2 lines Removed endPart() method and moved its content into addAreasAndFlushRow() ........ r610891 | vhennebert | 2008-01-10 20:34:13 +0100 (Do, 10 Jan 2008) | 2 lines Removed accumulatedBPD which is redundant with yoffset ........ r610893 | vhennebert | 2008-01-10 20:35:24 +0100 (Do, 10 Jan 2008) | 2 lines The return value of addAreasAndFlushRow is never used, changed it to void ........ r610905 | vhennebert | 2008-01-10 20:57:29 +0100 (Do, 10 Jan 2008) | 2 lines Renamed lastRow into currentRow and yoffset into currentRowOffset ........ r611114 | jeremias | 2008-01-11 10:04:28 +0100 (Fr, 11 Jan 2008) | 2 lines Bugfix: Some string objects were not encrypted (for example in named destinations) I had to refactor the PDF library a little bit but since it only affects the inner API it shouldn't be a problem that I removed some methods which caused trouble because a didn't think about encryption when I worked on the PDF library last year. ........ ------------------------------------------------------------------------ r611133 | jeremias | 2008-01-11 11:45:01 +0100 (Fr, 11 Jan 2008) | 4 lines Fixed merge problems. Fixed a NPE when a mask is null in BitmapImage.java Add support for properly encoding binary data as a hexadecimal string object (including encryption). Adjust palette generation for indexed bitmaps to work correctly with encryption. ------------------------------------------------------------------------ r611138 | jeremias | 2008-01-11 11:59:27 +0100 (Fr, 11 Jan 2008) | 1 line Removed empty package. ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@611278 13f79535-47bb-0310-9956-ffa450edef68
16 years ago
Merged branch https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_ImagePackageRedesign (revs 594558 to 611138) into Trunk: A new image loading framework has been introduced to fix various problems with external graphics and improve performance. Switched to Batik 1.7. Added xml-apis-ext.jar as needed by Batik 1.7. Updated to latest XML Graphics Commons snapshot. Changelog of branch: ------------------------------------------------------------------------ r594558 | jeremias | 2007-11-13 16:04:56 +0100 (Di, 13 Nov 2007) | 1 line Branch for image package redesign ------------------------------------------------------------------------ r594560 | jeremias | 2007-11-13 16:10:35 +0100 (Di, 13 Nov 2007) | 1 line Implementation of Dijkstra's algorithm for finding the shortest path. Used in the new image package to find the best combination of image loaders and image converters to provide an image in the optimal form for a renderer. ------------------------------------------------------------------------ r594848 | jeremias | 2007-11-14 13:12:50 +0100 (Mi, 14 Nov 2007) | 3 lines Initial upload of what I have already for the image package redesign. For now, it's in a parallel package (image2). The final package name is TBD. The code isn't hooked into the renderers, yet, and there's no image cache. This is still all work in progress. ------------------------------------------------------------------------ r594851 | jeremias | 2007-11-14 13:20:12 +0100 (Mi, 14 Nov 2007) | 1 line Test cases and additional test files for the new image package. ------------------------------------------------------------------------ r595305 | jeremias | 2007-11-15 15:01:37 +0100 (Do, 15 Nov 2007) | 1 line Small mistake while reimplementing JPEG. ------------------------------------------------------------------------ r595308 | jeremias | 2007-11-15 15:13:36 +0100 (Do, 15 Nov 2007) | 5 lines Introduced a usage penalty for ImageLoaders so we can calculate an overall penalty for a pipeline. Multiple image flavors can be passed to ImageManager.getImage() if the caller supports multiple formats. The image package chooses the best pipeline. Implemented a converter from RenderedImage to PNG. Implemented loaders for raw formats (EMF, JPEG and PNG). Hooked the new image package into the RTF handler as first real proof-of-concept. ------------------------------------------------------------------------ r596240 | jeremias | 2007-11-19 11:02:13 +0100 (Mo, 19 Nov 2007) | 1 line Fixed bug in pipeline selection. ------------------------------------------------------------------------ r596242 | jeremias | 2007-11-19 11:03:06 +0100 (Mo, 19 Nov 2007) | 1 line MIME type in parentheses behind the URI makes more sense. ------------------------------------------------------------------------ r599430 | jeremias | 2007-11-29 14:08:01 +0100 (Do, 29 Nov 2007) | 1 line Support for baseline information (needed by at least MathML). ------------------------------------------------------------------------ r599433 | jeremias | 2007-11-29 14:09:04 +0100 (Do, 29 Nov 2007) | 1 line Bugfix: BMP don't all have resolution information. ------------------------------------------------------------------------ r599434 | jeremias | 2007-11-29 14:10:54 +0100 (Do, 29 Nov 2007) | 1 line Change MIME type ------------------------------------------------------------------------ r599436 | jeremias | 2007-11-29 14:17:14 +0100 (Do, 29 Nov 2007) | 3 lines Started integrating into Java2D and PostScript renderers and ExternalGraphic. Added support for EPS graphics. Added support for raw embedding of JPEG images (for PostScript). ------------------------------------------------------------------------ r600821 | jeremias | 2007-12-04 08:51:06 +0100 (Di, 04 Dez 2007) | 5 lines Clean up Javadocs Generally make more useful. Reuse FOProcessor instance for the whole run to actually feel the effect of an image cache attached to the FopFactory. Add option to prompt the user before actually starting (in order to connect a VM monitor). ------------------------------------------------------------------------ r600870 | jeremias | 2007-12-04 11:27:51 +0100 (Di, 04 Dez 2007) | 14 lines Note: The API of the new image package has changed a bit. (it became necessary when I introduced caching) The direct dependency on FOUserAgent has been removed to make the image package more universally usable. Instead an ImageContext (provided by FopFactory in FOP) and ImageSessionContext (provided by FOUserAgent in FOP) was introduced. Introduced image caching with soft references (I didn't reintroduce the FOUserAgent lock, yet, because it doesn't help much) ImageInfo doesn't carry the Source for the image anymore. The Source is provided by the new ImageSessionContext.java and only shared within the same thread to make things simpler and to avoid complex synchronization and cleanup. Image instances now indicate whether they are cacheable (not all Image instances are cacheable, for example when they just carry an InputStream). Moved the converter pipeline functionality into its own subpackage to keep "spi" clean. Added checks in ImageSize to detect incomplete Preloaders. ImageSource can now indicate whether its a fast source (loading from local file) or a slow source (loading over the network). (but this isn't used, yet) Fixed a bug in WMF and SVG preloaders: they didn't close their Sources after fully loading the images. Bugfix in ImageRawJPEG: it illegally reported being an EPS file ImageRawStream got an "InputStreamFactory" so it is possible to reuse raw images if they have been loaded into memory (or to a local file which hasn't been implemented, yet). The pipeline code now converts single-use raw images to reusable raw images when possible. But there's nothing built in to restrict the image size to a maximum, yet. Improved JPEG preloader so it can stop early an deal with images that have to APP0 segment. Images from digicams are such an example. They carry the resolution info in the EXIF block which is currently not interpreted. Fallback is to the configured source resolution. ------------------------------------------------------------------------ r600930 | jeremias | 2007-12-04 14:25:43 +0100 (Di, 04 Dez 2007) | 1 line Package HTML Files. ------------------------------------------------------------------------ r600934 | jeremias | 2007-12-04 14:34:41 +0100 (Di, 04 Dez 2007) | 1 line Javadoc fixes ------------------------------------------------------------------------ r602023 | jeremias | 2007-12-07 09:46:56 +0100 (Fr, 07 Dez 2007) | 2 lines Bugfix for bug in SVG preloader which didn't calculate the size of an SVG correctly when there's no explicit size. ------------------------------------------------------------------------ r602024 | jeremias | 2007-12-07 09:49:49 +0100 (Fr, 07 Dez 2007) | 1 line Some small javadoc and logging improvements/refinements. ------------------------------------------------------------------------ r602025 | jeremias | 2007-12-07 09:50:22 +0100 (Fr, 07 Dez 2007) | 1 line Enable assert keyword for javadoc production. ------------------------------------------------------------------------ r602032 | jeremias | 2007-12-07 09:59:10 +0100 (Fr, 07 Dez 2007) | 11 lines Added color space information and an optional ICC color profile to the basic Image interface. Reimplemented transparency support (for now only for ImageIO loader and PDF output) ImageIO preloader passes the already loaded metadata to the ImageIO loader through the "custom objects" so it doesn't have to load them again. PDF library: Corrected the naming of the method indicating the "bits per component" (bits per component != bits per pixel) PDF library: Added a method which lets a user override values in an XObject's dictionary after the major values have been set (useful not to make the PDFImage interface more complicated). PDF library: Support for gray transparent colors. PDF library: Added a convenience class for alpha channel bitmaps (AlphaRasterImage) Integration of the new image package into the PDFRenderer (currently supports all previous embedding methods except deprecated EPS embedding and CCITT embedding, now supports even more transparency options than before) ------------------------------------------------------------------------ r602033 | jeremias | 2007-12-07 09:59:57 +0100 (Fr, 07 Dez 2007) | 1 line Small optimization from my failed experiments to support native PNG embedding. ------------------------------------------------------------------------ r602034 | jeremias | 2007-12-07 10:01:34 +0100 (Fr, 07 Dez 2007) | 1 line Don't use "content" filter for ICC profiles. Instead compress using "default". "content" is for page content. ------------------------------------------------------------------------ r602036 | jeremias | 2007-12-07 10:02:25 +0100 (Fr, 07 Dez 2007) | 1 line Added general key for precompressed content of any kind. ------------------------------------------------------------------------ r602037 | jeremias | 2007-12-07 10:03:39 +0100 (Fr, 07 Dez 2007) | 1 line Various variants of the FOP logo for testing. Some of them have transparency info. ------------------------------------------------------------------------ r602228 | jeremias | 2007-12-07 22:30:17 +0100 (Fr, 07 Dez 2007) | 4 lines Discarded PreloaderPNG in favor of PreloaderImageIO which now supports all formats supported by ImageIO (meaning that you can uses JPEG-2000 images if you have a suitable ImageIO codec installed). ImagePreloader.getMimeType() removed because it isn't really used in the new setup. ImagePreloader.getPriority() introduced which allows to prioritize preloaders and thus gives the opportunity to tweak the order in which the preloaders are checked when an image is inspected. ImageLoaderImageIO can now use multiple Readers if one fails (one codec may not support all format variants, for example). ------------------------------------------------------------------------ r602229 | jeremias | 2007-12-07 22:30:48 +0100 (Fr, 07 Dez 2007) | 1 line Added a toString() impl for debugging. ------------------------------------------------------------------------ r602442 | jeremias | 2007-12-08 11:36:32 +0100 (Sa, 08 Dez 2007) | 6 lines Support handling images with no associated URI (from instream-foreign-object). These images are not cached. Add support for plain image conversion (i.e. with no loading) for instream-foreign-object. Add convenience writeTo() methods in ImageRawStream to save a few lines of code. Support for instream-foreign-object in RTF output. Teach RTF library to handle images without an associated URL. ------------------------------------------------------------------------ r603191 | jeremias | 2007-12-11 11:03:32 +0100 (Di, 11 Dez 2007) | 2 lines Bugfix: Graphics2DAdapter didn't do the graphics state save correct so subsequent images may have been painted with the wrong transformation matrix. Bugfix: bitmap images didn't scale correctly when the resolutions were changed. ------------------------------------------------------------------------ r603207 | jeremias | 2007-12-11 12:08:36 +0100 (Di, 11 Dez 2007) | 1 line Convenience method for obtaining the image size in points. ------------------------------------------------------------------------ r603208 | jeremias | 2007-12-11 12:12:50 +0100 (Di, 11 Dez 2007) | 3 lines Precisely define the expectations for the area parameter in Graphics2DImagePainter. New ImageConverter: Bitmap -> Graphics2D ------------------------------------------------------------------------ r603209 | jeremias | 2007-12-11 12:15:49 +0100 (Di, 11 Dez 2007) | 3 lines Refine pipeline building: Expose a method to allow the PS Renderer to predict what kind of pipeline will be selected (because it doesn't support all image types as PostScript forms) If there are multiple candidate pipelines for one conversion type, choose the one with the lowest penalty, not just the one that happens to be first. ------------------------------------------------------------------------ r603250 | jeremias | 2007-12-11 15:17:32 +0100 (Di, 11 Dez 2007) | 1 line Removing failed experiment: raw PNG embedding didn't work out. ------------------------------------------------------------------------ r603254 | jeremias | 2007-12-11 15:29:48 +0100 (Di, 11 Dez 2007) | 2 lines Plugged new image package into form generation for PostScript. XML images and EPS files are currently supported as forms. They are added inline. ------------------------------------------------------------------------ r603256 | jeremias | 2007-12-11 15:34:52 +0100 (Di, 11 Dez 2007) | 1 line Embedding EPS in PDF is no longer implemented as it is a deprecated feature in PDF. Therefore, this test is not needed anymore. The PDF renderer will say: "Cannot load image (no suitable loader/converter combination available) for myfile.eps (application/postscript)" ------------------------------------------------------------------------ r603266 | jeremias | 2007-12-11 16:16:22 +0100 (Di, 11 Dez 2007) | 1 line Size calculation for images can be slightly different after the redesign due to different rounding. Give a little tolerance. ------------------------------------------------------------------------ r603271 | jeremias | 2007-12-11 16:24:08 +0100 (Di, 11 Dez 2007) | 1 line Bugfix: Only generate the FixedLength if there is baseline information. ------------------------------------------------------------------------ r603358 | jeremias | 2007-12-11 22:13:22 +0100 (Di, 11 Dez 2007) | 1 line Switched background images to new image package. ------------------------------------------------------------------------ r603632 | jeremias | 2007-12-12 15:52:09 +0100 (Mi, 12 Dez 2007) | 1 line Switch to new image package for PDF/SVG support. ------------------------------------------------------------------------ r603642 | jeremias | 2007-12-12 16:30:16 +0100 (Mi, 12 Dez 2007) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-594557" from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ------------------------------------------------------------------------ r603656 | jeremias | 2007-12-12 17:13:06 +0100 (Mi, 12 Dez 2007) | 307 lines Merged revisions 594558-603642 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r594571 | vhennebert | 2007-11-13 17:24:32 +0100 (Di, 13 Nov 2007) | 7 lines Moved the creation of grid units to the FO tree building stage. Brought a few improvements along with the move: - bugfix: border-resolution for border-end on row-spanning cells was wrong - bugfix: in case of missing cells the border-end of the table was applied to an inner cell, instead of the cell in the last column (but missing cells aren't painted yet :-\) - bugfix: in collapsing-border model, border-before and -after specified on table-column were applied to every cell of the column, instead of only the first and the last ones - border resolution is now made progressively when possible, and no longer triggers the fetching of all the rows of the table Added testcases for the border conflict resolution (between the various elements of a table and not only the cells) ........ r594578 | vhennebert | 2007-11-13 17:50:09 +0100 (Di, 13 Nov 2007) | 2 lines Moved *GridUnit from layoutmgr/table to fo/flow/table ........ r594579 | vhennebert | 2007-11-13 17:55:54 +0100 (Di, 13 Nov 2007) | 2 lines Changed back visibility of fields from public to package-private, due to the move of *GridUnit in the fo.flow.table package ........ r594584 | vhennebert | 2007-11-13 18:13:19 +0100 (Di, 13 Nov 2007) | 2 lines Use a singleton for a default BorderInfo of style none, instead of every time a new instance ........ r594592 | vhennebert | 2007-11-13 18:39:17 +0100 (Di, 13 Nov 2007) | 2 lines Cleaned up RowGroupLayoutManager and TableRowIterator ........ r594821 | vhennebert | 2007-11-14 11:18:45 +0100 (Mi, 14 Nov 2007) | 2 lines Moved EffRow to the fo.flow.table package ........ r594829 | vhennebert | 2007-11-14 11:41:52 +0100 (Mi, 14 Nov 2007) | 2 lines Reduced visibility of some methods and constructors from public to package-private, as a consequence of the move of *GridUnit to the fo.flow.table package ........ r594836 | vhennebert | 2007-11-14 12:14:03 +0100 (Mi, 14 Nov 2007) | 2 lines Restored the setting of the parent table-row element on grid units ........ r594852 | vhennebert | 2007-11-14 13:21:53 +0100 (Mi, 14 Nov 2007) | 2 lines Restored the setting of rowIndex on primary grid units (although testcases were already working...) ........ r595297 | jeremias | 2007-11-15 14:28:58 +0100 (Do, 15 Nov 2007) | 2 lines Bugzilla #43143: Had to remove the Expert(Subset) Encoding detection as this caused problems with a barcode font that used dfCharset=2 but was not using ExpertSubset encoding. To detect Expert(Subset)Encoding, the AFM needs to be parsed. And since we don't support that encoding, yet, the fallback to WinAnsiEncoding should work well enough. ........ r595637 | acumiskey | 2007-11-16 13:12:52 +0100 (Fr, 16 Nov 2007) | 3 lines This should improve the ability of the FontLoader when resolving PFM files for Type 1 fonts on case sensitive Unix systems. ........ r596072 | jeremias | 2007-11-18 11:48:53 +0100 (So, 18 Nov 2007) | 4 lines ApacheCon US is over. OSSSummit was cancelled/postponed. Added example for total page count using XSL 1.1 Adjusted total page count example to new FOP API. (Thanks to Miroslav Gregan for the hint) ........ r596097 | jeremias | 2007-11-18 17:56:09 +0100 (So, 18 Nov 2007) | 6 lines Bugzilla #43605: Added methods for page-number-citation and page-number-citation-last in FOEventHandler.java Submitted by: V. Schappert <vschappert.at.bloomberg.net> Patch modified by Jeremias: Bugfix: FOEventHandler.startPageNumberCitation() was also called in the case of a page-number-citation-last. Introduced abstract base classes to avoid this. ........ r596100 | jeremias | 2007-11-18 18:17:24 +0100 (So, 18 Nov 2007) | 1 line Added sample as suggested by Kumar Puppala. ........ r596390 | vhennebert | 2007-11-19 19:25:27 +0100 (Mo, 19 Nov 2007) | 2 lines Bugzilla #43766: breaks generated by the merging algorithm for table rows containing empty cells has always a penalty of 900 ........ r596554 | jeremias | 2007-11-20 08:14:33 +0100 (Di, 20 Nov 2007) | 2 lines Bugzilla #43904: Buffer the OutputStreams in our transcoders if the users forget. ........ r596600 | jeremias | 2007-11-20 11:20:29 +0100 (Di, 20 Nov 2007) | 3 lines Bugzilla #43910: Avoid a NullPointerException in AreaTreeHandler.endDocument(). Submitted by: David Delbecq <delbd.at.oma.be> ........ r596724 | jeremias | 2007-11-20 16:56:33 +0100 (Di, 20 Nov 2007) | 3 lines Bugfix: Bugfix for URI resolution: Make StreamSources without system identifier work again. Bugfix: Close streams opened by test font resolution in font configuration (the font URIs will be resolved again later anyway). Better error message when the loading of font metric files doesn't work due to missing information in the returned Source instances. ........ r596727 | vhennebert | 2007-11-20 17:07:32 +0100 (Di, 20 Nov 2007) | 2 lines Bugfix in tables: wrong element generation by the merging algorithm when glues must be produced to cope with conditional spaces. The corresponding length was added twice: one in the glue itself and one in the following box. ........ r596739 | cbowditch | 2007-11-20 17:49:13 +0100 (Di, 20 Nov 2007) | 1 line bug fix: memory leak in PropertyCache. Fix provided by Jeremias. There are still some thread synchronization issues to be addressed in the PropertyCache. See the following thread for details: http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-dev/200711.mbox/%3cBAY117-DAV109E36CC066889386AB917FB870@phx.gbl%3e ........ r596742 | vhennebert | 2007-11-20 18:08:46 +0100 (Di, 20 Nov 2007) | 2 lines Added a news entry about Max Berger becoming a committer. Welcome Max! ........ r596776 | vhennebert | 2007-11-20 19:47:39 +0100 (Di, 20 Nov 2007) | 2 lines Bugzilla #43803: table cells having no children are allowed in relaxed validation mode. ........ r597052 | vhennebert | 2007-11-21 13:23:59 +0100 (Mi, 21 Nov 2007) | 2 lines Bugfix: the last element generated by the merging algorithm may now be a glue ........ r597448 | jeremias | 2007-11-22 17:13:05 +0100 (Do, 22 Nov 2007) | 2 lines First draft of a possible new intermediate format for Apache FOP. Details on: http://wiki.apache.org/xmlgraphics-fop/AreaTreeIntermediateXml/NewDesign ........ r598558 | jeremias | 2007-11-27 09:36:23 +0100 (Di, 27 Nov 2007) | 6 lines Bugzilla #40230: Bugfix: no empty page is generated anymore if there's no content after a break-after. Bugzilla #43917: Bugfix for border-after painting and element list generation when a forced break is involved. ........ r599536 | vhennebert | 2007-11-29 19:31:13 +0100 (Do, 29 Nov 2007) | 4 lines Added fixes-bug attributes for: - wrong element generation in table when glues are produced - border-resolution on row-spanning cells ........ r599746 | jeremias | 2007-11-30 10:04:54 +0100 (Fr, 30 Nov 2007) | 2 lines Bugzilla #37993: Bugfix: allow multiple bookmarks to point at the same destination. ........ r600195 | adelmelle | 2007-12-01 22:11:53 +0100 (Sa, 01 Dez 2007) | 1 line Correction and simplification of the PropertyCache: subclass WeakReference and remove internal threading ........ r600467 | jeremias | 2007-12-03 11:16:27 +0100 (Mo, 03 Dez 2007) | 2 lines Log RuntimeExceptions during rendering so that they are at least visible somewhere if someone doesn't set an ErrorListener on the XSLT processor (this could lead to exceptions being swallowed). This is a temporary measure until we have time to improve the exception handling in FOP. The original problem that led to this change was: "The number of this PDFNumber must not be empty" while producing a PDF/A with customized filter entries in the PDF configuration. The exception was a follow-up exception after a PDFConformanceException that was swallowed by a default ErrorListener. ........ r600521 | jeremias | 2007-12-03 14:21:06 +0100 (Mo, 03 Dez 2007) | 1 line Added a possibility to rerun the whole run a defined number of times to test for possible issues outside a single rendering run. ........ r600529 | jeremias | 2007-12-03 14:32:04 +0100 (Mo, 03 Dez 2007) | 1 line Oops. ........ r601413 | vhennebert | 2007-12-05 17:56:47 +0100 (Mi, 05 Dez 2007) | 2 lines Typo in property: svn:kewords -> svn:keywords ........ r601415 | acumiskey | 2007-12-05 18:11:44 +0100 (Mi, 05 Dez 2007) | 2 lines Corrected javadocs ........ r601416 | acumiskey | 2007-12-05 18:12:54 +0100 (Mi, 05 Dez 2007) | 2 lines Corrected javadoc ........ r601417 | acumiskey | 2007-12-05 18:13:31 +0100 (Mi, 05 Dez 2007) | 2 lines Corrected javadoc ........ r601419 | acumiskey | 2007-12-05 18:15:46 +0100 (Mi, 05 Dez 2007) | 2 lines Improved use of logging ........ r601423 | acumiskey | 2007-12-05 18:19:43 +0100 (Mi, 05 Dez 2007) | 2 lines Corrected javadoc, fixed checkstyle issues, and now also correctly caters for negative number conversions ........ r601424 | acumiskey | 2007-12-05 18:21:15 +0100 (Mi, 05 Dez 2007) | 2 lines Fixed checkstyle issues ........ r601426 | acumiskey | 2007-12-05 18:24:15 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601427 | acumiskey | 2007-12-05 18:25:07 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601428 | acumiskey | 2007-12-05 18:25:58 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601429 | acumiskey | 2007-12-05 18:27:06 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601430 | acumiskey | 2007-12-05 18:28:03 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601431 | acumiskey | 2007-12-05 18:28:48 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601432 | acumiskey | 2007-12-05 18:29:31 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601433 | acumiskey | 2007-12-05 18:30:04 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601434 | acumiskey | 2007-12-05 18:31:20 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601435 | acumiskey | 2007-12-05 18:32:29 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601436 | acumiskey | 2007-12-05 18:34:44 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601437 | acumiskey | 2007-12-05 18:35:31 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601438 | acumiskey | 2007-12-05 18:36:12 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes and cleanup ........ r601439 | acumiskey | 2007-12-05 18:37:40 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601440 | acumiskey | 2007-12-05 18:39:54 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601442 | acumiskey | 2007-12-05 18:42:13 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601443 | acumiskey | 2007-12-05 18:42:48 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601444 | acumiskey | 2007-12-05 18:43:46 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601445 | acumiskey | 2007-12-05 18:44:36 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601446 | acumiskey | 2007-12-05 18:45:20 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601447 | acumiskey | 2007-12-05 18:47:44 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601448 | acumiskey | 2007-12-05 18:48:56 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601449 | acumiskey | 2007-12-05 18:49:46 +0100 (Mi, 05 Dez 2007) | 2 lines Checkstyle fixes ........ r601712 | acumiskey | 2007-12-06 12:57:14 +0100 (Do, 06 Dez 2007) | 2 lines Temporary fix to the build ........ r602045 | jeremias | 2007-12-07 10:20:28 +0100 (Fr, 07 Dez 2007) | 1 line Avoid a NPE in toString(). ........ r602125 | maxberger | 2007-12-07 16:36:53 +0100 (Fr, 07 Dez 2007) | 6 lines Updated xmlgraphics from SVN Added autodetection of fonts in jar files (x-font and x-font-truetype) Added files needed for testcase Please note: Actual testcase is still missing! ........ r602898 | maxberger | 2007-12-10 14:35:33 +0100 (Mo, 10 Dez 2007) | 2 lines Added documentation for font-in-jar-files ........ r603590 | acumiskey | 2007-12-12 13:24:10 +0100 (Mi, 12 Dez 2007) | 4 lines * Added an SVG handler and Graphics2D implementation for AFP which injects AFP GOCA structured fields into the AFPDataStream. * Fixed many checkstyle problems. * Updated xmlgraphics-commons-1.3svn.jar to include changes to TextHandler ........ r603592 | acumiskey | 2007-12-12 13:26:39 +0100 (Mi, 12 Dez 2007) | 2 lines Updated status with SVG support for AFP. ........ ------------------------------------------------------------------------ r603661 | jeremias | 2007-12-12 17:20:09 +0100 (Mi, 12 Dez 2007) | 1 line Fix javadoc ------------------------------------------------------------------------ r603886 | jeremias | 2007-12-13 12:15:48 +0100 (Do, 13 Dez 2007) | 1 line Copy/paste programming is dangerous. :-) ------------------------------------------------------------------------ r603902 | jeremias | 2007-12-13 13:17:56 +0100 (Do, 13 Dez 2007) | 2 lines Factored out all image handling code in the PDFRenderer into PDFImageHandler classes. The interface was introduced to handle PDF-in-PDF images. The PDFImageHandler interface changes in a backwards-incompatible way but since the PDF-in-PDF plug-in probably has the only implementation, that's not very problematic. I'll release a new version as soon as the image stuff is merged back into Trunk. ------------------------------------------------------------------------ r603937 | jeremias | 2007-12-13 16:20:46 +0100 (Do, 13 Dez 2007) | 1 line Some cleanup ------------------------------------------------------------------------ r603938 | jeremias | 2007-12-13 16:23:23 +0100 (Do, 13 Dez 2007) | 2 lines Switch PCL renderer to new image package. Add an option to force a color canvas (RGB) instead of a gray canvas. Set this to true for all SVG graphics since Batik does not seem to support gradients on a grayscale canvas (IllegalArgumentException). ------------------------------------------------------------------------ r604122 | jeremias | 2007-12-14 08:58:56 +0100 (Fr, 14 Dez 2007) | 1 line Stupid copy/paste again. ------------------------------------------------------------------------ r604135 | jeremias | 2007-12-14 10:04:43 +0100 (Fr, 14 Dez 2007) | 1 line Preliminary changes to switch to the new image library. TIFF optimizations still missing. Untested. ------------------------------------------------------------------------ r604144 | jeremias | 2007-12-14 11:12:41 +0100 (Fr, 14 Dez 2007) | 1 line Switch to new image package. At some point we will probably want to remove this example as JEuclid has a better plug-in now. ------------------------------------------------------------------------ r604150 | jeremias | 2007-12-14 11:27:39 +0100 (Fr, 14 Dez 2007) | 1 line Old JEuclid doesn't notice itself if no MathML document is loaded. ------------------------------------------------------------------------ r604155 | jeremias | 2007-12-14 11:48:07 +0100 (Fr, 14 Dez 2007) | 2 lines Switched to new image package. The preloader simply loads the full document and converts it to SVG. That's the only way to determine the intrinsic size of the image. ------------------------------------------------------------------------ r604157 | jeremias | 2007-12-14 11:51:21 +0100 (Fr, 14 Dez 2007) | 1 line No longer needed. ------------------------------------------------------------------------ r604214 | jeremias | 2007-12-14 17:07:30 +0100 (Fr, 14 Dez 2007) | 1 line Added work-around for decoding CMYK JPEGs with ImageIO (no guarantees for color fidelity but it's better than not being able to use CMYK images). ------------------------------------------------------------------------ r604297 | jeremias | 2007-12-14 22:14:12 +0100 (Fr, 14 Dez 2007) | 68 lines Merged revisions 603643-604293 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r603890 | vhennebert | 2007-12-13 12:35:17 +0100 (Do, 13 Dez 2007) | 2 lines Fixed @throws statements in javadoc ........ r603926 | adelmelle | 2007-12-13 15:43:08 +0100 (Do, 13 Dez 2007) | 4 lines Minor tweaks: * only add text to a fo:wrapper if it is not a direct flow-descendant * error if an fo:wrapper that is a direct flow-descendant contains inline-level children ........ r603943 | vhennebert | 2007-12-13 16:55:29 +0100 (Do, 13 Dez 2007) | 2 lines Removed calls to removeLegalBreaks since they aren't necessary (the whole content is put in a single box anyway) and the method is buggy. ........ r603945 | vhennebert | 2007-12-13 17:10:32 +0100 (Do, 13 Dez 2007) | 2 lines Implemented the resolution of collapsing borders in the FO tree, for every situation (normal, cell at the top of a page, cell broken), taking conditionality, headers and footers into account. ........ r603959 | vhennebert | 2007-12-13 18:21:24 +0100 (Do, 13 Dez 2007) | 2 lines Reverted change accidentally introduced in the previous commit. A proper fix needs to be found for this one. ........ r603961 | vhennebert | 2007-12-13 18:31:26 +0100 (Do, 13 Dez 2007) | 2 lines Ok, now /really/ revert the previous commit :-\ ........ r603962 | vhennebert | 2007-12-13 18:32:43 +0100 (Do, 13 Dez 2007) | 2 lines Style only: removed trailing white spaces ........ r603968 | vhennebert | 2007-12-13 19:28:56 +0100 (Do, 13 Dez 2007) | 2 lines Fixed the handling of columns in the border resolution, especially in case of column-spanning cells ........ r603975 | vhennebert | 2007-12-13 19:52:48 +0100 (Do, 13 Dez 2007) | 2 lines Removed parameter from the endPart method, since the part is already passed as a parameter of the previously called startPart method ........ r603979 | vhennebert | 2007-12-13 19:57:25 +0100 (Do, 13 Dez 2007) | 2 lines Removed parameter from the endTablePart method, as the part is already passed as as a parameter of the previously called startTablePart method ........ r603990 | vhennebert | 2007-12-13 20:17:12 +0100 (Do, 13 Dez 2007) | 2 lines Throw a ValidationException if table-footer is put after table-body and the table uses the collapsing border model. The footer must be known to properly resolve borders. ........ r604171 | vhennebert | 2007-12-14 12:32:51 +0100 (Fr, 14 Dez 2007) | 2 lines Clean up: removed all reset and resetPosition methods, which pre-date the Knuth era and are no longer needed ........ r604180 | vhennebert | 2007-12-14 13:23:10 +0100 (Fr, 14 Dez 2007) | 2 lines Reduced visibility of methods from public to package-private ........ r604185 | acumiskey | 2007-12-14 14:16:06 +0100 (Fr, 14 Dez 2007) | 2 lines Fixed copy constructor ........ r604293 | jeremias | 2007-12-14 21:58:53 +0100 (Fr, 14 Dez 2007) | 2 lines Bugfix: DecodeParms -> DecodeParams (introduced when I changed to generic PDF structures) (fixes CCITT encoded images) ........ ------------------------------------------------------------------------ r604301 | jeremias | 2007-12-14 22:26:27 +0100 (Fr, 14 Dez 2007) | 9 lines Merged revisions 604294-604299 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r604299 | jeremias | 2007-12-14 22:24:14 +0100 (Fr, 14 Dez 2007) | 1 line Don't hack when you're tired! Reverting r604293 and instead fixing the right value. It's DecodeParams -> DecodeParms! ........ ------------------------------------------------------------------------ r604930 | jeremias | 2007-12-17 18:05:47 +0100 (Mo, 17 Dez 2007) | 2 lines Dispose ImageReader when done reading. Don't close streams as some codecs appear to do "late reading" of the image, i.e. only when the rasters are accessed, at which point they still seek on the stream. For this, the streams must remain open. I hope the codecs all properly close the streams once they don't need them anymore. The javadocs are not clear enough in this regards, IMO. ------------------------------------------------------------------------ r604968 | jeremias | 2007-12-17 20:03:45 +0100 (Mo, 17 Dez 2007) | 3 lines Added an isSupported() method to ImageLoaderFactory so we can check early if an ImageLoader may or may not support a particular subformat. This is used to allow optimized loading of CCITT compressed TIFF images. Support for undecoded embedding of single-strip CCITT compressed images for PDF, PostScript and AFP. Added a fallback mechanism for ImageLoaders: if one ImageLoader cannot load a particular image, try equivalent others registered for the same format. ------------------------------------------------------------------------ r604972 | jeremias | 2007-12-17 20:07:43 +0100 (Mo, 17 Dez 2007) | 1 line Update Commons ------------------------------------------------------------------------ r605138 | jeremias | 2007-12-18 09:42:41 +0100 (Di, 18 Dez 2007) | 2 lines Support for specifying a particular page number of a multi-page image (such as TIFF). Format: http://localhost/images/scan1.tif#page=3 ------------------------------------------------------------------------ r605479 | jeremias | 2007-12-19 10:18:33 +0100 (Mi, 19 Dez 2007) | 3 lines Removed new image package after the copying it to XML Graphics Commons. Adjusted to use the Commons' version. Batik-dependent plugins remain but will eventually need a different resting place. ------------------------------------------------------------------------ r605486 | jeremias | 2007-12-19 10:39:33 +0100 (Mi, 19 Dez 2007) | 1 line Adjust the (pre)loader registration for the demo extensions. ------------------------------------------------------------------------ r605567 | jeremias | 2007-12-19 16:03:25 +0100 (Mi, 19 Dez 2007) | 1 line Fixed scaling and translation (didn't work correctly in certain situations) ------------------------------------------------------------------------ r607034 | jeremias | 2007-12-27 11:47:12 +0100 (Do, 27 Dez 2007) | 71 lines Merged revisions 604300-607033 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r604475 | vhennebert | 2007-12-15 19:16:01 +0100 (Sa, 15 Dez 2007) | 2 lines Testcase for the resolution of collapsed and conditional borders in the FO tree ........ r604678 | adelmelle | 2007-12-16 20:54:00 +0100 (So, 16 Dez 2007) | 8 lines Streamlining/Correction of the changes made in r603926 - delegate validation of the fo:wrapper's children to the parent: added static FONode.validateChildNode() - narrow the condition for processing text-childnodes: this is not only constrained to fo:flow and fo:static-content, but the same goes for a fo:wrapper that is a direct descendant of a fo:block-container or fo:inline-container, which only allow block-level content (interpretation) - minor javadoc fixups/improvements ........ r604814 | vhennebert | 2007-12-17 11:21:04 +0100 (Mo, 17 Dez 2007) | 2 lines Organized imports ........ r604965 | vhennebert | 2007-12-17 19:56:46 +0100 (Mo, 17 Dez 2007) | 2 lines Renaming GridUnitPart into the more accurate CellPart. Moreover I was always making the confusion between gup and pgu ........ r604970 | vhennebert | 2007-12-17 20:05:27 +0100 (Mo, 17 Dez 2007) | 2 lines Simplified addAreasAndFlushRow: there can no longer be null GridUnits, every hole in the grid is now filled with an EmptyGridUnit ........ r605195 | vhennebert | 2007-12-18 12:56:38 +0100 (Di, 18 Dez 2007) | 2 lines Reset previousRowsLength before a new row-group is handled ........ r605246 | vhennebert | 2007-12-18 17:48:03 +0100 (Di, 18 Dez 2007) | 2 lines Simplification in RowPainter: avoid the use of an array to store rowOffsets and firstRow index for each part of the table (header, footer, body). One at a time is enough. ........ r605253 | vhennebert | 2007-12-18 18:01:45 +0100 (Di, 18 Dez 2007) | 2 lines Renamed firstRow into firstRowIndex and moved its initialization into handeTableContentPosition ........ r605295 | vhennebert | 2007-12-18 19:58:29 +0100 (Di, 18 Dez 2007) | 2 lines Streamlined the recording of row offsets, by replacing Map with a List. Fixed bug #43633 in the same time. ........ r605297 | vhennebert | 2007-12-18 20:02:02 +0100 (Di, 18 Dez 2007) | 3 lines SVG support for AFP is an important addition IMO. IIUC it will have to be advertised in the next release as "Support for SVG images using primitive AFP graphics commands instead of bitmap images", or something like that? ........ r605517 | vhennebert | 2007-12-19 12:47:38 +0100 (Mi, 19 Dez 2007) | 2 lines I said currentGU can no longer be null ........ r605978 | jeremias | 2007-12-20 18:00:46 +0100 (Do, 20 Dez 2007) | 1 line Remove commented code. ........ r606004 | jeremias | 2007-12-20 20:19:19 +0100 (Do, 20 Dez 2007) | 1 line Added support for scale-down-to-fit and scale-up-to-fit. ........ r607032 | jeremias | 2007-12-27 11:34:15 +0100 (Do, 27 Dez 2007) | 4 lines Added new extension element: fox:external-document. It allows to add whole documents such as multi-page TIFF images to be inserted as peers to a page-sequence. Each image will make up an entire page. See the documentation for details. ATM, only single pages are possible. Multi-page images will be supported with the new image package. Some preparations for page-position="only" but the implementation is incomplete and "only" has no effect, yet. (Just uploaded some stuff I once started) Some javadoc cleanups. ........ ------------------------------------------------------------------------ r607091 | jeremias | 2007-12-27 18:13:45 +0100 (Do, 27 Dez 2007) | 1 line Avoid cutting away the URI fragment when building URLs from filenames. ------------------------------------------------------------------------ r607092 | jeremias | 2007-12-27 18:15:49 +0100 (Do, 27 Dez 2007) | 3 lines Switched fox:external-document to new image package. Added multi-page support for fox:external-document. Changed multi-page.tiff: page 4 is now bigger than all other pages. (to make sure that individually sized pages are handled properly) ------------------------------------------------------------------------ r607188 | jeremias | 2007-12-28 09:38:26 +0100 (Fr, 28 Dez 2007) | 2 lines Throwing IllegalStateException causes a prior exception to be swallowed by Xalan-J. Need to throw a SAXException instead. Instead of logging an error about the element mismatch throw a SAXException because the logging only confuses the user as it's practically always a follow-up exception of an exception happening earlier in the respective startElement() event. ------------------------------------------------------------------------ r607249 | jeremias | 2007-12-28 15:27:39 +0100 (Fr, 28 Dez 2007) | 1 line Metadata didn't get transported to the renderer when only fox:external-document is used. ------------------------------------------------------------------------ r607256 | jeremias | 2007-12-28 16:06:35 +0100 (Fr, 28 Dez 2007) | 1 line Corrected content model. ------------------------------------------------------------------------ r607261 | jeremias | 2007-12-28 16:11:56 +0100 (Fr, 28 Dez 2007) | 1 line Added -imagein to command-line so (multi-page) images such as TIFF files can be converted to PDF and other formats supported by FOP. The default stylesheet can be overwritten (with -xslt) if desired. ------------------------------------------------------------------------ r609530 | jeremias | 2008-01-07 09:16:09 +0100 (Mo, 07 Jan 2008) | 1 line Fixed copy/paste mistake. Thanks for spotting it, Vincent. ------------------------------------------------------------------------ r609600 | jeremias | 2008-01-07 14:28:53 +0100 (Mo, 07 Jan 2008) | 1 line Removed "image2" package again and moved the Batik-dependent implementations under the old "image" package. In this form, the deprecated code doesn't conflict with the new implementations anymore. ------------------------------------------------------------------------ r610029 | jeremias | 2008-01-08 16:48:53 +0100 (Di, 08 Jan 2008) | 3 lines Added minimal support for the .minimum/.maximum components of block/inline-progression-dimension on fo:external-graphic and fo:instream-foreign-object. This will only constrain the image itself but not allow the layout engine itself to resize the image as seen fit. Added missing Javadocs in ImageLayout.java. ------------------------------------------------------------------------ r611120 | jeremias | 2008-01-11 10:20:57 +0100 (Fr, 11 Jan 2008) | 100 lines Merged revisions 607034-611115 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r607036 | jeremias | 2007-12-27 11:51:11 +0100 (Do, 27 Dez 2007) | 1 line Don't just exit with no error message if the document contains no content. Pretty irritating if it does so. ........ r608812 | acumiskey | 2008-01-04 13:14:33 +0100 (Fr, 04 Jan 2008) | 3 lines The fonts variable would have always had an empty Configuration node (non-null value) even if a <fonts/> wasn't present in the fop configuration. ........ r609567 | jeremias | 2008-01-07 11:52:09 +0100 (Mo, 07 Jan 2008) | 4 lines Reenabled documentation for fox:destination. Enabled intermediate format functionality for fox:destination. Added a test case to check fox:destination. Deprecated FOP's XMLizable in favor of the XML Graphics Commons variant (and extend that variant). ........ r609627 | jeremias | 2008-01-07 16:06:24 +0100 (Mo, 07 Jan 2008) | 5 lines Bugzilla #44176: Support for custom fonts in Java2DRenderer and derived renderers. Submitted by: Patrick Jaromin <patrick.at.jgsullivan.dot.com> Patch modified slightly by jeremias. ........ r610020 | acumiskey | 2008-01-08 16:27:02 +0100 (Di, 08 Jan 2008) | 2 lines cleaned up ........ r610021 | acumiskey | 2008-01-08 16:28:56 +0100 (Di, 08 Jan 2008) | 2 lines Appears to be unused/referenced and superceeded by PageGroup ........ r610022 | acumiskey | 2008-01-08 16:34:07 +0100 (Di, 08 Jan 2008) | 2 lines cleaned up ........ r610023 | acumiskey | 2008-01-08 16:35:18 +0100 (Di, 08 Jan 2008) | 2 lines fixed javadoc ........ r610337 | vhennebert | 2008-01-09 12:02:08 +0100 (Mi, 09 Jan 2008) | 2 lines Fixed checkstyle issues: tabs and trailing spaces ........ r610355 | vhennebert | 2008-01-09 13:01:21 +0100 (Mi, 09 Jan 2008) | 2 lines keep-together is an inherited property ........ r610420 | acumiskey | 2008-01-09 16:40:25 +0100 (Mi, 09 Jan 2008) | 2 lines cleanup ........ r610704 | jeremias | 2008-01-10 08:38:47 +0100 (Do, 10 Jan 2008) | 1 line Added basic support for PDF page labels. ........ r610739 | jeremias | 2008-01-10 11:13:21 +0100 (Do, 10 Jan 2008) | 1 line PostScript output now generates the bounding box DSC comments for the whole document. ........ r610821 | vhennebert | 2008-01-10 16:53:20 +0100 (Do, 10 Jan 2008) | 4 lines - renamed variables for clarity - moved the computation of a cell's content length in PrimaryGridUnit - better javadoc for getHeight method in EffRow ........ r610848 | vhennebert | 2008-01-10 18:41:52 +0100 (Do, 10 Jan 2008) | 2 lines No need to check if the end of the cell is reached when creating the areas for a row ........ r610853 | vhennebert | 2008-01-10 18:54:16 +0100 (Do, 10 Jan 2008) | 2 lines Simplified addAreasAndFlushRow ........ r610886 | vhennebert | 2008-01-10 20:23:56 +0100 (Do, 10 Jan 2008) | 2 lines Removed endPart() method and moved its content into addAreasAndFlushRow() ........ r610891 | vhennebert | 2008-01-10 20:34:13 +0100 (Do, 10 Jan 2008) | 2 lines Removed accumulatedBPD which is redundant with yoffset ........ r610893 | vhennebert | 2008-01-10 20:35:24 +0100 (Do, 10 Jan 2008) | 2 lines The return value of addAreasAndFlushRow is never used, changed it to void ........ r610905 | vhennebert | 2008-01-10 20:57:29 +0100 (Do, 10 Jan 2008) | 2 lines Renamed lastRow into currentRow and yoffset into currentRowOffset ........ r611114 | jeremias | 2008-01-11 10:04:28 +0100 (Fr, 11 Jan 2008) | 2 lines Bugfix: Some string objects were not encrypted (for example in named destinations) I had to refactor the PDF library a little bit but since it only affects the inner API it shouldn't be a problem that I removed some methods which caused trouble because a didn't think about encryption when I worked on the PDF library last year. ........ ------------------------------------------------------------------------ r611133 | jeremias | 2008-01-11 11:45:01 +0100 (Fr, 11 Jan 2008) | 4 lines Fixed merge problems. Fixed a NPE when a mask is null in BitmapImage.java Add support for properly encoding binary data as a hexadecimal string object (including encryption). Adjust palette generation for indexed bitmaps to work correctly with encryption. ------------------------------------------------------------------------ r611138 | jeremias | 2008-01-11 11:59:27 +0100 (Fr, 11 Jan 2008) | 1 line Removed empty package. ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@611278 13f79535-47bb-0310-9956-ffa450edef68
16 years ago
* PDFImageHandler interface split into ImageHandler and PDFImageHandler. * Deleted AFPDataObjectInfoProvider and AFPImage*Factory implementations, and abstracted AbstractImageHandlerRegistry from PDFImageHandlerRegistry, creating AFPImageHandlerRegistry and AFPImageHandler so there is a common reuse of image handling implementation between AFP and PDF now. * RendererContext instantiation is now overridable in PrintRenderer. * Created AFPRendererContext that is able to provide AFPInfo. * toString() added to RendererContext for ease of use. * Removed GraphicsObjectPainterAFP. * Added package.html for AFP (sub)packages. * Abstracted AbstractFOPBridgeContext from PDFBridgeContext and provided AFPBridgeContext implementation. * Abstracted AbstractFOPTextElementBridge from PDFTextElementBridge and provided AFPTextElementBridge implementation. * Abstracted AbstractFOPImageElementBridge from PDFImageElementBridge and provided AFPImageElementBridge implementation. * Provided inline image support/handling in AFPGraphics2D for SVG. * Created NativeImageHandler interface. * Fix for path iterator filled line drawing in AFPGraphics2D adding coordinate drawing implementations GraphicsLineRelative and GraphicsFilletRelative (Thanks for the patch Jeremias). * Improved configuration.xml documentation for images mode/native setting in AFP renderer configuration. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@713747 13f79535-47bb-0310-9956-ffa450edef68
15 years ago
* PDFImageHandler interface split into ImageHandler and PDFImageHandler. * Deleted AFPDataObjectInfoProvider and AFPImage*Factory implementations, and abstracted AbstractImageHandlerRegistry from PDFImageHandlerRegistry, creating AFPImageHandlerRegistry and AFPImageHandler so there is a common reuse of image handling implementation between AFP and PDF now. * RendererContext instantiation is now overridable in PrintRenderer. * Created AFPRendererContext that is able to provide AFPInfo. * toString() added to RendererContext for ease of use. * Removed GraphicsObjectPainterAFP. * Added package.html for AFP (sub)packages. * Abstracted AbstractFOPBridgeContext from PDFBridgeContext and provided AFPBridgeContext implementation. * Abstracted AbstractFOPTextElementBridge from PDFTextElementBridge and provided AFPTextElementBridge implementation. * Abstracted AbstractFOPImageElementBridge from PDFImageElementBridge and provided AFPImageElementBridge implementation. * Provided inline image support/handling in AFPGraphics2D for SVG. * Created NativeImageHandler interface. * Fix for path iterator filled line drawing in AFPGraphics2D adding coordinate drawing implementations GraphicsLineRelative and GraphicsFilletRelative (Thanks for the patch Jeremias). * Improved configuration.xml documentation for images mode/native setting in AFP renderer configuration. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@713747 13f79535-47bb-0310-9956-ffa450edef68
15 years ago
* PDFImageHandler interface split into ImageHandler and PDFImageHandler. * Deleted AFPDataObjectInfoProvider and AFPImage*Factory implementations, and abstracted AbstractImageHandlerRegistry from PDFImageHandlerRegistry, creating AFPImageHandlerRegistry and AFPImageHandler so there is a common reuse of image handling implementation between AFP and PDF now. * RendererContext instantiation is now overridable in PrintRenderer. * Created AFPRendererContext that is able to provide AFPInfo. * toString() added to RendererContext for ease of use. * Removed GraphicsObjectPainterAFP. * Added package.html for AFP (sub)packages. * Abstracted AbstractFOPBridgeContext from PDFBridgeContext and provided AFPBridgeContext implementation. * Abstracted AbstractFOPTextElementBridge from PDFTextElementBridge and provided AFPTextElementBridge implementation. * Abstracted AbstractFOPImageElementBridge from PDFImageElementBridge and provided AFPImageElementBridge implementation. * Provided inline image support/handling in AFPGraphics2D for SVG. * Created NativeImageHandler interface. * Fix for path iterator filled line drawing in AFPGraphics2D adding coordinate drawing implementations GraphicsLineRelative and GraphicsFilletRelative (Thanks for the patch Jeremias). * Improved configuration.xml documentation for images mode/native setting in AFP renderer configuration. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@713747 13f79535-47bb-0310-9956-ffa450edef68
15 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.svg;
  19. import java.awt.AlphaComposite;
  20. import java.awt.BasicStroke;
  21. import java.awt.Color;
  22. import java.awt.Dimension;
  23. import java.awt.GradientPaint;
  24. import java.awt.Graphics;
  25. import java.awt.Graphics2D;
  26. import java.awt.GraphicsConfiguration;
  27. import java.awt.Image;
  28. import java.awt.Paint;
  29. import java.awt.PaintContext;
  30. import java.awt.Rectangle;
  31. import java.awt.Shape;
  32. import java.awt.Stroke;
  33. import java.awt.color.ColorSpace;
  34. import java.awt.geom.AffineTransform;
  35. import java.awt.geom.PathIterator;
  36. import java.awt.geom.Point2D;
  37. import java.awt.geom.Rectangle2D;
  38. import java.awt.image.BufferedImage;
  39. import java.awt.image.ColorModel;
  40. import java.awt.image.DataBuffer;
  41. import java.awt.image.DirectColorModel;
  42. import java.awt.image.ImageObserver;
  43. import java.awt.image.Raster;
  44. import java.awt.image.RenderedImage;
  45. import java.awt.image.WritableRaster;
  46. import java.awt.image.renderable.RenderableImage;
  47. import java.io.IOException;
  48. import java.io.OutputStream;
  49. import java.io.StringWriter;
  50. import java.util.List;
  51. import java.util.Map;
  52. import org.apache.batik.ext.awt.LinearGradientPaint;
  53. import org.apache.batik.ext.awt.MultipleGradientPaint;
  54. import org.apache.batik.ext.awt.RadialGradientPaint;
  55. import org.apache.batik.ext.awt.RenderingHintsKeyExt;
  56. import org.apache.batik.gvt.GraphicsNode;
  57. import org.apache.batik.gvt.PatternPaint;
  58. import org.apache.xmlgraphics.image.GraphicsConstants;
  59. import org.apache.xmlgraphics.image.loader.ImageInfo;
  60. import org.apache.xmlgraphics.image.loader.ImageSize;
  61. import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
  62. import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG;
  63. import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
  64. import org.apache.xmlgraphics.java2d.AbstractGraphics2D;
  65. import org.apache.xmlgraphics.java2d.GraphicContext;
  66. import org.apache.fop.fonts.Font;
  67. import org.apache.fop.fonts.FontInfo;
  68. import org.apache.fop.fonts.FontSetup;
  69. import org.apache.fop.pdf.BitmapImage;
  70. import org.apache.fop.pdf.PDFAnnotList;
  71. import org.apache.fop.pdf.PDFColor;
  72. import org.apache.fop.pdf.PDFColorHandler;
  73. import org.apache.fop.pdf.PDFConformanceException;
  74. import org.apache.fop.pdf.PDFDeviceColorSpace;
  75. import org.apache.fop.pdf.PDFDocument;
  76. import org.apache.fop.pdf.PDFGState;
  77. import org.apache.fop.pdf.PDFImage;
  78. import org.apache.fop.pdf.PDFImageXObject;
  79. import org.apache.fop.pdf.PDFLink;
  80. import org.apache.fop.pdf.PDFNumber;
  81. import org.apache.fop.pdf.PDFPaintingState;
  82. import org.apache.fop.pdf.PDFPattern;
  83. import org.apache.fop.pdf.PDFResourceContext;
  84. import org.apache.fop.pdf.PDFResources;
  85. import org.apache.fop.pdf.PDFText;
  86. import org.apache.fop.pdf.PDFXObject;
  87. import org.apache.fop.render.pdf.ImageRawCCITTFaxAdapter;
  88. import org.apache.fop.render.pdf.ImageRawJPEGAdapter;
  89. import org.apache.fop.render.pdf.ImageRenderedAdapter;
  90. /**
  91. * <p>PDF Graphics 2D.
  92. * Used for drawing into a pdf document as if it is a graphics object.
  93. * This takes a pdf document and draws into it.</p>
  94. *
  95. * <p>This work was authored by Keiron Liddle (keiron@aftexsw.com).</p>
  96. *
  97. * @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
  98. */
  99. public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHandler {
  100. private static final AffineTransform IDENTITY_TRANSFORM = new AffineTransform();
  101. /** The number of decimal places. */
  102. private static final int DEC = 8;
  103. /** Convenience constant for full opacity */
  104. static final int OPAQUE = 255;
  105. /**
  106. * the PDF Document being created
  107. */
  108. protected PDFDocument pdfDoc;
  109. /**
  110. * The current resource context for adding fonts, patterns etc.
  111. */
  112. protected PDFResourceContext resourceContext;
  113. /**
  114. * The PDF reference of the current page.
  115. */
  116. protected String pageRef;
  117. /**
  118. * The PDF painting state
  119. */
  120. protected PDFPaintingState paintingState;
  121. /** the PDF color handler */
  122. protected PDFColorHandler colorHandler;
  123. /**
  124. * The PDF graphics state level that this svg is being drawn into.
  125. */
  126. protected int baseLevel = 0;
  127. /**
  128. * The count of natively handled images added to document so they receive
  129. * unique keys.
  130. */
  131. protected int nativeCount = 0;
  132. /**
  133. * The current font information.
  134. */
  135. protected FontInfo fontInfo;
  136. /**
  137. * The override font state used when drawing text and the font cannot be
  138. * set using java fonts.
  139. */
  140. protected Font ovFontState = null;
  141. /**
  142. * the current stream to add PDF commands to
  143. */
  144. protected StringWriter currentStream = new StringWriter();
  145. /**
  146. * the current (internal) font name
  147. */
  148. protected String currentFontName;
  149. /**
  150. * the current font size in millipoints
  151. */
  152. protected float currentFontSize;
  153. /**
  154. * The output stream for the pdf document.
  155. * If this is set then it can progressively output
  156. * the pdf document objects to reduce memory.
  157. * Especially with images.
  158. */
  159. protected OutputStream outputStream = null;
  160. /**
  161. * Create a new PDFGraphics2D with the given pdf document info.
  162. * This is used to create a Graphics object for use inside an already
  163. * existing document.
  164. *
  165. * @param textAsShapes if true then draw text as shapes
  166. * @param fi the current font information
  167. * @param doc the pdf document for creating pdf objects
  168. * @param page the current resource context or page
  169. * @param pref the PDF reference of the current page
  170. * @param font the current font name
  171. * @param size the current font size
  172. */
  173. public PDFGraphics2D(boolean textAsShapes, FontInfo fi, PDFDocument doc,
  174. PDFResourceContext page, String pref, String font, float size) {
  175. this(textAsShapes);
  176. pdfDoc = doc;
  177. this.colorHandler = new PDFColorHandler(doc.getResources());
  178. resourceContext = page;
  179. currentFontName = font;
  180. currentFontSize = size;
  181. fontInfo = fi;
  182. pageRef = pref;
  183. paintingState = new PDFPaintingState();
  184. }
  185. /**
  186. * Create a new PDFGraphics2D.
  187. *
  188. * @param textAsShapes true if drawing text as shapes
  189. */
  190. protected PDFGraphics2D(boolean textAsShapes) {
  191. super(textAsShapes);
  192. }
  193. /**
  194. * This constructor supports the create method.
  195. * This is not implemented properly.
  196. *
  197. * @param g the PDF graphics to make a copy of
  198. */
  199. public PDFGraphics2D(PDFGraphics2D g) {
  200. super(g);
  201. this.pdfDoc = g.pdfDoc;
  202. this.colorHandler = g.colorHandler;
  203. this.resourceContext = g.resourceContext;
  204. this.currentFontName = g.currentFontName;
  205. this.currentFontSize = g.currentFontSize;
  206. this.fontInfo = g.fontInfo;
  207. this.pageRef = g.pageRef;
  208. this.paintingState = g.paintingState;
  209. this.currentStream = g.currentStream;
  210. this.nativeCount = g.nativeCount;
  211. this.outputStream = g.outputStream;
  212. this.ovFontState = g.ovFontState;
  213. }
  214. /**
  215. * Creates a new <code>Graphics</code> object that is
  216. * a copy of this <code>Graphics</code> object.
  217. * @return a new graphics context that is a copy of
  218. * this graphics context.
  219. */
  220. @Override
  221. public Graphics create() {
  222. return new PDFGraphics2D(this);
  223. }
  224. /**
  225. * Central handler for IOExceptions for this class.
  226. * @param ioe IOException to handle
  227. */
  228. protected void handleIOException(IOException ioe) {
  229. //TODO Surely, there's a better way to do this.
  230. ioe.printStackTrace();
  231. }
  232. /**
  233. * This method is used by PDFDocumentGraphics2D to prepare a new page if
  234. * necessary.
  235. */
  236. protected void preparePainting() {
  237. //nop, used by PDFDocumentGraphics2D
  238. }
  239. /**
  240. * Set the PDF state to use when starting to draw
  241. * into the PDF graphics.
  242. *
  243. * @param state the PDF state
  244. */
  245. public void setPaintingState(PDFPaintingState state) {
  246. paintingState = state;
  247. baseLevel = paintingState.getStackLevel();
  248. }
  249. /**
  250. * Set the output stream that this PDF document is
  251. * being drawn to. This is so that it can progressively
  252. * use the PDF document to output data such as images.
  253. * This results in a significant saving on memory.
  254. *
  255. * @param os the output stream that is being used for the PDF document
  256. */
  257. public void setOutputStream(OutputStream os) {
  258. outputStream = os;
  259. }
  260. /**
  261. * Get the string containing all the commands written into this
  262. * Graphics.
  263. * @return the string containing the PDF markup
  264. */
  265. public String getString() {
  266. return currentStream.toString();
  267. }
  268. /**
  269. * Get the string buffer from the currentStream, containing all
  270. * the commands written into this Graphics so far.
  271. * @return the StringBuffer containing the PDF markup
  272. */
  273. public StringBuffer getBuffer() {
  274. return currentStream.getBuffer();
  275. }
  276. /**
  277. * Gets the PDF reference of the current page.
  278. * @return the PDF reference of the current page
  279. */
  280. public String getPageReference() {
  281. return this.pageRef;
  282. }
  283. /**
  284. * Set the Graphics context.
  285. * @param c the graphics context to use
  286. */
  287. public void setGraphicContext(GraphicContext c) {
  288. gc = c;
  289. setPrivateHints();
  290. }
  291. private void setPrivateHints() {
  292. setRenderingHint(RenderingHintsKeyExt.KEY_AVOID_TILE_PAINTING,
  293. RenderingHintsKeyExt.VALUE_AVOID_TILE_PAINTING_ON);
  294. }
  295. /**
  296. * Set the override font state for drawing text.
  297. * This is used by the PDF text painter so that it can temporarily
  298. * set the font state when a java font cannot be used.
  299. * The next drawString will use this font state.
  300. *
  301. * @param infont the font state to use
  302. */
  303. public void setOverrideFontState(Font infont) {
  304. ovFontState = infont;
  305. }
  306. /**
  307. * Restore the PDF graphics state to the starting state level.
  308. */
  309. /* seems not to be used
  310. public void restorePDFState() {
  311. for (int count = graphicsState.getStackLevel(); count > baseLevel; count--) {
  312. currentStream.write("Q\n");
  313. }
  314. graphicsState.restoreLevel(baseLevel);
  315. }*/
  316. private void concatMatrix(double[] matrix) {
  317. currentStream.write(PDFNumber.doubleOut(matrix[0], DEC) + " "
  318. + PDFNumber.doubleOut(matrix[1], DEC) + " "
  319. + PDFNumber.doubleOut(matrix[2], DEC) + " "
  320. + PDFNumber.doubleOut(matrix[3], DEC) + " "
  321. + PDFNumber.doubleOut(matrix[4], DEC) + " "
  322. + PDFNumber.doubleOut(matrix[5], DEC) + " cm\n");
  323. }
  324. private void concatMatrix(AffineTransform transform) {
  325. if (!transform.isIdentity()) {
  326. double[] matrix = new double[6];
  327. transform.getMatrix(matrix);
  328. concatMatrix(matrix);
  329. }
  330. }
  331. /**
  332. * This is mainly used for shading patterns which use the document-global coordinate system
  333. * instead of the local one.
  334. * @return the transformation matrix that established the basic user space for this document
  335. */
  336. protected AffineTransform getBaseTransform() {
  337. AffineTransform at = new AffineTransform(paintingState.getTransform());
  338. return at;
  339. }
  340. /**
  341. * This is a pdf specific method used to add a link to the
  342. * pdf document.
  343. *
  344. * @param bounds the bounds of the link in user coordinates
  345. * @param trans the transform of the current drawing position
  346. * @param dest the PDF destination
  347. * @param linkType the type of link, internal or external
  348. */
  349. public void addLink(Rectangle2D bounds, AffineTransform trans, String dest, int linkType) {
  350. if (!pdfDoc.getProfile().isAnnotationAllowed()) {
  351. return;
  352. }
  353. preparePainting();
  354. AffineTransform at = getTransform();
  355. Shape b = at.createTransformedShape(bounds);
  356. b = trans.createTransformedShape(b);
  357. if (b != null) {
  358. Rectangle rect = b.getBounds();
  359. if (linkType != PDFLink.EXTERNAL) {
  360. String pdfdest = "/FitR " + dest;
  361. resourceContext.addAnnotation(
  362. pdfDoc.getFactory().makeLink(rect, getPageReference(), pdfdest));
  363. } else {
  364. resourceContext.addAnnotation(
  365. pdfDoc.getFactory().makeLink(rect, dest, linkType, 0));
  366. }
  367. }
  368. }
  369. /**
  370. * Add a natively handled image directly to the PDF document.
  371. * This is used by the PDFImageElementBridge to draw a natively handled image
  372. * (like JPEG or CCITT images)
  373. * directly into the PDF document rather than converting the image into
  374. * a bitmap and increasing the size.
  375. *
  376. * @param image the image to draw
  377. * @param x the x position
  378. * @param y the y position
  379. * @param width the width to draw the image
  380. * @param height the height to draw the image
  381. */
  382. public void addNativeImage(org.apache.xmlgraphics.image.loader.Image image, float x, float y,
  383. float width, float height) {
  384. preparePainting();
  385. String key = image.getInfo().getOriginalURI();
  386. if (key == null) {
  387. // Need to include hash code as when invoked from FO you
  388. // may have several 'independent' PDFGraphics2D so the
  389. // count is not enough.
  390. key = "__AddNative_" + hashCode() + "_" + nativeCount;
  391. nativeCount++;
  392. }
  393. PDFImage pdfImage;
  394. if (image instanceof ImageRawJPEG) {
  395. pdfImage = new ImageRawJPEGAdapter((ImageRawJPEG)image, key);
  396. } else if (image instanceof ImageRawCCITTFax) {
  397. pdfImage = new ImageRawCCITTFaxAdapter((ImageRawCCITTFax)image, key);
  398. } else {
  399. throw new IllegalArgumentException(
  400. "Unsupported Image subclass: " + image.getClass().getName());
  401. }
  402. PDFXObject xObject = this.pdfDoc.addImage(resourceContext, pdfImage);
  403. flushPDFDocument();
  404. AffineTransform at = new AffineTransform();
  405. at.translate(x, y);
  406. useXObject(xObject, at, width, height);
  407. }
  408. private void flushPDFDocument() {
  409. if (outputStream != null) {
  410. try {
  411. this.pdfDoc.output(outputStream);
  412. } catch (IOException ioe) {
  413. // ignore exception, will be thrown again later
  414. }
  415. }
  416. }
  417. /**
  418. * Draws as much of the specified image as is currently available.
  419. * The image is drawn with its top-left corner at
  420. * (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's coordinate
  421. * space. Transparent pixels in the image do not affect whatever
  422. * pixels are already there.
  423. * <p>
  424. * This method returns immediately in all cases, even if the
  425. * complete image has not yet been loaded, and it has not been dithered
  426. * and converted for the current output device.
  427. * <p>
  428. * If the image has not yet been completely loaded, then
  429. * <code>drawImage</code> returns <code>false</code>. As more of
  430. * the image becomes available, the process that draws the image notifies
  431. * the specified image observer.
  432. * @param img the specified image to be drawn.
  433. * @param x the <i>x</i> coordinate.
  434. * @param y the <i>y</i> coordinate.
  435. * @param observer object to be notified as more of
  436. * the image is converted.
  437. * @return true if the image was drawn
  438. * @see java.awt.Image
  439. * @see java.awt.image.ImageObserver
  440. * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
  441. */
  442. @Override
  443. public boolean drawImage(Image img, int x, int y,
  444. ImageObserver observer) {
  445. preparePainting();
  446. int width = img.getWidth(observer);
  447. int height = img.getHeight(observer);
  448. if (width == -1 || height == -1) {
  449. return false;
  450. }
  451. return drawImage(img, x, y, width, height, observer);
  452. }
  453. private BufferedImage buildBufferedImage(Dimension size) {
  454. return new BufferedImage(size.width, size.height,
  455. BufferedImage.TYPE_INT_ARGB);
  456. }
  457. /** {@inheritDoc} */
  458. @Override
  459. public boolean drawImage(Image img, int x, int y, int width, int height,
  460. ImageObserver observer) {
  461. preparePainting();
  462. // first we look to see if we've already added this image to
  463. // the pdf document. If so, we just reuse the reference;
  464. // otherwise we have to build a FopImage and add it to the pdf
  465. // document
  466. String key = "TempImage:" + img.toString();
  467. PDFXObject xObject = pdfDoc.getXObject(key);
  468. if (xObject == null) {
  469. // OK, have to build and add a PDF image
  470. Dimension size = new Dimension(width, height);
  471. BufferedImage buf = buildBufferedImage(size);
  472. java.awt.Graphics2D g = buf.createGraphics();
  473. g.setComposite(AlphaComposite.SrcOver);
  474. g.setBackground(new Color(1, 1, 1, 0));
  475. g.setPaint(new Color(1, 1, 1, 0));
  476. g.fillRect(0, 0, width, height);
  477. int imageWidth = buf.getWidth();
  478. int imageHeight = buf.getHeight();
  479. g.clip(new Rectangle(0, 0, imageWidth, imageHeight));
  480. g.setComposite(gc.getComposite());
  481. boolean drawn = g.drawImage(img, 0, 0, imageWidth, imageHeight, observer);
  482. if (!drawn) {
  483. return false;
  484. }
  485. g.dispose();
  486. xObject = addRenderedImage(key, buf);
  487. } else {
  488. resourceContext.getPDFResources().addXObject(xObject);
  489. }
  490. AffineTransform at = new AffineTransform();
  491. at.translate(x, y);
  492. useXObject(xObject, at, width, height);
  493. return true;
  494. }
  495. /**
  496. * Disposes of this graphics context and releases
  497. * any system resources that it is using.
  498. * A <code>Graphics</code> object cannot be used after
  499. * <code>dispose</code>has been called.
  500. * <p>
  501. * When a Java program runs, a large number of <code>Graphics</code>
  502. * objects can be created within a short time frame.
  503. * Although the finalization process of the garbage collector
  504. * also disposes of the same system resources, it is preferable
  505. * to manually free the associated resources by calling this
  506. * method rather than to rely on a finalization process which
  507. * may not run to completion for a long period of time.
  508. * <p>
  509. * Graphics objects which are provided as arguments to the
  510. * <code>paint</code> and <code>update</code> methods
  511. * of components are automatically released by the system when
  512. * those methods return. For efficiency, programmers should
  513. * call <code>dispose</code> when finished using
  514. * a <code>Graphics</code> object only if it was created
  515. * directly from a component or another <code>Graphics</code> object.
  516. * @see java.awt.Graphics#finalize
  517. * @see java.awt.Component#paint
  518. * @see java.awt.Component#update
  519. * @see java.awt.Component#getGraphics
  520. * @see java.awt.Graphics#create
  521. */
  522. @Override
  523. public void dispose() {
  524. pdfDoc = null;
  525. fontInfo = null;
  526. currentStream = null;
  527. currentFontName = null;
  528. }
  529. /**
  530. * Strokes the outline of a <code>Shape</code> using the settings of the
  531. * current <code>Graphics2D</code> context. The rendering attributes
  532. * applied include the <code>Clip</code>, <code>Transform</code>,
  533. * <code>Paint</code>, <code>Composite</code> and
  534. * <code>Stroke</code> attributes.
  535. * @param s the <code>Shape</code> to be rendered
  536. * @see #setStroke
  537. * @see #setPaint
  538. * @see java.awt.Graphics#setColor
  539. * @see #transform
  540. * @see #setTransform
  541. * @see #clip
  542. * @see #setClip
  543. * @see #setComposite
  544. */
  545. @Override
  546. public void draw(Shape s) {
  547. preparePainting();
  548. //Transparency shortcut
  549. Color c;
  550. c = getColor();
  551. if (c.getAlpha() == 0) {
  552. return;
  553. }
  554. AffineTransform trans = getTransform();
  555. double[] tranvals = new double[6];
  556. trans.getMatrix(tranvals);
  557. Shape imclip = getClip();
  558. boolean newClip = paintingState.checkClip(imclip);
  559. boolean newTransform = paintingState.checkTransform(trans)
  560. && !trans.isIdentity();
  561. if (newClip || newTransform) {
  562. saveGraphicsState();
  563. if (newTransform) {
  564. concatMatrix(tranvals);
  565. }
  566. if (newClip) {
  567. writeClip(imclip);
  568. }
  569. }
  570. applyAlpha(OPAQUE, c.getAlpha());
  571. c = getColor();
  572. applyColor(c, false);
  573. c = getBackground();
  574. applyColor(c, true);
  575. Paint paint = getPaint();
  576. if (paintingState.setPaint(paint)) {
  577. if (!applyPaint(paint, false)) {
  578. // Stroke the shape and use it to 'clip'
  579. // the paint contents.
  580. Shape ss = getStroke().createStrokedShape(s);
  581. applyUnknownPaint(paint, ss);
  582. if (newClip || newTransform) {
  583. restoreGraphicsState();
  584. }
  585. return;
  586. }
  587. }
  588. applyStroke(getStroke());
  589. PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM);
  590. processPathIterator(iter);
  591. doDrawing(false, true, false);
  592. if (newClip || newTransform) {
  593. restoreGraphicsState();
  594. }
  595. }
  596. /*
  597. // in theory we could set the clip using these methods
  598. // it doesn't seem to improve the file sizes much
  599. // and makes everything more complicated
  600. Shape lastClip = null;
  601. public void clip(Shape cl) {
  602. super.clip(cl);
  603. Shape newClip = getClip();
  604. if (newClip == null || lastClip == null
  605. || !(new Area(newClip).equals(new Area(lastClip)))) {
  606. graphicsState.setClip(newClip);
  607. writeClip(newClip);
  608. }
  609. lastClip = newClip;
  610. }
  611. public void setClip(Shape cl) {
  612. super.setClip(cl);
  613. Shape newClip = getClip();
  614. if (newClip == null || lastClip == null
  615. || !(new Area(newClip).equals(new Area(lastClip)))) {
  616. for (int count = graphicsState.getStackLevel(); count > baseLevel; count--) {
  617. currentStream.write("Q\n");
  618. }
  619. graphicsState.restoreLevel(baseLevel);
  620. currentStream.write("q\n");
  621. graphicsState.push();
  622. if (newClip != null) {
  623. graphicsState.setClip(newClip);
  624. }
  625. writeClip(newClip);
  626. }
  627. lastClip = newClip;
  628. }
  629. */
  630. /**
  631. * Set the clipping shape for future PDF drawing in the current graphics state.
  632. * This sets creates and writes a clipping shape that will apply
  633. * to future drawings in the current graphics state.
  634. *
  635. * @param s the clipping shape
  636. */
  637. protected void writeClip(Shape s) {
  638. if (s == null) {
  639. return;
  640. }
  641. PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM);
  642. if (iter.isDone()) {
  643. // no segments available. Not worth doing anything
  644. return;
  645. }
  646. preparePainting();
  647. processPathIterator(iter);
  648. // clip area
  649. currentStream.write("W\n");
  650. currentStream.write("n\n");
  651. }
  652. /**
  653. * Apply the java Color to PDF.
  654. * This converts the java colour to a PDF colour and
  655. * sets it for the next drawing.
  656. *
  657. * @param col the java colour
  658. * @param fill true if the colour will be used for filling
  659. */
  660. protected void applyColor(Color col, boolean fill) {
  661. preparePainting();
  662. //TODO Handle this in PDFColorHandler by automatically converting the color.
  663. //This won't work properly anyway after the redesign of ColorExt
  664. if (col.getColorSpace().getType() == ColorSpace.TYPE_CMYK) {
  665. if (pdfDoc.getProfile().getPDFAMode().isPDFA1LevelB()) {
  666. //See PDF/A-1, ISO 19005:1:2005(E), 6.2.3.3
  667. //FOP is currently restricted to DeviceRGB if PDF/A-1 is active.
  668. throw new PDFConformanceException(
  669. "PDF/A-1 does not allow mixing DeviceRGB and DeviceCMYK.");
  670. }
  671. }
  672. boolean doWrite = false;
  673. if (fill) {
  674. if (paintingState.setBackColor(col)) {
  675. doWrite = true;
  676. }
  677. } else {
  678. if (paintingState.setColor(col)) {
  679. doWrite = true;
  680. }
  681. }
  682. if (doWrite) {
  683. StringBuffer sb = new StringBuffer();
  684. colorHandler.establishColor(sb, col, fill);
  685. currentStream.write(sb.toString());
  686. }
  687. }
  688. /**
  689. * Apply the java paint to the PDF.
  690. * This takes the java paint sets up the appropraite PDF commands
  691. * for the drawing with that paint.
  692. * Currently this supports the gradients and patterns from batik.
  693. *
  694. * @param paint the paint to convert to PDF
  695. * @param fill true if the paint should be set for filling
  696. * @return true if the paint is handled natively, false if the paint should be rasterized
  697. */
  698. protected boolean applyPaint(Paint paint, boolean fill) { // CSOK: MethodLength
  699. preparePainting();
  700. if (paint instanceof Color) {
  701. return true;
  702. }
  703. // convert java.awt.GradientPaint to LinearGradientPaint to avoid rasterization
  704. if (paint instanceof GradientPaint) {
  705. GradientPaint gpaint = (GradientPaint) paint;
  706. paint = new LinearGradientPaint(
  707. (float) gpaint.getPoint1().getX(),
  708. (float) gpaint.getPoint1().getY(),
  709. (float) gpaint.getPoint2().getX(),
  710. (float) gpaint.getPoint2().getY(),
  711. new float[] {0, 1},
  712. new Color[] {gpaint.getColor1(), gpaint.getColor2()},
  713. gpaint.isCyclic() ? LinearGradientPaint.REPEAT : LinearGradientPaint.NO_CYCLE);
  714. }
  715. if (paint instanceof LinearGradientPaint) {
  716. LinearGradientPaint gp = (LinearGradientPaint)paint;
  717. // This code currently doesn't support 'repeat'.
  718. // For linear gradients it is possible to construct
  719. // a 'tile' that is repeated with a PDF pattern, but
  720. // it would be very tricky as you would have to rotate
  721. // the coordinate system so the repeat was axially
  722. // aligned. At this point I'm just going to rasterize it.
  723. MultipleGradientPaint.CycleMethodEnum cycle = gp.getCycleMethod();
  724. if (cycle != MultipleGradientPaint.NO_CYCLE) {
  725. return false;
  726. }
  727. Color[] cols = gp.getColors();
  728. float[] fractions = gp.getFractions();
  729. // Build proper transform from gradient space to page space
  730. // ('Patterns' don't get userspace transform).
  731. AffineTransform transform;
  732. transform = new AffineTransform(getBaseTransform());
  733. transform.concatenate(getTransform());
  734. transform.concatenate(gp.getTransform());
  735. List<Double> theMatrix = new java.util.ArrayList<Double>();
  736. double [] mat = new double[6];
  737. transform.getMatrix(mat);
  738. for (int idx = 0; idx < mat.length; idx++) {
  739. theMatrix.add(new Double(mat[idx]));
  740. }
  741. Point2D p1 = gp.getStartPoint();
  742. Point2D p2 = gp.getEndPoint();
  743. List<Double> theCoords = new java.util.ArrayList<Double>();
  744. theCoords.add(new Double(p1.getX()));
  745. theCoords.add(new Double(p1.getY()));
  746. theCoords.add(new Double(p2.getX()));
  747. theCoords.add(new Double(p2.getY()));
  748. List<Boolean> theExtend = new java.util.ArrayList<Boolean>();
  749. theExtend.add(Boolean.TRUE);
  750. theExtend.add(Boolean.TRUE);
  751. List<Double> theDomain = new java.util.ArrayList<Double>();
  752. theDomain.add(new Double(0));
  753. theDomain.add(new Double(1));
  754. List<Double> theEncode = new java.util.ArrayList<Double>();
  755. theEncode.add(new Double(0));
  756. theEncode.add(new Double(1));
  757. theEncode.add(new Double(0));
  758. theEncode.add(new Double(1));
  759. List<Double> theBounds = new java.util.ArrayList<Double>();
  760. List<Color> someColors = new java.util.ArrayList<Color>();
  761. for (int count = 0; count < cols.length; count++) {
  762. Color c1 = cols[count];
  763. if (c1.getAlpha() != 255) {
  764. return false; // PDF can't do alpha
  765. }
  766. //PDFColor color1 = new PDFColor(c1.getRed(), c1.getGreen(),
  767. // c1.getBlue());
  768. someColors.add(c1);
  769. if (count > 0 && count < cols.length - 1) {
  770. theBounds.add(new Double(fractions[count]));
  771. }
  772. }
  773. //Gradients are currently restricted to sRGB
  774. PDFDeviceColorSpace aColorSpace;
  775. aColorSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
  776. PDFPattern myPat = pdfDoc.getFactory().makeGradient(
  777. resourceContext, false, aColorSpace,
  778. someColors, theBounds, theCoords, theMatrix);
  779. currentStream.write(myPat.getColorSpaceOut(fill));
  780. return true;
  781. }
  782. if (paint instanceof RadialGradientPaint) {
  783. RadialGradientPaint rgp = (RadialGradientPaint)paint;
  784. // There is essentially no way to support repeats
  785. // in PDF for radial gradients (the one option would
  786. // be to 'grow' the outer circle until it fully covered
  787. // the bounds and then grow the stops accordingly, the
  788. // problem is that this may require an extremely large
  789. // number of stops for cases where the focus is near
  790. // the edge of the outer circle). so we rasterize.
  791. MultipleGradientPaint.CycleMethodEnum cycle = rgp.getCycleMethod();
  792. if (cycle != MultipleGradientPaint.NO_CYCLE) {
  793. return false;
  794. }
  795. AffineTransform transform;
  796. transform = new AffineTransform(getBaseTransform());
  797. transform.concatenate(getTransform());
  798. transform.concatenate(rgp.getTransform());
  799. List<Double> theMatrix = new java.util.ArrayList<Double>();
  800. double [] mat = new double[6];
  801. transform.getMatrix(mat);
  802. for (int idx = 0; idx < mat.length; idx++) {
  803. theMatrix.add(new Double(mat[idx]));
  804. }
  805. double ar = rgp.getRadius();
  806. Point2D ac = rgp.getCenterPoint();
  807. Point2D af = rgp.getFocusPoint();
  808. List<Double> theCoords = new java.util.ArrayList<Double>();
  809. double dx = af.getX() - ac.getX();
  810. double dy = af.getY() - ac.getY();
  811. double d = Math.sqrt(dx * dx + dy * dy);
  812. if (d > ar) {
  813. // the center point af must be within the circle with
  814. // radius ar centered at ac so limit it to that.
  815. double scale = (ar * .9999) / d;
  816. dx = dx * scale;
  817. dy = dy * scale;
  818. }
  819. theCoords.add(new Double(ac.getX() + dx)); // Fx
  820. theCoords.add(new Double(ac.getY() + dy)); // Fy
  821. theCoords.add(new Double(0));
  822. theCoords.add(new Double(ac.getX()));
  823. theCoords.add(new Double(ac.getY()));
  824. theCoords.add(new Double(ar));
  825. Color[] cols = rgp.getColors();
  826. List<Color> someColors = new java.util.ArrayList<Color>();
  827. for (int count = 0; count < cols.length; count++) {
  828. Color cc = cols[count];
  829. if (cc.getAlpha() != 255) {
  830. return false; // PDF can't do alpha
  831. }
  832. someColors.add(cc);
  833. }
  834. float[] fractions = rgp.getFractions();
  835. List<Double> theBounds = new java.util.ArrayList<Double>();
  836. for (int count = 1; count < fractions.length - 1; count++) {
  837. float offset = fractions[count];
  838. theBounds.add(new Double(offset));
  839. }
  840. PDFDeviceColorSpace colSpace;
  841. colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
  842. PDFPattern myPat = pdfDoc.getFactory().makeGradient
  843. (resourceContext, true, colSpace,
  844. someColors, theBounds, theCoords, theMatrix);
  845. currentStream.write(myPat.getColorSpaceOut(fill));
  846. return true;
  847. }
  848. if (paint instanceof PatternPaint) {
  849. PatternPaint pp = (PatternPaint)paint;
  850. return createPattern(pp, fill);
  851. }
  852. return false; // unknown paint
  853. }
  854. private boolean createPattern(PatternPaint pp, boolean fill) {
  855. preparePainting();
  856. FontInfo specialFontInfo = new FontInfo();
  857. boolean base14Kerning = false;
  858. FontSetup.setup(specialFontInfo, base14Kerning);
  859. PDFResources res = pdfDoc.getFactory().makeResources();
  860. PDFResourceContext context = new PDFResourceContext(res);
  861. PDFGraphics2D pattGraphic = new PDFGraphics2D(textAsShapes, specialFontInfo,
  862. pdfDoc, context, getPageReference(),
  863. "", 0);
  864. pattGraphic.setGraphicContext(new GraphicContext());
  865. pattGraphic.gc.validateTransformStack();
  866. pattGraphic.setRenderingHints(this.getRenderingHints());
  867. pattGraphic.setOutputStream(outputStream);
  868. GraphicsNode gn = pp.getGraphicsNode();
  869. //Rectangle2D gnBBox = gn.getBounds();
  870. Rectangle2D rect = pp.getPatternRect();
  871. // if (!pp.getOverflow()) {
  872. gn.paint(pattGraphic);
  873. // } else {
  874. // /* Commented out until SVN version of Batik is included */
  875. // // For overflow we need to paint the content from
  876. // // all the tiles who's overflow will intersect one
  877. // // tile (left->right, top->bottom). Then we can
  878. // // simply replicate that tile as normal.
  879. // double gnMinX = gnBBox.getX();
  880. // double gnMaxX = gnBBox.getX() + gnBBox.getWidth();
  881. // double gnMinY = gnBBox.getY();
  882. // double gnMaxY = gnBBox.getY() + gnBBox.getHeight();
  883. // double patMaxX = rect.getX() + rect.getWidth();
  884. // double patMaxY = rect.getY() + rect.getHeight();
  885. // double stepX = rect.getWidth();
  886. // double stepY = rect.getHeight();
  887. //
  888. // int startX = (int)((rect.getX() - gnMaxX)/stepX);
  889. // int startY = (int)((rect.getY() - gnMaxY)/stepY);
  890. //
  891. // int endX = (int)((patMaxX - gnMinX)/stepX);
  892. // int endY = (int)((patMaxY - gnMinY)/stepY);
  893. //
  894. // pattGraphic.translate(startX*stepX, startY*stepY);
  895. // for (int yIdx=startY; yIdx<=endY; yIdx++) {
  896. // for (int xIdx=startX; xIdx<=endX; xIdx++) {
  897. // gn.paint(pattGraphic);
  898. // pattGraphic.translate(stepX,0);
  899. // }
  900. // pattGraphic.translate(-(endX-startX+1)*stepX, stepY);
  901. // }
  902. // }
  903. List<Double> bbox = new java.util.ArrayList<Double>();
  904. bbox.add(new Double(rect.getX()));
  905. bbox.add(new Double(rect.getHeight() + rect.getY()));
  906. bbox.add(new Double(rect.getWidth() + rect.getX()));
  907. bbox.add(new Double(rect.getY()));
  908. AffineTransform transform;
  909. transform = new AffineTransform(getBaseTransform());
  910. transform.concatenate(getTransform());
  911. transform.concatenate(pp.getPatternTransform());
  912. List<Double> theMatrix = new java.util.ArrayList<Double>();
  913. double [] mat = new double[6];
  914. transform.getMatrix(mat);
  915. for (int idx = 0; idx < mat.length; idx++) {
  916. theMatrix.add(new Double(mat[idx]));
  917. }
  918. /** @todo see if pdfDoc and res can be linked here,
  919. (currently res <> PDFDocument's resources) so addFonts()
  920. can be moved to PDFDocument class */
  921. res.addFonts(pdfDoc, specialFontInfo);
  922. PDFPattern myPat = pdfDoc.getFactory().makePattern(
  923. resourceContext, 1, res, 1, 1, bbox,
  924. rect.getWidth(), rect.getHeight(),
  925. theMatrix, null,
  926. pattGraphic.getBuffer());
  927. currentStream.write(myPat.getColorSpaceOut(fill));
  928. PDFAnnotList annots = context.getAnnotations();
  929. if (annots != null) {
  930. this.pdfDoc.addObject(annots);
  931. }
  932. flushPDFDocument();
  933. return true;
  934. }
  935. /**
  936. * @param paint some paint
  937. * @param shape a shape
  938. * @return true (always)
  939. */
  940. protected boolean applyUnknownPaint(Paint paint, Shape shape) {
  941. preparePainting();
  942. Shape clip = getClip();
  943. Rectangle2D usrClipBounds;
  944. Rectangle2D usrBounds;
  945. usrBounds = shape.getBounds2D();
  946. if (clip != null) {
  947. usrClipBounds = clip.getBounds2D();
  948. if (!usrClipBounds.intersects(usrBounds)) {
  949. return true;
  950. }
  951. Rectangle2D.intersect(usrBounds, usrClipBounds, usrBounds);
  952. }
  953. double usrX = usrBounds.getX();
  954. double usrY = usrBounds.getY();
  955. double usrW = usrBounds.getWidth();
  956. double usrH = usrBounds.getHeight();
  957. Rectangle devShapeBounds;
  958. Rectangle devClipBounds;
  959. Rectangle devBounds;
  960. AffineTransform at = getTransform();
  961. devShapeBounds = at.createTransformedShape(shape).getBounds();
  962. if (clip != null) {
  963. devClipBounds = at.createTransformedShape(clip).getBounds();
  964. if (!devClipBounds.intersects(devShapeBounds)) {
  965. return true;
  966. }
  967. devBounds = devShapeBounds.intersection(devClipBounds);
  968. } else {
  969. devBounds = devShapeBounds;
  970. }
  971. int devX = devBounds.x;
  972. int devY = devBounds.y;
  973. int devW = devBounds.width;
  974. int devH = devBounds.height;
  975. ColorSpace rgbCS = ColorSpace.getInstance(ColorSpace.CS_sRGB);
  976. ColorModel rgbCM = new DirectColorModel
  977. (rgbCS, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
  978. false, DataBuffer.TYPE_BYTE);
  979. PaintContext pctx = paint.createContext(rgbCM, devBounds, usrBounds,
  980. at, getRenderingHints());
  981. PDFXObject imageInfo = pdfDoc.getXObject
  982. ("TempImage:" + pctx.toString());
  983. if (imageInfo != null) {
  984. resourceContext.getPDFResources().addXObject(imageInfo);
  985. } else {
  986. Raster r = pctx.getRaster(devX, devY, devW, devH);
  987. WritableRaster wr = (WritableRaster)r;
  988. wr = wr.createWritableTranslatedChild(0, 0);
  989. ColorModel pcm = pctx.getColorModel();
  990. BufferedImage bi = new BufferedImage
  991. (pcm, wr, pcm.isAlphaPremultiplied(), null);
  992. final byte[] rgb = new byte[devW * devH * 3];
  993. final int[] line = new int[devW];
  994. final byte[] mask;
  995. int x;
  996. int y;
  997. int val;
  998. int rgbIdx = 0;
  999. if (pcm.hasAlpha()) {
  1000. mask = new byte[devW * devH];
  1001. int maskIdx = 0;
  1002. for (y = 0; y < devH; y++) {
  1003. bi.getRGB(0, y, devW, 1, line, 0, devW);
  1004. for (x = 0; x < devW; x++) {
  1005. val = line[x];
  1006. mask[maskIdx++] = (byte)(val >>> 24);
  1007. rgb[rgbIdx++] = (byte)((val >> 16) & 0x0FF);
  1008. rgb[rgbIdx++] = (byte)((val >> 8 ) & 0x0FF);
  1009. rgb[rgbIdx++] = (byte)((val ) & 0x0FF);
  1010. }
  1011. }
  1012. } else {
  1013. mask = null;
  1014. for (y = 0; y < devH; y++) {
  1015. bi.getRGB(0, y, devW, 1, line, 0, devW);
  1016. for (x = 0; x < devW; x++) {
  1017. val = line[x];
  1018. rgb[rgbIdx++] = (byte)((val >> 16) & 0x0FF);
  1019. rgb[rgbIdx++] = (byte)((val >> 8 ) & 0x0FF);
  1020. rgb[rgbIdx++] = (byte)((val ) & 0x0FF);
  1021. }
  1022. }
  1023. }
  1024. String maskRef = null;
  1025. if (mask != null) {
  1026. BitmapImage fopimg = new BitmapImage
  1027. ("TempImageMask:" + pctx.toString(), devW, devH, mask, null);
  1028. fopimg.setColorSpace(new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_GRAY));
  1029. PDFImageXObject xobj = pdfDoc.addImage(resourceContext, fopimg);
  1030. maskRef = xobj.referencePDF();
  1031. flushPDFDocument();
  1032. }
  1033. BitmapImage fopimg;
  1034. fopimg = new BitmapImage("TempImage:" + pctx.toString(),
  1035. devW, devH, rgb, maskRef);
  1036. fopimg.setTransparent(new PDFColor(255, 255, 255));
  1037. imageInfo = pdfDoc.addImage(resourceContext, fopimg);
  1038. flushPDFDocument();
  1039. }
  1040. currentStream.write("q\n");
  1041. writeClip(shape);
  1042. currentStream.write("" + PDFNumber.doubleOut(usrW) + " 0 0 " + PDFNumber.doubleOut(-usrH) + " "
  1043. + PDFNumber.doubleOut(usrX) + " " + PDFNumber.doubleOut(usrY + usrH) + " cm\n"
  1044. + imageInfo.getName() + " Do\nQ\n");
  1045. return true;
  1046. }
  1047. /**
  1048. * Apply the stroke to the PDF.
  1049. * This takes the java stroke and outputs the appropriate settings
  1050. * to the PDF so that the stroke attributes are handled.
  1051. *
  1052. * @param stroke the java stroke
  1053. */
  1054. protected void applyStroke(Stroke stroke) {
  1055. preparePainting();
  1056. if (stroke instanceof BasicStroke) {
  1057. BasicStroke bs = (BasicStroke)stroke;
  1058. float[] da = bs.getDashArray();
  1059. if (da != null) {
  1060. currentStream.write("[");
  1061. for (int count = 0; count < da.length; count++) {
  1062. currentStream.write(PDFNumber.doubleOut(da[count]));
  1063. if (count < da.length - 1) {
  1064. currentStream.write(" ");
  1065. }
  1066. }
  1067. currentStream.write("] ");
  1068. float offset = bs.getDashPhase();
  1069. currentStream.write(PDFNumber.doubleOut(offset) + " d\n");
  1070. } else {
  1071. currentStream.write("[] 0 d\n");
  1072. }
  1073. int ec = bs.getEndCap();
  1074. switch (ec) {
  1075. case BasicStroke.CAP_BUTT:
  1076. currentStream.write(0 + " J\n");
  1077. break;
  1078. case BasicStroke.CAP_ROUND:
  1079. currentStream.write(1 + " J\n");
  1080. break;
  1081. case BasicStroke.CAP_SQUARE:
  1082. currentStream.write(2 + " J\n");
  1083. break;
  1084. default:
  1085. break;
  1086. }
  1087. int lj = bs.getLineJoin();
  1088. switch (lj) {
  1089. case BasicStroke.JOIN_MITER:
  1090. currentStream.write(0 + " j\n");
  1091. break;
  1092. case BasicStroke.JOIN_ROUND:
  1093. currentStream.write(1 + " j\n");
  1094. break;
  1095. case BasicStroke.JOIN_BEVEL:
  1096. currentStream.write(2 + " j\n");
  1097. break;
  1098. default:
  1099. break;
  1100. }
  1101. float lw = bs.getLineWidth();
  1102. currentStream.write(PDFNumber.doubleOut(lw) + " w\n");
  1103. float ml = bs.getMiterLimit();
  1104. currentStream.write(PDFNumber.doubleOut(ml) + " M\n");
  1105. }
  1106. }
  1107. /** {@inheritDoc} */
  1108. @Override
  1109. public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
  1110. String key = "TempImage:" + img.toString();
  1111. drawInnerRenderedImage(key, img, xform);
  1112. }
  1113. /**
  1114. * @param key a key
  1115. * @param img an image
  1116. * @param xform a transform
  1117. */
  1118. public void drawInnerRenderedImage(String key, RenderedImage img, AffineTransform xform) {
  1119. preparePainting();
  1120. PDFXObject xObject = pdfDoc.getXObject(key);
  1121. if (xObject == null) {
  1122. xObject = addRenderedImage(key, img);
  1123. } else {
  1124. resourceContext.getPDFResources().addXObject(xObject);
  1125. }
  1126. useXObject(xObject, xform, img.getWidth(), img.getHeight());
  1127. }
  1128. private void useXObject(PDFXObject xObject, AffineTransform xform, float width, float height) {
  1129. // now do any transformation required and add the actual image
  1130. // placement instance
  1131. currentStream.write("q\n");
  1132. concatMatrix(getTransform());
  1133. Shape imclip = getClip();
  1134. writeClip(imclip);
  1135. concatMatrix(xform);
  1136. String w = PDFNumber.doubleOut(width, DEC);
  1137. String h = PDFNumber.doubleOut(height, DEC);
  1138. currentStream.write("" + w + " 0 0 -" + h + " 0 " + h + " cm\n"
  1139. + xObject.getName() + " Do\nQ\n");
  1140. }
  1141. private PDFXObject addRenderedImage(String key, RenderedImage img) {
  1142. ImageInfo info = new ImageInfo(null, "image/unknown");
  1143. ImageSize size = new ImageSize(img.getWidth(), img.getHeight(),
  1144. GraphicsConstants.DEFAULT_DPI);
  1145. info.setSize(size);
  1146. ImageRendered imgRend = new ImageRendered(info, img, null);
  1147. ImageRenderedAdapter adapter = new ImageRenderedAdapter(imgRend, key);
  1148. PDFXObject xObject = pdfDoc.addImage(resourceContext, adapter);
  1149. flushPDFDocument();
  1150. return xObject;
  1151. }
  1152. /** {@inheritDoc} */
  1153. @Override
  1154. public void drawRenderableImage(RenderableImage img,
  1155. AffineTransform xform) {
  1156. //TODO Check if this is good enough
  1157. drawRenderedImage(img.createDefaultRendering(), xform);
  1158. }
  1159. /**
  1160. * Renders the text specified by the specified <code>String</code>,
  1161. * using the current <code>Font</code> and <code>Paint</code> attributes
  1162. * in the <code>Graphics2D</code> context.
  1163. * The baseline of the first character is at position
  1164. * (<i>x</i>,&nbsp;<i>y</i>) in the User Space.
  1165. * The rendering attributes applied include the <code>Clip</code>,
  1166. * <code>Transform</code>, <code>Paint</code>, <code>Font</code> and
  1167. * <code>Composite</code> attributes. For characters in script systems
  1168. * such as Hebrew and Arabic, the glyphs can be rendered from right to
  1169. * left, in which case the coordinate supplied is the location of the
  1170. * leftmost character on the baseline.
  1171. * @param s the <code>String</code> to be rendered
  1172. * @param x the coordinate where the <code>String</code>
  1173. * should be rendered
  1174. * @param y the coordinate where the <code>String</code>
  1175. * should be rendered
  1176. * @see #setPaint
  1177. * @see java.awt.Graphics#setColor
  1178. * @see java.awt.Graphics#setFont
  1179. * @see #setTransform
  1180. * @see #setComposite
  1181. * @see #setClip
  1182. */
  1183. @Override
  1184. public void drawString(String s, float x, float y) {
  1185. preparePainting();
  1186. Font fontState;
  1187. AffineTransform fontTransform = null;
  1188. if (ovFontState == null) {
  1189. java.awt.Font gFont = getFont();
  1190. fontTransform = gFont.getTransform();
  1191. fontState = fontInfo.getFontInstanceForAWTFont(gFont);
  1192. } else {
  1193. fontState = fontInfo.getFontInstance(
  1194. ovFontState.getFontTriplet(), ovFontState.getFontSize());
  1195. ovFontState = null;
  1196. }
  1197. updateCurrentFont(fontState);
  1198. saveGraphicsState();
  1199. Color c = getColor();
  1200. applyColor(c, true);
  1201. applyPaint(getPaint(), true);
  1202. applyAlpha(c.getAlpha(), OPAQUE);
  1203. Map<Integer, Map<Integer, Integer>> kerning = fontState.getKerning();
  1204. boolean kerningAvailable = (kerning != null && !kerning.isEmpty());
  1205. boolean useMultiByte = isMultiByteFont(currentFontName);
  1206. // String startText = useMultiByte ? "<FEFF" : "(";
  1207. String startText = useMultiByte ? "<" : "(";
  1208. String endText = useMultiByte ? "> " : ") ";
  1209. AffineTransform trans = getTransform();
  1210. //trans.translate(x, y);
  1211. double[] vals = new double[6];
  1212. trans.getMatrix(vals);
  1213. concatMatrix(vals);
  1214. Shape imclip = getClip();
  1215. writeClip(imclip);
  1216. currentStream.write("BT\n");
  1217. AffineTransform localTransform = new AffineTransform();
  1218. localTransform.translate(x, y);
  1219. if (fontTransform != null) {
  1220. localTransform.concatenate(fontTransform);
  1221. }
  1222. localTransform.scale(1, -1);
  1223. double[] lt = new double[6];
  1224. localTransform.getMatrix(lt);
  1225. currentStream.write(PDFNumber.doubleOut(lt[0]) + " "
  1226. + PDFNumber.doubleOut(lt[1]) + " " + PDFNumber.doubleOut(lt[2]) + " "
  1227. + PDFNumber.doubleOut(lt[3]) + " " + PDFNumber.doubleOut(lt[4]) + " "
  1228. + PDFNumber.doubleOut(lt[5]) + " Tm [" + startText);
  1229. int l = s.length();
  1230. for (int i = 0; i < l; i++) {
  1231. char ch = fontState.mapChar(s.charAt(i));
  1232. if (!useMultiByte) {
  1233. if (ch > 127) {
  1234. currentStream.write("\\");
  1235. currentStream.write(Integer.toOctalString(ch));
  1236. } else {
  1237. switch (ch) {
  1238. case '(':
  1239. case ')':
  1240. case '\\':
  1241. currentStream.write("\\");
  1242. break;
  1243. default:
  1244. }
  1245. currentStream.write(ch);
  1246. }
  1247. } else {
  1248. currentStream.write(PDFText.toUnicodeHex(ch));
  1249. }
  1250. if (kerningAvailable && (i + 1) < l) {
  1251. addKerning(currentStream, (Integer.valueOf(ch)),
  1252. (Integer.valueOf(fontState.mapChar(s.charAt(i + 1)))),
  1253. kerning, startText, endText);
  1254. }
  1255. }
  1256. currentStream.write(endText);
  1257. currentStream.write("] TJ\n");
  1258. currentStream.write("ET\n");
  1259. restoreGraphicsState();
  1260. }
  1261. /**
  1262. * Applies the given alpha values for filling and stroking.
  1263. * @param fillAlpha A value between 0 and 255 (=OPAQUE) for filling
  1264. * @param strokeAlpha A value between 0 and 255 (=OPAQUE) for stroking
  1265. */
  1266. protected void applyAlpha(int fillAlpha, int strokeAlpha) {
  1267. if (fillAlpha != OPAQUE || strokeAlpha != OPAQUE) {
  1268. checkTransparencyAllowed();
  1269. Map<String, Float> vals = new java.util.HashMap<String, Float>();
  1270. if (fillAlpha != OPAQUE) {
  1271. vals.put(PDFGState.GSTATE_ALPHA_NONSTROKE, new Float(fillAlpha / 255f));
  1272. }
  1273. if (strokeAlpha != OPAQUE) {
  1274. vals.put(PDFGState.GSTATE_ALPHA_STROKE, new Float(strokeAlpha / 255f));
  1275. }
  1276. PDFGState gstate = pdfDoc.getFactory().makeGState(
  1277. vals, paintingState.getGState());
  1278. resourceContext.addGState(gstate);
  1279. currentStream.write("/" + gstate.getName() + " gs\n");
  1280. }
  1281. }
  1282. /**
  1283. * Updates the currently selected font.
  1284. * @param font the new font to use
  1285. */
  1286. protected void updateCurrentFont(Font font) {
  1287. String name = font.getFontName();
  1288. float size = font.getFontSize() / 1000f;
  1289. //Only update if necessary
  1290. if ((!name.equals(this.currentFontName))
  1291. || (size != this.currentFontSize)) {
  1292. this.currentFontName = name;
  1293. this.currentFontSize = size;
  1294. currentStream.write("/" + name + " " + size + " Tf\n");
  1295. }
  1296. }
  1297. /**
  1298. * Returns a suitable internal font given an AWT Font instance.
  1299. * @param awtFont the AWT font
  1300. * @return the internal Font
  1301. * @deprecated use FontInfo.getFontInstanceForAWTFont(java.awt.Font awtFont) instead
  1302. */
  1303. @Deprecated
  1304. protected Font getInternalFontForAWTFont(java.awt.Font awtFont) {
  1305. return fontInfo.getFontInstanceForAWTFont(awtFont);
  1306. }
  1307. /**
  1308. * Determines whether the font with the given name is a multi-byte font.
  1309. * @param name the name of the font
  1310. * @return true if it's a multi-byte font
  1311. */
  1312. protected boolean isMultiByteFont(String name) {
  1313. // This assumes that *all* CIDFonts use a /ToUnicode mapping
  1314. org.apache.fop.fonts.Typeface f
  1315. = fontInfo.getFonts().get(name);
  1316. return f.isMultiByte();
  1317. }
  1318. private void addKerning(StringWriter buf, Integer ch1, Integer ch2,
  1319. Map<Integer, Map<Integer, Integer>> kerning, String startText,
  1320. String endText) {
  1321. preparePainting();
  1322. Map<Integer, Integer> kernPair = kerning.get(ch1);
  1323. if (kernPair != null) {
  1324. Integer width = kernPair.get(ch2);
  1325. if (width != null) {
  1326. currentStream.write(endText + (-width.intValue()) + " " + startText);
  1327. }
  1328. }
  1329. }
  1330. /**
  1331. * Renders the text of the specified iterator, using the
  1332. * <code>Graphics2D</code> context's current <code>Paint</code>. The
  1333. * iterator must specify a font
  1334. * for each character. The baseline of the
  1335. * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in the
  1336. * User Space.
  1337. * The rendering attributes applied include the <code>Clip</code>,
  1338. * <code>Transform</code>, <code>Paint</code>, and
  1339. * <code>Composite</code> attributes.
  1340. * For characters in script systems such as Hebrew and Arabic,
  1341. * the glyphs can be rendered from right to left, in which case the
  1342. * coordinate supplied is the location of the leftmost character
  1343. * on the baseline.
  1344. * @param iterator the iterator whose text is to be rendered
  1345. * @param x the coordinate where the iterator's text is to be
  1346. * rendered
  1347. * @param y the coordinate where the iterator's text is to be
  1348. * rendered
  1349. * @see #setPaint
  1350. * @see java.awt.Graphics#setColor
  1351. * @see #setTransform
  1352. * @see #setComposite
  1353. * @see #setClip
  1354. *//* TODO Reimplement for higher efficiency similar to the way it was done in PDFTextPainter
  1355. public void drawString(AttributedCharacterIterator iterator, float x,
  1356. float y) {
  1357. preparePainting();
  1358. Font fontState = null;
  1359. Shape imclip = getClip();
  1360. writeClip(imclip);
  1361. Color c = getColor();
  1362. applyColor(c, true);
  1363. applyPaint(getPaint(), true);
  1364. boolean fill = true;
  1365. boolean stroke = false;
  1366. if (true) {
  1367. Stroke currentStroke = getStroke();
  1368. stroke = true;
  1369. applyStroke(currentStroke);
  1370. applyColor(c, false);
  1371. applyPaint(getPaint(), false);
  1372. }
  1373. currentStream.write("BT\n");
  1374. // set text rendering mode:
  1375. // 0 - fill, 1 - stroke, 2 - fill then stroke
  1376. int textr = 0;
  1377. if (fill && stroke) {
  1378. textr = 2;
  1379. } else if (stroke) {
  1380. textr = 1;
  1381. }
  1382. currentStream.write(textr + " Tr\n");
  1383. AffineTransform trans = getTransform();
  1384. trans.translate(x, y);
  1385. double[] vals = new double[6];
  1386. trans.getMatrix(vals);
  1387. for (char ch = iterator.first(); ch != CharacterIterator.DONE;
  1388. ch = iterator.next()) {
  1389. //Map attr = iterator.getAttributes();
  1390. String name = fontState.getFontName();
  1391. int size = fontState.getFontSize();
  1392. if ((!name.equals(this.currentFontName))
  1393. || (size != this.currentFontSize)) {
  1394. this.currentFontName = name;
  1395. this.currentFontSize = size;
  1396. currentStream.write("/" + name + " " + (size / 1000)
  1397. + " Tf\n");
  1398. }
  1399. currentStream.write(PDFNumber.doubleOut(vals[0], DEC) + " "
  1400. + PDFNumber.doubleOut(vals[1], DEC) + " "
  1401. + PDFNumber.doubleOut(vals[2], DEC) + " "
  1402. + PDFNumber.doubleOut(vals[3], DEC) + " "
  1403. + PDFNumber.doubleOut(vals[4], DEC) + " "
  1404. + PDFNumber.doubleOut(vals[5], DEC) + " Tm (" + ch
  1405. + ") Tj\n");
  1406. }
  1407. currentStream.write("ET\n");
  1408. }*/
  1409. /**
  1410. * Fills the interior of a <code>Shape</code> using the settings of the
  1411. * <code>Graphics2D</code> context. The rendering attributes applied
  1412. * include the <code>Clip</code>, <code>Transform</code>,
  1413. * <code>Paint</code>, and <code>Composite</code>.
  1414. * @param s the <code>Shape</code> to be filled
  1415. * @see #setPaint
  1416. * @see java.awt.Graphics#setColor
  1417. * @see #transform
  1418. * @see #setTransform
  1419. * @see #setComposite
  1420. * @see #clip
  1421. * @see #setClip
  1422. */
  1423. @Override
  1424. public void fill(Shape s) {
  1425. preparePainting();
  1426. //Transparency shortcut
  1427. Color c;
  1428. c = getBackground();
  1429. if (c.getAlpha() == 0) {
  1430. c = getColor();
  1431. if (c.getAlpha() == 0) {
  1432. return;
  1433. }
  1434. }
  1435. AffineTransform trans = getTransform();
  1436. double[] tranvals = new double[6];
  1437. trans.getMatrix(tranvals);
  1438. Shape imclip = getClip();
  1439. boolean newClip = paintingState.checkClip(imclip);
  1440. boolean newTransform = paintingState.checkTransform(trans)
  1441. && !trans.isIdentity();
  1442. if (newClip || newTransform) {
  1443. saveGraphicsState();
  1444. if (newTransform) {
  1445. concatMatrix(tranvals);
  1446. }
  1447. if (newClip) {
  1448. writeClip(imclip);
  1449. }
  1450. }
  1451. applyAlpha(c.getAlpha(), OPAQUE);
  1452. c = getColor();
  1453. applyColor(c, true);
  1454. c = getBackground();
  1455. applyColor(c, false);
  1456. Paint paint = getPaint();
  1457. if (paintingState.setPaint(paint)) {
  1458. if (!applyPaint(paint, true)) {
  1459. // Use the shape to 'clip' the paint contents.
  1460. applyUnknownPaint(paint, s);
  1461. if (newClip || newTransform) {
  1462. restoreGraphicsState();
  1463. }
  1464. return;
  1465. }
  1466. }
  1467. if (s instanceof Rectangle2D) {
  1468. Rectangle2D rect = (Rectangle2D)s;
  1469. currentStream.write(PDFNumber.doubleOut(rect.getMinX(), DEC) + " "
  1470. + PDFNumber.doubleOut(rect.getMinY(), DEC) + " ");
  1471. currentStream.write(PDFNumber.doubleOut(rect.getWidth(), DEC) + " "
  1472. + PDFNumber.doubleOut(rect.getHeight(), DEC) + " re ");
  1473. doDrawing(true, false, false);
  1474. } else {
  1475. PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM);
  1476. processPathIterator(iter);
  1477. doDrawing(true, false,
  1478. iter.getWindingRule() == PathIterator.WIND_EVEN_ODD);
  1479. }
  1480. if (newClip || newTransform) {
  1481. restoreGraphicsState();
  1482. }
  1483. }
  1484. void saveGraphicsState() {
  1485. currentStream.write("q\n");
  1486. paintingState.save();
  1487. }
  1488. void restoreGraphicsState() {
  1489. currentStream.write("Q\n");
  1490. paintingState.restore();
  1491. }
  1492. /** Checks whether the use of transparency is allowed. */
  1493. protected void checkTransparencyAllowed() {
  1494. pdfDoc.getProfile().verifyTransparencyAllowed("Java2D graphics");
  1495. }
  1496. /**
  1497. * Processes a path iterator generating the necessary painting operations.
  1498. * @param iter PathIterator to process
  1499. */
  1500. public void processPathIterator(PathIterator iter) {
  1501. while (!iter.isDone()) {
  1502. double[] vals = new double[6];
  1503. int type = iter.currentSegment(vals);
  1504. switch (type) {
  1505. case PathIterator.SEG_CUBICTO:
  1506. currentStream.write(PDFNumber.doubleOut(vals[0], DEC) + " "
  1507. + PDFNumber.doubleOut(vals[1], DEC) + " "
  1508. + PDFNumber.doubleOut(vals[2], DEC) + " "
  1509. + PDFNumber.doubleOut(vals[3], DEC) + " "
  1510. + PDFNumber.doubleOut(vals[4], DEC) + " "
  1511. + PDFNumber.doubleOut(vals[5], DEC) + " c\n");
  1512. break;
  1513. case PathIterator.SEG_LINETO:
  1514. currentStream.write(PDFNumber.doubleOut(vals[0], DEC) + " "
  1515. + PDFNumber.doubleOut(vals[1], DEC) + " l\n");
  1516. break;
  1517. case PathIterator.SEG_MOVETO:
  1518. currentStream.write(PDFNumber.doubleOut(vals[0], DEC) + " "
  1519. + PDFNumber.doubleOut(vals[1], DEC) + " m\n");
  1520. break;
  1521. case PathIterator.SEG_QUADTO:
  1522. currentStream.write(PDFNumber.doubleOut(vals[0], DEC) + " "
  1523. + PDFNumber.doubleOut(vals[1], DEC) + " "
  1524. + PDFNumber.doubleOut(vals[2], DEC) + " "
  1525. + PDFNumber.doubleOut(vals[3], DEC) + " y\n");
  1526. break;
  1527. case PathIterator.SEG_CLOSE:
  1528. currentStream.write("h\n");
  1529. break;
  1530. default:
  1531. break;
  1532. }
  1533. iter.next();
  1534. }
  1535. }
  1536. /**
  1537. * Do the PDF drawing command.
  1538. * This does the PDF drawing command according to fill
  1539. * stroke and winding rule.
  1540. *
  1541. * @param fill true if filling the path
  1542. * @param stroke true if stroking the path
  1543. * @param nonzero true if using the non-zero winding rule
  1544. */
  1545. protected void doDrawing(boolean fill, boolean stroke, boolean nonzero) {
  1546. preparePainting();
  1547. if (fill) {
  1548. if (stroke) {
  1549. if (nonzero) {
  1550. currentStream.write("B*\n");
  1551. } else {
  1552. currentStream.write("B\n");
  1553. }
  1554. } else {
  1555. if (nonzero) {
  1556. currentStream.write("f*\n");
  1557. } else {
  1558. currentStream.write("f\n");
  1559. }
  1560. }
  1561. } else {
  1562. // if (stroke)
  1563. currentStream.write("S\n");
  1564. }
  1565. }
  1566. /**
  1567. * Returns the device configuration associated with this
  1568. * <code>Graphics2D</code>.
  1569. *
  1570. * @return the PDF graphics configuration
  1571. */
  1572. @Override
  1573. public GraphicsConfiguration getDeviceConfiguration() {
  1574. return new PDFGraphicsConfiguration();
  1575. }
  1576. /**
  1577. * Used to create proper font metrics
  1578. */
  1579. private Graphics2D fmg;
  1580. {
  1581. BufferedImage bi = new BufferedImage(1, 1,
  1582. BufferedImage.TYPE_INT_ARGB);
  1583. fmg = bi.createGraphics();
  1584. }
  1585. /**
  1586. * Gets the font metrics for the specified font.
  1587. * @return the font metrics for the specified font.
  1588. * @param f the specified font
  1589. * @see java.awt.Graphics#getFont
  1590. * @see java.awt.FontMetrics
  1591. * @see java.awt.Graphics#getFontMetrics()
  1592. */
  1593. @Override
  1594. public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
  1595. return fmg.getFontMetrics(f);
  1596. }
  1597. /**
  1598. * Sets the paint mode of this graphics context to alternate between
  1599. * this graphics context's current color and the new specified color.
  1600. * This specifies that logical pixel operations are performed in the
  1601. * XOR mode, which alternates pixels between the current color and
  1602. * a specified XOR color.
  1603. * <p>
  1604. * When drawing operations are performed, pixels which are the
  1605. * current color are changed to the specified color, and vice versa.
  1606. * <p>
  1607. * Pixels that are of colors other than those two colors are changed
  1608. * in an unpredictable but reversible manner; if the same figure is
  1609. * drawn twice, then all pixels are restored to their original values.
  1610. * @param c1 the XOR alternation color
  1611. */
  1612. @Override
  1613. public void setXORMode(Color c1) {
  1614. //NYI
  1615. }
  1616. /**
  1617. * Copies an area of the component by a distance specified by
  1618. * <code>dx</code> and <code>dy</code>. From the point specified
  1619. * by <code>x</code> and <code>y</code>, this method
  1620. * copies downwards and to the right. To copy an area of the
  1621. * component to the left or upwards, specify a negative value for
  1622. * <code>dx</code> or <code>dy</code>.
  1623. * If a portion of the source rectangle lies outside the bounds
  1624. * of the component, or is obscured by another window or component,
  1625. * <code>copyArea</code> will be unable to copy the associated
  1626. * pixels. The area that is omitted can be refreshed by calling
  1627. * the component's <code>paint</code> method.
  1628. * @param x the <i>x</i> coordinate of the source rectangle.
  1629. * @param y the <i>y</i> coordinate of the source rectangle.
  1630. * @param width the width of the source rectangle.
  1631. * @param height the height of the source rectangle.
  1632. * @param dx the horizontal distance to copy the pixels.
  1633. * @param dy the vertical distance to copy the pixels.
  1634. */
  1635. @Override
  1636. public void copyArea(int x, int y, int width, int height, int dx,
  1637. int dy) {
  1638. //NYI
  1639. }
  1640. }