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 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
|
<refentry id="imagedata.element" revision='3.1'>
<?dbhtml filename="imagedata.html"?>
<refentryinfo>
<pubdate>$Date: 2006-02-16 14:50:26 +0100 (Thu, 16 Feb 2006) $</pubdate>
<releaseinfo>$Revision: 5565 $</releaseinfo>
</refentryinfo>
<refmeta>
<indexterm><primary>elements</primary>
<secondary>imagedata</secondary></indexterm>
<refentrytitle>imagedata</refentrytitle>
<refmiscinfo>Element</refmiscinfo>
</refmeta>
<refnamediv>
<refname>imagedata</refname>
<refpurpose>&imagedata.purpose;</refpurpose>
</refnamediv>
&imagedata.synopsis.gen;
<refsect1 condition='ref.description'><title>Description</title>
<para>This element points to an external entity containing graphical
image data.
</para>
<refsect2 id="dbreproc.imagedata"><title>Processing expectations</title>
<para>Render the image. &format.context;
</para>
<para>There are two ways to provide content for <sgmltag>ImageData</sgmltag>:
<sgmltag class='attribute'>EntityRef</sgmltag> or <sgmltag
class='attribute'>FileRef</sgmltag>. It is best to use only one of these
methods, however, if multiple sources are provided,
<sgmltag class='attribute'>EntityRef</sgmltag> will be used in favor of
<sgmltag class='attribute'>FileRef</sgmltag>.
</para>
<para><sgmltag>ImageData</sgmltag> provides a selection of attributes
that can be used to control how the image is rendered. These
attributes define two rectangles, the <glossterm>viewport
area</glossterm> and the <glossterm>content area</glossterm>, and how
these rectangles are related to each other. The <glossterm>intrinsic
size</glossterm> of the image is a third rectangle that sometimes
influences the way an image is rendered.
</para>
<para>It is important to understand the distinction between these
three areas. When rendering an image, the viewport area defines the
space reserved in the flow of content for the image. If a
6in x 4in viewport area is specified, that's how much space will be
reserved for the image, independent of the actual size of the rendered
image. The content area defines the actual size of the rendered image,
independent of the intrinsic size of the image. The intrinisic size of
the image is its actual, real size.
</para>
<para>DocBook provides three mutually exclusive mechanisms for specifying
the content area of an image: it can be specified directly, it can be specified
by selecting a scale factor, or it can be specified to be the same size
as the viewport area.</para>
<para>Finally, DocBook provides two attributes,
<sgmltag class="attribute">align</sgmltag> and
<sgmltag class="attribute">valign</sgmltag> to specify the alignment of
the content area within the viewport area.</para>
<para>DocBook provides no mechanism for specifying how an image should be
rendered if the content area exceeds the viewport area in either or both
dimensions. Implementations are free to perform clipping, allow the image
to overflow, and/or generate errors.</para>
<refsect3>
<title>Units of Measure</title>
<para>The size of the viewport area and the content area are defined
in terms of lengths (width and depth).</para>
<para>Lengths must be expressed as a decimal value followed
immediately by an optional unit of measure or a percentage. Six and one eight inches,
for example, must be expressed as <quote>6.125in</quote>. It is an error to
put a space or other punctuation between the decimal value and the
unit of measure.</para>
<para>Examples of common units of measure include:</para>
<simplelist columns="2" type="horiz">
<member><literal>pt</literal></member><member>Points (1/72 of an inch)</member>
<member><literal>cm</literal></member><member>Centimeters</member>
<member><literal>mm</literal></member><member>Millimeters</member>
<member><literal>in</literal></member><member>Inches</member>
<member><literal>pc</literal></member><member>Picas (1/6 of an inch)</member>
<member><literal>px</literal></member><member>Pixels</member>
<member><literal>em</literal></member><member>Ems</member>
</simplelist>
<para>If no unit of measure is provided, <literal>px</literal> is
assumed. Note that pixels have no universally accepted absolute size
and ems are relative units of measure. Implementations may define
pixel sizes differently and stylesheets may or may not be able to
determine the current font size in order to correctly calculate the
absolute size of an em. It is best to avoid these units of
measure.</para>
<para>Percetages are expressed as a decimal value followed immediately by
a <literal>%</literal> sign.</para>
</refsect3>
<refsect3 id="viewport.area">
<title>Specifying the Viewport Area</title>
<para>The viewport area is specified by the <sgmltag
class="attribute">width</sgmltag> and <sgmltag
class="attribute">depth</sgmltag> attributes.</para>
<para>If neither width nor depth is specified, an implementation is
free to choose defaults. These defaults may be influenced by context.
For example, when rendering an inline graphic, the viewport area often
defaults to the size of the content area. For block graphics, the
width often defaults to the column width while the depth defaults to
the depth of the content area.</para>
<para>If only one of width or depth is specified, an implementation is
free to choose a default for the other dimension.</para>
<para>Viewport area dimensions expressed as a percentage are a percentage
of the available area. For example, a width of <literal>50%</literal>
when an implementation is rendering in a column 6in wide is equivalent
to specifying a width of 3in.</para>
<para>Percentages must be used with care. Some media are unbounded in one
or more directions (for example, web pages are generally unbounded in depth).
Specifying a percentage of an unbounded dimension is undefined. Implementations
may choose arbitrary defaults or may generate errors.</para>
</refsect3>
<refsect3>
<title>Specifing the Content Area</title>
<para>The content area is specified by the <sgmltag
class="attribute">contentwidth</sgmltag> and <sgmltag
class="attribute">contentdepth</sgmltag> attributes.</para>
<para>If neither content width nor content depth is specified, an
implementation is expected to render the image at its intrinsic size
(unless scaling or scaling to fit is requested).
If only one of content width or content depth is specified, an
implementation is expected to choose a default for the other dimension
such that the image is scaled proportionally. For example, if an image
has an intrinsic size of one square inch and the content width is
specified as <literal>2in</literal>, the content depth must default to
<literal>2in</literal>.</para>
<para>Content area dimensions expressed as a percentage are a percentage
of the intrinsic size of the image.</para>
<para>Percentages must be used with care. Some implementations may be
unable to determine the intrinsic size of an image and will therefore
be forced to make compromises. Implementations may choose arbitrary
values or may generate errors if the intrinsic size cannot be obtained.</para>
</refsect3>
<refsect3>
<title>Scaling</title>
<para>There are two ways that scaling can be specified, with the
<sgmltag class="attribute">scale</sgmltag> attribute or with the
<sgmltag class="attribute">scalefit</sgmltag> attribute.</para>
<para>If scale is specified, it must be a positive integer. It
is always interpreted to be a percentage value where
<quote><literal>100</literal></quote> represents 100%.</para>
<para>The legal values of <sgmltag
class="attribute">scalefit</sgmltag> are <literal>0</literal> (false)
or <literal>1</literal> (true). If scaling to fit is requested, the
content area is scaled until <emphasis>either</emphasis> the content
width is the same as the viewport width (and the content depth is less
than or equal to the viewport depth) <emphasis>or</emphasis> the
content depth is the same as the viewport depth (and the content width
is less than or equal to the viewport width), whichever comes first.
In other words, scaling to fit never causes anamorphic scaling, it
simply scales the image as large as possible without overflowing the
bounds of the viewport area.
</para>
<para>Specification of content area, scaling, and scaling to fit are
mutually exclusive. If a content area (<sgmltag
class="attribute">contentwidth</sgmltag>, <sgmltag
class="attribute">contentdepth</sgmltag>, or both) is specified,
<emphasis>both</emphasis> scaling and scaling to fit are ignored. If
the content area is not specified and both scaling and scaling to fit
are specified, <sgmltag class="attribute">scalefit</sgmltag> is
ignored.</para>
<para>In order to achieve a level of backwards compatibility with previous
versions of DocBook (which did not have attributes for specifying a content
area) while maintaining coherent semantics, the default value of
<sgmltag class="attribute">scalefit</sgmltag> depends on other attributes:</para>
<informaltable>
<tgroup cols="3" align="center">
<thead>
<row>
<entry>Viewport area</entry>
<entry>Content area</entry>
<entry><sgmltag class="attribute">scalefit</sgmltag> default</entry>
</row>
</thead>
<tbody>
<row>
<entry>unspecified</entry>
<entry>unspecified</entry>
<entry>irrelevant</entry>
</row>
<row>
<entry>specified</entry>
<entry>unspecified</entry>
<entry>1</entry>
</row>
<row>
<entry>unspecified</entry>
<entry>specified</entry>
<entry>0</entry>
</row>
<row>
<entry>specified</entry>
<entry>specified</entry>
<entry>0</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>If a viewport area is specified (and neither a content area nor scaling
is specified) and <sgmltag class="attribute">scalefit</sgmltag> is explicitly
<quote><literal>0</literal></quote>, the viewport area specification must
be ignored.</para>
</refsect3>
<refsect3>
<title>Alignment</title>
<para>Two alignment attributes are provided,
<sgmltag class="attribute">align</sgmltag> and
<sgmltag class="attribute">valign</sgmltag>.</para>
<para>If specified, <sgmltag class="attribute">align</sgmltag> indicates how
the content area should be aligned horizontally within the viewport area. If
not specified, implementations are free to choose any default value.</para>
<para>If specified, <sgmltag class="attribute">valign</sgmltag> indicates how
the content area should be aligned vertically within the viewport area. If
not specified, implementations are free to choose any default value.</para>
</refsect3>
<refsect3>
<title>Examples</title>
<para>If nothing is specified about the size of an image, it is rendered in
a content area that is the same as its intrinsic size in a viewport area that
is implementation defined:</para>
<informalfigure>
<screen><imagedata fileref="image.png"/></screen>
<mediaobject>
<imageobject>
<imagedata fileref="figures/graphic-attr-6.png"/>
</imageobject>
<textobject><phrase>An image at its intrinsic size</phrase></textobject>
</mediaobject>
</informalfigure>
<para>If a viewport area is specified, the image is rendered in a content
area that is the same as its intrinsic size in the specified viewport area:
</para>
<informalfigure>
<screen><imagedata fileref="image.png" width="6in" depth="5.5in" scalefit="0"/></screen>
<mediaobject>
<imageobject>
<imagedata fileref="figures/graphic-attr-7.png"/>
</imageobject>
<textobject><phrase>An image at its intrinsic size in a viewport</phrase></textobject>
</mediaobject>
</informalfigure>
<para>If a content area is specified, the image is scaled (possibly
anamorphically) to that size and rendered in a viewport area that is
implementation defined:
</para>
<informalfigure>
<screen><imagedata fileref="image.png" contentwidth="4in" contentdepth="3in"/></screen>
<mediaobject>
<imageobject>
<imagedata fileref="figures/graphic-attr-5.png"/>
</imageobject>
<textobject><phrase>An image at a specified content size</phrase></textobject>
</mediaobject>
</informalfigure>
<para>If a scaling factor is specified, the intrinsic size is scaled
uniformly by that amount to obtain the content area which is rendered
in a viewport area that is implementation defined:
</para>
<informalfigure>
<screen><imagedata fileref="image.png" scale="300"/></screen>
<mediaobject>
<imageobject>
<imagedata fileref="figures/graphic-attr-4.png"/>
</imageobject>
<textobject><phrase>An image scaled</phrase></textobject>
</mediaobject>
</informalfigure>
<para>If a viewport area is specified and scaling to fit is requested,
the intrinsic size is scaled (uniformly) as large as possible without
extending beyond the bounds of the viewport area which is rendered as
specified.
</para>
<informalfigure>
<screen><imagedata fileref="image.png" width="6in" depth="5.5in"/>
<!-- note that scalefit="1" is the default in this case --></screen>
<mediaobject>
<imageobject>
<imagedata fileref="figures/graphic-attr-3.png"/>
</imageobject>
<textobject><phrase>An image scaled to fit</phrase></textobject>
</mediaobject>
</informalfigure>
<para>If the viewport area and content area are specified, the image
is scaled (possibly anamorphically) to the content area size and rendered in
the specified viewport area:
</para>
<informalfigure>
<screen><imagedata fileref="image.png" width="6in" depth="5.5in"
contentwidth="4in" contentdepth="3in"/></screen>
<mediaobject>
<imageobject>
<imagedata fileref="figures/graphic-attr-2.png"/>
</imageobject>
<textobject><phrase>An image at a specified size in a specified viewport</phrase></textobject>
</mediaobject>
</informalfigure>
<para>If the viewport area and a scaling factor are specified, the
intrinsic size is scaled uniformly by the scaling factor amount to obtain the
content area which is rendered in the specified viewport area:
</para>
<informalfigure>
<screen><imagedata fileref="image.png" width="6in" depth="5.5in" scale="300"/></screen>
<mediaobject>
<imageobject>
<imagedata fileref="figures/graphic-attr-1.png"/>
</imageobject>
<textobject><phrase>An image scaled in a specified viewport</phrase></textobject>
</mediaobject>
</informalfigure>
</refsect3>
</refsect2>
&imagedata.parents.gen;
</refsect1>
<refsect1 condition='ref.elem.attrdesc'><title>Attributes</title>
<variablelist>
<varlistentry><term>align</term>
<listitem>
<para>
<sgmltag class="attribute">Align</sgmltag> specifies the horizontal alignment
of the content area in the viewport area.
</para>
</listitem>
</varlistentry>
<varlistentry><term>contentdepth</term>
<listitem>
<para>
<sgmltag class="attribute">ContentDepth</sgmltag> specifies the desired depth of the
content area.
</para>
</listitem>
</varlistentry>
<varlistentry><term>contentwidth</term>
<listitem>
<para>
<sgmltag class="attribute">ContentWidth</sgmltag> specifies the desired width of the
content area.
</para>
</listitem>
</varlistentry>
<varlistentry><term>depth</term>
<listitem>
<para>
<sgmltag class="attribute">Depth</sgmltag> specifies the desired depth of the
viewport area.
</para>
</listitem>
</varlistentry>
<varlistentry><term>entityref</term>
<listitem>
<para>
<sgmltag class="attribute">EntityRef</sgmltag> identifies the general entity
which points to the content of the image data.
</para>
</listitem>
</varlistentry>
<varlistentry><term>fileref</term>
<listitem>
<para>
<sgmltag class="attribute">FileRef</sgmltag> specifies the name of the file
which contains the content of the image data.
</para>
</listitem>
</varlistentry>
<varlistentry><term>format</term>
<listitem>
<para>
<sgmltag class="attribute">Format</sgmltag> identifies the format of the image
data. The <sgmltag class="attribute">Format</sgmltag> must be a defined
notation.
</para>
</listitem>
</varlistentry>
<varlistentry><term>scale</term>
<listitem>
<para>
<sgmltag class="attribute">Scale</sgmltag> is an integer representing
a percentage scaling factor (retaining the relative dimensions of the
original image). If unspecified, the value 100 (100%) is
assumed.
</para>
</listitem>
</varlistentry>
<varlistentry><term>scalefit</term>
<listitem>
<para>
If <sgmltag class="attribute">ScaleFit</sgmltag> has the value 1 (true), then
the image data is to be scaled (uniformly) to the specified width or depth.
The default value of 0 (false) indicates that the image will not be
scaled to fit (although it may still be scaled by the
<sgmltag class="attribute">Scale</sgmltag> attribute).
</para>
</listitem>
</varlistentry>
<varlistentry><term>srccredit</term>
<listitem>
<para>
<sgmltag class="attribute">SrcCredit</sgmltag> contains details about the source
of the image data.
</para>
</listitem>
</varlistentry>
<varlistentry><term>width</term>
<listitem>
<para>
<sgmltag class="attribute">Width</sgmltag> indicates the width of the graphic.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Examples</title>
&imagedata.example.seealso.gen;
</refsect1>
</refentry>
|