This file is indexed.

/usr/share/doc/python-pyx-doc/manual/bitmap.html is in python-pyx-doc 0.12.1-9.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Bitmaps &#8212; PyX 0.12.1 Manual</title>
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '0.12.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true,
        SOURCELINK_SUFFIX: '.txt'
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Module bbox" href="bbox.html" />
    <link rel="prev" title="Module epsfile: EPS file inclusion" href="epsfile.html" /> 
  </head>
  <body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="bbox.html" title="Module bbox"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="epsfile.html" title="Module epsfile: EPS file inclusion"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="manual.html">PyX 0.12.1 Manual</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="bitmaps">
<h1>Bitmaps<a class="headerlink" href="#bitmaps" title="Permalink to this headline"></a></h1>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
<p>PyX focuses on the creation of scaleable vector graphics. However, PyX also
allows for the output of bitmap images. Still, the support for creation and
handling of bitmap images is quite limited. On the other hand the interfaces are
built that way, that its trivial to combine PyX with the “Python Image Library”,
also known as “PIL”.</p>
<p>The creation of a bitmap can be performed out of some unpacked binary data by
first creating image instances:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pyx</span> <span class="k">import</span> <span class="o">*</span>
<span class="n">image_bw</span> <span class="o">=</span> <span class="n">bitmap</span><span class="o">.</span><span class="n">image</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="s2">&quot;L&quot;</span><span class="p">,</span> <span class="s2">&quot;</span><span class="se">\0\377\377\0</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="n">image_rgb</span> <span class="o">=</span> <span class="n">bitmap</span><span class="o">.</span><span class="n">image</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="s2">&quot;RGB&quot;</span><span class="p">,</span> <span class="s2">&quot;</span><span class="se">\77\77\77\177\177\177\277\277\277</span><span class="s2">&quot;</span>
                                      <span class="s2">&quot;</span><span class="se">\377\0\0\0\377\0\0\0\377</span><span class="s2">&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>Now <code class="docutils literal"><span class="pre">image_bw</span></code> is a <span class="math">\(2\times2\)</span> grayscale image. The bitmap data is
provided by a string, which contains two black (<code class="docutils literal"><span class="pre">&quot;\0&quot;</span> <span class="pre">==</span> <span class="pre">chr(0)</span></code>) and two
white (<code class="docutils literal"><span class="pre">&quot;\377&quot;</span> <span class="pre">==</span> <span class="pre">chr(255)</span></code>) pixels. Currently the values per (colour) channel
is fixed to 8 bits. The coloured image <code class="docutils literal"><span class="pre">image_rgb</span></code> has <span class="math">\(3\times2\)</span> pixels
containing a row of 3 different gray values and a row of the three colours red,
green, and blue.</p>
<p>The images can then be wrapped into <code class="docutils literal"><span class="pre">bitmap</span></code> instances by:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">bitmap_bw</span> <span class="o">=</span> <span class="n">bitmap</span><span class="o">.</span><span class="n">bitmap</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">image_bw</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mf">0.8</span><span class="p">)</span>
<span class="n">bitmap_rgb</span> <span class="o">=</span> <span class="n">bitmap</span><span class="o">.</span><span class="n">bitmap</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">image_rgb</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mf">0.8</span><span class="p">)</span>
</pre></div>
</div>
<p>When constructing a <code class="docutils literal"><span class="pre">bitmap</span></code> instance you have to specify a certain position
by the first two arguments fixing the bitmaps lower left corner. Some optional
arguments control further properties. Since in this example there is no
information about the dpi-value of the images, we have to specify at least a
<code class="docutils literal"><span class="pre">width</span></code> or a <code class="docutils literal"><span class="pre">height</span></code> of the bitmap.</p>
<p>The bitmaps are now to be inserted into a canvas:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">c</span> <span class="o">=</span> <span class="n">canvas</span><span class="o">.</span><span class="n">canvas</span><span class="p">()</span>
<span class="n">c</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="n">bitmap_bw</span><span class="p">)</span>
<span class="n">c</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="n">bitmap_rgb</span><span class="p">)</span>
<span class="n">c</span><span class="o">.</span><span class="n">writeEPSfile</span><span class="p">(</span><span class="s2">&quot;bitmap&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>Figure <a class="reference internal" href="#fig-bitmap"><span class="std std-ref">An introductory bitmap example.</span></a> shows the resulting output.</p>
<div class="figure align-center" id="id1">
<span id="fig-bitmap"></span><img alt="_images/bitmap.png" src="_images/bitmap.png" />
<p class="caption"><span class="caption-text">An introductory bitmap example.</span></p>
</div>
<span class="target" id="module-bitmap"></span></div>
<div class="section" id="bitmap-module-bitmap-support">
<h2>Bitmap <code class="xref py py-mod docutils literal"><span class="pre">module</span></code>: Bitmap support<a class="headerlink" href="#bitmap-module-bitmap-support" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="bitmap.image">
<em class="property">class </em><code class="descclassname">bitmap.</code><code class="descname">image</code><span class="sig-paren">(</span><em>width</em>, <em>height</em>, <em>mode</em>, <em>data</em>, <em>compressed=None</em><span class="sig-paren">)</span><a class="headerlink" href="#bitmap.image" title="Permalink to this definition"></a></dt>
<dd><p>This class is a container for image data. <em>width</em> and <em>height</em> are the size of
the image in pixel. <em>mode</em> is one of <code class="docutils literal"><span class="pre">&quot;L&quot;</span></code>, <code class="docutils literal"><span class="pre">&quot;</span> <span class="pre">RGB&quot;</span></code> or <code class="docutils literal"><span class="pre">&quot;CMYK&quot;</span></code> for
grayscale, rgb, or cmyk colours, respectively. <em>data</em> is the bitmap data as a
string, where each single character represents a colour value with ordinal range
<code class="docutils literal"><span class="pre">0</span></code> to <code class="docutils literal"><span class="pre">255</span></code>. Each pixel is described by the appropriate number of colour
components according to <em>mode</em>. The pixels are listed row by row one after the
other starting at the upper left corner of the image.</p>
<p><em>compressed</em> might be set to <code class="docutils literal"><span class="pre">&quot;</span> <span class="pre">Flate&quot;</span></code> or <code class="docutils literal"><span class="pre">&quot;DCT&quot;</span></code> to provide already
compressed data. Note that those data will be passed to PostScript without
further checks, <em>i.e.</em> this option is for experts only.</p>
</dd></dl>

<dl class="class">
<dt id="bitmap.jpegimage">
<em class="property">class </em><code class="descclassname">bitmap.</code><code class="descname">jpegimage</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#bitmap.jpegimage" title="Permalink to this definition"></a></dt>
<dd><p>This class is specialized to read data from a JPEG/JFIF-file. <em>file</em> is either
an open file handle (it only has to provide a <code class="xref py py-meth docutils literal"><span class="pre">read()</span></code> method; the file
should be opened in binary mode) or a string. In the latter case
<a class="reference internal" href="#bitmap.jpegimage" title="bitmap.jpegimage"><code class="xref py py-class docutils literal"><span class="pre">jpegimage</span></code></a> will try to open a file named like <em>file</em> for reading.</p>
<p>The contents of the file is checked for some JPEG/JFIF format markers in order
to identify the size and dpi resolution of the image for further usage. These
checks will typically fail for invalid data. The data are not uncompressed, but
directly inserted into the output stream (for invalid data the result will be
invalid PostScript). Thus there is no quality loss by recompressing the data as
it would occur when recompressing the uncompressed stream with the lossy jpeg
compression method.</p>
</dd></dl>

<dl class="class">
<dt id="bitmap.bitmap">
<em class="property">class </em><code class="descclassname">bitmap.</code><code class="descname">bitmap</code><span class="sig-paren">(</span><em>xpos</em>, <em>ypos</em>, <em>image</em>, <em>width=None</em>, <em>height=None</em>, <em>ratio=None</em>, <em>storedata=0</em>, <em>maxstrlen=4093</em>, <em>compressmode=&quot;Flate&quot;</em>, <em>flatecompresslevel=6</em>, <em>dctquality=75</em>, <em>dctoptimize=1</em>, <em>dctprogression=0</em><span class="sig-paren">)</span><a class="headerlink" href="#bitmap.bitmap" title="Permalink to this definition"></a></dt>
<dd><p><em>xpos</em> and <em>ypos</em> are the position of the lower left corner of the image. This
position might be modified by some additional transformations when inserting the
bitmap into a canvas. <em>image</em> is an instance of <a class="reference internal" href="#bitmap.image" title="bitmap.image"><code class="xref py py-class docutils literal"><span class="pre">image</span></code></a> or
<a class="reference internal" href="#bitmap.jpegimage" title="bitmap.jpegimage"><code class="xref py py-class docutils literal"><span class="pre">jpegimage</span></code></a> but it can also be an image instance from the “Python Image
Library”.</p>
<p><em>width</em>, <em>height</em>, and <em>ratio</em> adjust the size of the image. At least <em>width</em> or
<em>height</em> needs to be given, when no dpi information is available from <em>image</em>.</p>
<p><em>storedata</em> is a flag indicating, that the (still compressed) image data should
be put into the printers memory instead of writing it as a stream into the
PostScript file. While this feature consumes memory of the PostScript
interpreter, it allows for multiple usage of the image without including the
image data several times in the PostScript file.</p>
<p><em>maxstrlen</em> defines a maximal string length when <em>storedata</em> is enabled. Since
the data must be kept in the PostScript interpreters memory, it is stored in
strings. While most interpreters do not allow for an arbitrary string length (a
common limit is 65535 characters), a limit for the string length is set. When
more data need to be stored, a list of strings will be used. Note that lists are
also subject to some implementation limits. Since a typical value is 65535
entries, in combination a huge amount of memory can be used.</p>
<p>Valid values for <em>compressmode</em> currently are <code class="docutils literal"><span class="pre">&quot;Flate&quot;</span></code> (zlib compression),
<code class="docutils literal"><span class="pre">&quot;DCT&quot;</span></code> (jpeg compression), or <code class="docutils literal"><span class="pre">None</span></code> (disabling the compression). The zlib
compression makes use of the zlib module as it is part of the standard Python
distribution. The jpeg compression is available for those <em>image</em> instances
only, which support the creation of a jpeg-compressed stream, <em>e.g.</em> images from
the “Python Image Library” with jpeg support installed. The compression must be
disabled when the image data is already compressed.</p>
<p><em>flatecompresslevel</em> is a parameter of the zlib compression. <em>dctquality</em>,
<em>dctoptimize</em>, and <em>dctprogression</em> are parameters of the jpeg compression.
Note, that the progression feature of the jpeg compression should be turned off
in order to produce valid PostScript. Also the optimization feature is known to
produce errors on certain printers.</p>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="manual.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Bitmaps</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#bitmap-module-bitmap-support">Bitmap <code class="docutils literal"><span class="pre">module</span></code>: Bitmap support</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="epsfile.html"
                        title="previous chapter">Module <code class="docutils literal"><span class="pre">epsfile</span></code>: EPS file inclusion</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="bbox.html"
                        title="next chapter">Module <code class="docutils literal"><span class="pre">bbox</span></code></a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/bitmap.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="bbox.html" title="Module bbox"
             >next</a> |</li>
        <li class="right" >
          <a href="epsfile.html" title="Module epsfile: EPS file inclusion"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="manual.html">PyX 0.12.1 Manual</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2018, Jörg Lehmann, Michael Schindler, André Wobst.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.5.
    </div>
  </body>
</html>