Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
images [2016/03/02 15:16]
christian [Implementation]
images [2016/09/24 08:15] (current)
dokuadmin ↷ Links adapted because of a move operation
Line 1: Line 1:
 ====== Images ====== ====== Images ======
  
-Bitmapped images are described in chapter 8.9 //Images// on page 203 of the {{pdf32000_2008.pdf#page=211|PDF specification}} on quite readable 14 pages.+Bitmapped images are described in chapter 8.9 //Images// on page 203 of the {{pdf:pdf32000_2008.pdf_page_211|PDF specification}} on quite readable 14 pages.
  
 The implementation is in package ''PDF Images''. The implementation is in package ''PDF Images''.
Line 26: Line 26:
 </code> </code>
  
-{{demo20_ImagesUsage.pdf}} shows the result with an example image.+{{pdf:demo20_imagesusage.pdf}} shows the result with an example image.
  
-{{demo21_Images.pdf}} shows some PDF features of images (masking, rotation, interpolation, inverting and alpha blended images).+{{pdf:demo21_images.pdf}} shows some PDF features of images (masking, rotation, interpolation, inverting and alpha blended images).
  
 ===== Object Models ===== ===== Object Models =====
Line 79: Line 79:
 </code> </code>
  
-In PDF images are defined by the number of bits per color component (1, 2, 4, 8 or 16 bit). The colorspace defines the number of components and their layout for a pixel. Any colorspace permitted in PDF can be used (see [[Colors]]). For images converted from Smalltalk, only ''/DeviceRGB'' (3 components), ''/DeviceGray'' (1 component) and ''/Indexed'' (1 component) are relevant. The ''/Indexed'' colorspace in PDF can only hold up to 255 colors.+In PDF images are defined by the number of bits per color component (1, 2, 4, 8 or 16 bit). The colorspace defines the number of components and their layout for a pixel. Any colorspace permitted in PDF can be used (see [[:colors]]). For images converted from Smalltalk, only ''/DeviceRGB'' (3 components), ''/DeviceGray'' (1 component) and ''/Indexed'' (1 component) are relevant. The ''/Indexed'' colorspace in PDF can only hold up to 255 colors.
  
 A ''PDF.ImageXObject'' is a stream whose contents is a byte string with the pixel bits. A row ends at the byte boundary. A row with one pixel with 3 components of 1 bits (= 3 bits), uses 1 byte (8 bit) for the row. As any stream, ImageXObjects can be compressed using filters. By default, ''/FlateDecode'' (zip) is used. A ''PDF.ImageXObject'' is a stream whose contents is a byte string with the pixel bits. A row ends at the byte boundary. A row with one pixel with 3 components of 1 bits (= 3 bits), uses 1 byte (8 bit) for the row. As any stream, ImageXObjects can be compressed using filters. By default, ''/FlateDecode'' (zip) is used.
Line 102: Line 102:
 The conversion methods are implemented in the ''Graphics.Image'' hierarchy. To convert a Smalltalk image to PDF with ''asPDF'', the method ''writePixelsTo: anImageXObject'' transfers the actual pixels from the Smalltalk to the PDF image. The other direction uses the method ''readPixelsFrom: anImageXObject'' which transfers the PDF pixels to the Smalltalk image. The conversion methods are implemented in the ''Graphics.Image'' hierarchy. To convert a Smalltalk image to PDF with ''asPDF'', the method ''writePixelsTo: anImageXObject'' transfers the actual pixels from the Smalltalk to the PDF image. The other direction uses the method ''readPixelsFrom: anImageXObject'' which transfers the PDF pixels to the Smalltalk image.
  
-{{ :pdf:bitfiddling306x408.png?200&nolink|Work sketch for bit fiddling}}+{{ :pdf:bitfiddling200x266.png?nolink|Work sketch for bit fiddling}}
  
 The default behavior is to transfer the pixels one by one. For each pixel, the bits are read from the specified location in the source image bytes and interpreted as color (''valueAtPoint:''). This color is then converted to the target bits which are written to the specified location in the target image bytes (''valueAtPoint:put:''). While these two pixel accessors are correct and well tested for any kind of image, they are very slow. The default behavior is to transfer the pixels one by one. For each pixel, the bits are read from the specified location in the source image bytes and interpreted as color (''valueAtPoint:''). This color is then converted to the target bits which are written to the specified location in the target image bytes (''valueAtPoint:put:''). While these two pixel accessors are correct and well tested for any kind of image, they are very slow.
Line 124: Line 124:
 ==== Filter ==== ==== Filter ====
  
-Although all Smalltalk images can be used for PDF, not all PDF images can be transformed to Smalltalk images. For one, several {{pdf32000_2008.pdf#page=22|filters}} specific to images are not implemented:+Although all Smalltalk images can be used for PDF, not all PDF images can be transformed to Smalltalk images. For one, several {{pdf:pdf32000_2008.pdf_page_22|filters}} specific to images are not implemented:
   * **RunLengthDecode** 8 bit monochrome images   * **RunLengthDecode** 8 bit monochrome images
   * **CCITTFaxDecode** CCITT encoded 1 bit monochrome images   * **CCITTFaxDecode** CCITT encoded 1 bit monochrome images
  • images.1456928169.txt.gz
  • Last modified: 2016/03/02 15:16
  • by christian