| 1 | <refentry id="imagedata.element" revision='3.1'> |
| 2 | <?dbhtml filename="imagedata.html"?> |
| 3 | <refentryinfo> |
| 4 | <pubdate>$Date$</pubdate> |
| 5 | <releaseinfo>$Revision$</releaseinfo> |
| 6 | </refentryinfo> |
| 7 | |
| 8 | <refmeta> |
| 9 | <indexterm><primary>elements</primary> |
| 10 | <secondary>imagedata</secondary></indexterm> |
| 11 | <refentrytitle>imagedata</refentrytitle> |
| 12 | <refmiscinfo>Element</refmiscinfo> |
| 13 | </refmeta> |
| 14 | <refnamediv> |
| 15 | <refname>imagedata</refname> |
| 16 | <refpurpose>&imagedata.purpose;</refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | &imagedata.synopsis.gen; |
| 20 | |
| 21 | <refsect1 condition='ref.description'><title>Description</title> |
| 22 | |
| 23 | <para>This element points to an external entity containing graphical |
| 24 | image data. |
| 25 | </para> |
| 26 | |
| 27 | <refsect2 id="dbreproc.imagedata"><title>Processing expectations</title> |
| 28 | |
| 29 | <para>Render the image. &format.context; |
| 30 | </para> |
| 31 | |
| 32 | <para>There are two ways to provide content for <sgmltag>ImageData</sgmltag>: |
| 33 | <sgmltag class='attribute'>EntityRef</sgmltag> or <sgmltag |
| 34 | class='attribute'>FileRef</sgmltag>. It is best to use only one of these |
| 35 | methods, however, if multiple sources are provided, |
| 36 | <sgmltag class='attribute'>EntityRef</sgmltag> will be used in favor of |
| 37 | <sgmltag class='attribute'>FileRef</sgmltag>. |
| 38 | </para> |
| 39 | |
| 40 | <para><sgmltag>ImageData</sgmltag> provides a selection of attributes |
| 41 | that can be used to control how the image is rendered. These |
| 42 | attributes define two rectangles, the <glossterm>viewport |
| 43 | area</glossterm> and the <glossterm>content area</glossterm>, and how |
| 44 | these rectangles are related to each other. The <glossterm>intrinsic |
| 45 | size</glossterm> of the image is a third rectangle that sometimes |
| 46 | influences the way an image is rendered. |
| 47 | </para> |
| 48 | |
| 49 | <para>It is important to understand the distinction between these |
| 50 | three areas. When rendering an image, the viewport area defines the |
| 51 | space reserved in the flow of content for the image. If a |
| 52 | 6in x 4in viewport area is specified, that's how much space will be |
| 53 | reserved for the image, independent of the actual size of the rendered |
| 54 | image. The content area defines the actual size of the rendered image, |
| 55 | independent of the intrinsic size of the image. The intrinisic size of |
| 56 | the image is its actual, real size. |
| 57 | </para> |
| 58 | |
| 59 | <para>DocBook provides three mutually exclusive mechanisms for specifying |
| 60 | the content area of an image: it can be specified directly, it can be specified |
| 61 | by selecting a scale factor, or it can be specified to be the same size |
| 62 | as the viewport area.</para> |
| 63 | |
| 64 | <para>Finally, DocBook provides two attributes, |
| 65 | <sgmltag class="attribute">align</sgmltag> and |
| 66 | <sgmltag class="attribute">valign</sgmltag> to specify the alignment of |
| 67 | the content area within the viewport area.</para> |
| 68 | |
| 69 | <para>DocBook provides no mechanism for specifying how an image should be |
| 70 | rendered if the content area exceeds the viewport area in either or both |
| 71 | dimensions. Implementations are free to perform clipping, allow the image |
| 72 | to overflow, and/or generate errors.</para> |
| 73 | |
| 74 | <refsect3> |
| 75 | <title>Units of Measure</title> |
| 76 | |
| 77 | <para>The size of the viewport area and the content area are defined |
| 78 | in terms of lengths (width and depth).</para> |
| 79 | |
| 80 | <para>Lengths must be expressed as a decimal value followed |
| 81 | immediately by an optional unit of measure or a percentage. Six and one eight inches, |
| 82 | for example, must be expressed as <quote>6.125in</quote>. It is an error to |
| 83 | put a space or other punctuation between the decimal value and the |
| 84 | unit of measure.</para> |
| 85 | |
| 86 | <para>The following units of measure may be used:</para> |
| 87 | |
| 88 | <simplelist columns="2" type="horiz"> |
| 89 | <member><literal>pt</literal></member><member>Points (1/72 of an inch)</member> |
| 90 | <member><literal>cm</literal></member><member>Centimeters</member> |
| 91 | <member><literal>mm</literal></member><member>Millimeters</member> |
| 92 | <member><literal>in</literal></member><member>Inches</member> |
| 93 | <member><literal>pc</literal></member><member>Picas (1/6 of an inch)</member> |
| 94 | <member><literal>px</literal></member><member>Pixels</member> |
| 95 | <member><literal>em</literal></member><member>Ems</member> |
| 96 | </simplelist> |
| 97 | |
| 98 | <para>If no unit of measure is provided, <literal>px</literal> is |
| 99 | assumed. Note that pixels have no universally accepted absolute size |
| 100 | and ems are relative units of measure. Implementations may define |
| 101 | pixel sizes differently and stylesheets may or may not be able to |
| 102 | determine the current font size in order to correctly calculate the |
| 103 | absolute size of an em. It is best to avoid these units of |
| 104 | measure.</para> |
| 105 | |
| 106 | <para>Percetages are expressed as a decimal value followed immediately by |
| 107 | a <literal>%</literal> sign.</para> |
| 108 | </refsect3> |
| 109 | |
| 110 | <refsect3 id="viewport.area"> |
| 111 | <title>Specifying the Viewport Area</title> |
| 112 | |
| 113 | <para>The viewport area is specified by the <sgmltag |
| 114 | class="attribute">width</sgmltag> and <sgmltag |
| 115 | class="attribute">depth</sgmltag> attributes.</para> |
| 116 | |
| 117 | <para>If neither width nor depth is specified, an implementation is |
| 118 | free to choose defaults. These defaults may be influenced by context. |
| 119 | For example, when rendering an inline graphic, the viewport area often |
| 120 | defaults to the size of the content area. For block graphics, the |
| 121 | width often defaults to the column width while the depth defaults to |
| 122 | the depth of the content area.</para> |
| 123 | |
| 124 | <para>If only one of width or depth is specified, an implementation is |
| 125 | free to choose a default for the other dimension.</para> |
| 126 | |
| 127 | <para>Viewport area dimensions expressed as a percentage are a percentage |
| 128 | of the available area. For example, a width of <literal>50%</literal> |
| 129 | when an implementation is rendering in a column 6in wide is equivalent |
| 130 | to specifying a width of 3in.</para> |
| 131 | |
| 132 | <para>Percentages must be used with care. Some media are unbounded in one |
| 133 | or more directions (for example, web pages are generally unbounded in depth). |
| 134 | Specifying a percentage of an unbounded dimension is undefined. Implementations |
| 135 | may choose arbitrary defaults or may generate errors.</para> |
| 136 | </refsect3> |
| 137 | |
| 138 | <refsect3> |
| 139 | <title>Specifing the Content Area</title> |
| 140 | |
| 141 | <para>The content area is specified by the <sgmltag |
| 142 | class="attribute">contentwidth</sgmltag> and <sgmltag |
| 143 | class="attribute">contentdepth</sgmltag> attributes.</para> |
| 144 | |
| 145 | <para>If neither content width nor content depth is specified, an |
| 146 | implementation is expected to render the image at its intrinsic size |
| 147 | (unless scaling or scaling to fit is requested). |
| 148 | If only one of content width or content depth is specified, an |
| 149 | implementation is expected to choose a default for the other dimension |
| 150 | such that the image is scaled proportionally. For example, if an image |
| 151 | has an intrinsic size of one square inch and the content width is |
| 152 | specified as <literal>2in</literal>, the content depth must default to |
| 153 | <literal>2in</literal>.</para> |
| 154 | |
| 155 | <para>Content area dimensions expressed as a percentage are a percentage |
| 156 | of the intrinsic size of the image.</para> |
| 157 | |
| 158 | <para>Percentages must be used with care. Some implementations may be |
| 159 | unable to determine the intrinsic size of an image and will therefore |
| 160 | be forced to make compromises. Implementations may choose arbitrary |
| 161 | values or may generate errors if the intrinsic size cannot be obtained.</para> |
| 162 | </refsect3> |
| 163 | |
| 164 | <refsect3> |
| 165 | <title>Scaling</title> |
| 166 | |
| 167 | <para>There are two ways that scaling can be specified, with the |
| 168 | <sgmltag class="attribute">scale</sgmltag> attribute or with the |
| 169 | <sgmltag class="attribute">scalefit</sgmltag> attribute.</para> |
| 170 | |
| 171 | <para>If scale is specified, it must be a positive integer. It |
| 172 | is always interpreted to be a percentage value where |
| 173 | <quote><literal>100</literal></quote> represents 100%.</para> |
| 174 | |
| 175 | <para>The legal values of <sgmltag |
| 176 | class="attribute">scalefit</sgmltag> are <literal>0</literal> (false) |
| 177 | or <literal>1</literal> (true). If scaling to fit is requested, the |
| 178 | content area is scaled until <emphasis>either</emphasis> the content |
| 179 | width is the same as the viewport width (and the content depth is less |
| 180 | than or equal to the viewport depth) <emphasis>or</emphasis> the |
| 181 | content depth is the same as the viewport depth (and the content width |
| 182 | is less than or equal to the viewport width), whichever comes first. |
| 183 | In other words, scaling to fit never causes anamorphic scaling, it |
| 184 | simply scales the image as large as possible without overflowing the |
| 185 | bounds of the viewport area. |
| 186 | </para> |
| 187 | |
| 188 | <para>Specification of content area, scaling, and scaling to fit are |
| 189 | mutually exclusive. If a content area (<sgmltag |
| 190 | class="attribute">contentwidth</sgmltag>, <sgmltag |
| 191 | class="attribute">contentdepth</sgmltag>, or both) is specified, |
| 192 | <emphasis>both</emphasis> scaling and scaling to fit are ignored. If |
| 193 | the content area is not specified and both scaling and scaling to fit |
| 194 | are specified, <sgmltag class="attribute">scalefit</sgmltag> is |
| 195 | ignored.</para> |
| 196 | |
| 197 | <para>In order to achieve a level of backwards compatibility with previous |
| 198 | versions of DocBook (which did not have attributes for specifying a content |
| 199 | area) while maintaining coherent semantics, the default value of |
| 200 | <sgmltag class="attribute">scalefit</sgmltag> depends on other attributes:</para> |
| 201 | |
| 202 | <informaltable> |
| 203 | <tgroup cols="3" align="center"> |
| 204 | <thead> |
| 205 | <row> |
| 206 | <entry>Viewport area</entry> |
| 207 | <entry>Content area</entry> |
| 208 | <entry><sgmltag class="attribute">scalefit</sgmltag> default</entry> |
| 209 | </row> |
| 210 | </thead> |
| 211 | <tbody> |
| 212 | <row> |
| 213 | <entry>unspecified</entry> |
| 214 | <entry>unspecified</entry> |
| 215 | <entry>irrelevant</entry> |
| 216 | </row> |
| 217 | <row> |
| 218 | <entry>specified</entry> |
| 219 | <entry>unspecified</entry> |
| 220 | <entry>1</entry> |
| 221 | </row> |
| 222 | <row> |
| 223 | <entry>unspecified</entry> |
| 224 | <entry>specified</entry> |
| 225 | <entry>0</entry> |
| 226 | </row> |
| 227 | <row> |
| 228 | <entry>specified</entry> |
| 229 | <entry>specified</entry> |
| 230 | <entry>0</entry> |
| 231 | </row> |
| 232 | </tbody> |
| 233 | </tgroup> |
| 234 | </informaltable> |
| 235 | |
| 236 | <para>If a viewport area is specified (and neither a content area nor scaling |
| 237 | is specified) and <sgmltag class="attribute">scalefit</sgmltag> is explicitly |
| 238 | <quote><literal>0</literal></quote>, the viewport area specification must |
| 239 | be ignored.</para> |
| 240 | |
| 241 | </refsect3> |
| 242 | |
| 243 | <refsect3> |
| 244 | <title>Alignment</title> |
| 245 | |
| 246 | <para>Two alignment attributes are provided, |
| 247 | <sgmltag class="attribute">align</sgmltag> and |
| 248 | <sgmltag class="attribute">valign</sgmltag>.</para> |
| 249 | |
| 250 | <para>If specified, <sgmltag class="attribute">align</sgmltag> indicates how |
| 251 | the content area should be aligned horizontally within the viewport area. If |
| 252 | not specified, implementations are free to choose any default value.</para> |
| 253 | |
| 254 | <para>If specified, <sgmltag class="attribute">valign</sgmltag> indicates how |
| 255 | the content area should be aligned vertically within the viewport area. If |
| 256 | not specified, implementations are free to choose any default value.</para> |
| 257 | </refsect3> |
| 258 | |
| 259 | <refsect3> |
| 260 | <title>Examples</title> |
| 261 | |
| 262 | <para>If nothing is specified about the size of an image, it is rendered in |
| 263 | a content area that is the same as its intrinsic size in a viewport area that |
| 264 | is implementation defined:</para> |
| 265 | |
| 266 | <informalfigure> |
| 267 | <screen><imagedata fileref="image.png"/></screen> |
| 268 | |
| 269 | <mediaobject> |
| 270 | <imageobject> |
| 271 | <imagedata fileref="figures/graphic-attr-6.png"/> |
| 272 | </imageobject> |
| 273 | <textobject><phrase>An image at its intrinsic size</phrase></textobject> |
| 274 | </mediaobject> |
| 275 | </informalfigure> |
| 276 | |
| 277 | <para>If a viewport area is specified, the image is rendered in a content |
| 278 | area that is the same as its intrinsic size in the specified viewport area: |
| 279 | </para> |
| 280 | |
| 281 | <informalfigure> |
| 282 | <screen><imagedata fileref="image.png" width="6in" depth="5.5in" scalefit="0"/></screen> |
| 283 | |
| 284 | <mediaobject> |
| 285 | <imageobject> |
| 286 | <imagedata fileref="figures/graphic-attr-7.png"/> |
| 287 | </imageobject> |
| 288 | <textobject><phrase>An image at its intrinsic size in a viewport</phrase></textobject> |
| 289 | </mediaobject> |
| 290 | </informalfigure> |
| 291 | |
| 292 | <para>If a content area is specified, the image is scaled (possibly |
| 293 | anamorphically) to that size and rendered in a viewport area that is |
| 294 | implementation defined: |
| 295 | </para> |
| 296 | |
| 297 | <informalfigure> |
| 298 | <screen><imagedata fileref="image.png" contentwidth="4in" contentdepth="3in"/></screen> |
| 299 | |
| 300 | <mediaobject> |
| 301 | <imageobject> |
| 302 | <imagedata fileref="figures/graphic-attr-5.png"/> |
| 303 | </imageobject> |
| 304 | <textobject><phrase>An image at a specified content size</phrase></textobject> |
| 305 | </mediaobject> |
| 306 | </informalfigure> |
| 307 | |
| 308 | <para>If a scaling factor is specified, the intrinsic size is scaled |
| 309 | uniformly by that amount to obtain the content area which is rendered |
| 310 | in a viewport area that is implementation defined: |
| 311 | </para> |
| 312 | |
| 313 | <informalfigure> |
| 314 | <screen><imagedata fileref="image.png" scale="300"/></screen> |
| 315 | |
| 316 | <mediaobject> |
| 317 | <imageobject> |
| 318 | <imagedata fileref="figures/graphic-attr-4.png"/> |
| 319 | </imageobject> |
| 320 | <textobject><phrase>An image scaled</phrase></textobject> |
| 321 | </mediaobject> |
| 322 | </informalfigure> |
| 323 | |
| 324 | <para>If a viewport area is specified and scaling to fit is requested, |
| 325 | the intrinsic size is scaled (uniformly) as large as possible without |
| 326 | extending beyond the bounds of the viewport area which is rendered as |
| 327 | specified. |
| 328 | </para> |
| 329 | |
| 330 | <informalfigure> |
| 331 | <screen><imagedata fileref="image.png" width="6in" depth="5.5in"/> |
| 332 | <!-- note that scalefit="1" is the default in this case --></screen> |
| 333 | |
| 334 | <mediaobject> |
| 335 | <imageobject> |
| 336 | <imagedata fileref="figures/graphic-attr-3.png"/> |
| 337 | </imageobject> |
| 338 | <textobject><phrase>An image scaled to fit</phrase></textobject> |
| 339 | </mediaobject> |
| 340 | </informalfigure> |
| 341 | |
| 342 | <para>If the viewport area and content area are specified, the image |
| 343 | is scaled (possibly anamorphically) to the content area size and rendered in |
| 344 | the specified viewport area: |
| 345 | </para> |
| 346 | |
| 347 | <informalfigure> |
| 348 | <screen><imagedata fileref="image.png" width="6in" depth="5.5in" |
| 349 | contentwidth="4in" contentdepth="3in"/></screen> |
| 350 | |
| 351 | <mediaobject> |
| 352 | <imageobject> |
| 353 | <imagedata fileref="figures/graphic-attr-2.png"/> |
| 354 | </imageobject> |
| 355 | <textobject><phrase>An image at a specified size in a specified viewport</phrase></textobject> |
| 356 | </mediaobject> |
| 357 | </informalfigure> |
| 358 | |
| 359 | <para>If the viewport area and a scaling factor are specified, the |
| 360 | intrinsic size is scaled uniformly by the scaling factor amount to obtain the |
| 361 | content area which is rendered in the specified viewport area: |
| 362 | </para> |
| 363 | |
| 364 | <informalfigure> |
| 365 | <screen><imagedata fileref="image.png" width="6in" depth="5.5in" scale="300"/></screen> |
| 366 | |
| 367 | <mediaobject> |
| 368 | <imageobject> |
| 369 | <imagedata fileref="figures/graphic-attr-1.png"/> |
| 370 | </imageobject> |
| 371 | <textobject><phrase>An image scaled in a specified viewport</phrase></textobject> |
| 372 | </mediaobject> |
| 373 | </informalfigure> |
| 374 | </refsect3> |
| 375 | </refsect2> |
| 376 | |
| 377 | &imagedata.parents.gen; |
| 378 | |
| 379 | </refsect1> |
| 380 | <refsect1 condition='ref.elem.attrdesc'><title>Attributes</title> |
| 381 | |
| 382 | <variablelist> |
| 383 | <varlistentry><term>align</term> |
| 384 | <listitem> |
| 385 | <para> |
| 386 | <sgmltag class="attribute">Align</sgmltag> specifies the horizontal alignment |
| 387 | of the content area in the viewport area. |
| 388 | </para> |
| 389 | </listitem> |
| 390 | </varlistentry> |
| 391 | <varlistentry><term>contentdepth</term> |
| 392 | <listitem> |
| 393 | <para> |
| 394 | <sgmltag class="attribute">ContentDepth</sgmltag> specifies the desired depth of the |
| 395 | content area. |
| 396 | </para> |
| 397 | </listitem> |
| 398 | </varlistentry> |
| 399 | <varlistentry><term>contentwidth</term> |
| 400 | <listitem> |
| 401 | <para> |
| 402 | <sgmltag class="attribute">ContentWidth</sgmltag> specifies the desired width of the |
| 403 | content area. |
| 404 | </para> |
| 405 | </listitem> |
| 406 | </varlistentry> |
| 407 | <varlistentry><term>depth</term> |
| 408 | <listitem> |
| 409 | <para> |
| 410 | <sgmltag class="attribute">Depth</sgmltag> specifies the desired depth of the |
| 411 | viewport area. |
| 412 | </para> |
| 413 | </listitem> |
| 414 | </varlistentry> |
| 415 | <varlistentry><term>entityref</term> |
| 416 | <listitem> |
| 417 | <para> |
| 418 | <sgmltag class="attribute">EntityRef</sgmltag> identifies the general entity |
| 419 | which points to the content of the image data. |
| 420 | </para> |
| 421 | </listitem> |
| 422 | </varlistentry> |
| 423 | <varlistentry><term>fileref</term> |
| 424 | <listitem> |
| 425 | <para> |
| 426 | <sgmltag class="attribute">FileRef</sgmltag> specifies the name of the file |
| 427 | which contains the content of the image data. |
| 428 | </para> |
| 429 | </listitem> |
| 430 | </varlistentry> |
| 431 | <varlistentry><term>format</term> |
| 432 | <listitem> |
| 433 | <para> |
| 434 | <sgmltag class="attribute">Format</sgmltag> identifies the format of the image |
| 435 | data. The <sgmltag class="attribute">Format</sgmltag> must be a defined |
| 436 | notation. |
| 437 | </para> |
| 438 | </listitem> |
| 439 | </varlistentry> |
| 440 | <varlistentry><term>scale</term> |
| 441 | <listitem> |
| 442 | <para> |
| 443 | <sgmltag class="attribute">Scale</sgmltag> is an integer representing |
| 444 | a percentage scaling factor (retaining the relative dimensions of the |
| 445 | original image). If unspecified, the value 100 (100%) is |
| 446 | assumed. |
| 447 | </para> |
| 448 | </listitem> |
| 449 | </varlistentry> |
| 450 | <varlistentry><term>scalefit</term> |
| 451 | <listitem> |
| 452 | <para> |
| 453 | If <sgmltag class="attribute">ScaleFit</sgmltag> has the value 1 (true), then |
| 454 | the image data is to be scaled (uniformly) to the specified width or depth. |
| 455 | The default value of 0 (false) indicates that the image will not be |
| 456 | scaled to fit (although it may still be scaled by the |
| 457 | <sgmltag class="attribute">Scale</sgmltag> attribute). |
| 458 | </para> |
| 459 | </listitem> |
| 460 | </varlistentry> |
| 461 | <varlistentry><term>srccredit</term> |
| 462 | <listitem> |
| 463 | <para> |
| 464 | <sgmltag class="attribute">SrcCredit</sgmltag> contains details about the source |
| 465 | of the image data. |
| 466 | </para> |
| 467 | </listitem> |
| 468 | </varlistentry> |
| 469 | <varlistentry><term>width</term> |
| 470 | <listitem> |
| 471 | <para> |
| 472 | <sgmltag class="attribute">Width</sgmltag> indicates the width of the graphic. |
| 473 | </para> |
| 474 | </listitem> |
| 475 | </varlistentry> |
| 476 | </variablelist> |
| 477 | </refsect1> |
| 478 | <refsect1><title>Examples</title> |
| 479 | |
| 480 | &imagedata.example.seealso.gen; |
| 481 | </refsect1> |
| 482 | </refentry> |
| 483 |