Mercurial > hg > xemacs-beta
comparison man/lispref/glyphs.texi @ 2953:c7d4a681eb2c
[xemacs-hg @ 2005-09-26 08:41:45 by ben]
add specifier-instantiator and friends
specifier.c: Add `specifier-instantiator' and related primitives.
lispref/glyphs.texi, lispref/lispref.texi, lispref/specifiers.texi: Use "instantiation" not "instancing". Fix some places where
"specifier" is used to mean "instantiator".
author | ben |
---|---|
date | Mon, 26 Sep 2005 08:41:57 +0000 |
parents | 13a418960a88 |
children | 1cecc3e9f0a0 |
comparison
equal
deleted
inserted
replaced
2952:861a7995b9fe | 2953:c7d4a681eb2c |
---|---|
86 | 86 |
87 @node Images | 87 @node Images |
88 @section Images | 88 @section Images |
89 | 89 |
90 @menu | 90 @menu |
91 * Image Specifiers:: Specifying an image's appearance. | 91 * Image Instantiators:: Specifying an image's appearance. |
92 * Image Instantiator Conversion:: Lazy realization of graphics. | 92 * Image Instantiator Conversion:: Lazy realization of graphics. |
93 * Image Instantiator Formats:: A catalog of image descriptors. | 93 * Image Instantiator Formats:: A catalog of image descriptors. |
94 * Image Instances:: Classes of graphical objects. | 94 * Image Instances:: Classes of graphical objects. |
95 @end menu | 95 @end menu |
96 | 96 |
97 | 97 |
98 @node Image Specifiers | 98 @node Image Instantiators |
99 @subsection Image Specifiers | 99 @subsection Image Instantiators |
100 @cindex image specifiers | 100 @cindex image instantiators |
101 | 101 |
102 An image specifier is a description of the actual graphical | 102 An @dfn{image instantiator} is a description of the actual graphical |
103 realization of a glyph. For example, a typical image description is | 103 realization of a glyph. For example, a typical image description is |
104 @emph{the file system path to a PNG file}. Since redisplay doesn't know | 104 @emph{the file system path to a PNG file}. Since redisplay doesn't know |
105 about files, and in any case the image may need to be manipulated | 105 about files, and in any case the image may need to be manipulated |
106 (@emph{e.g.}, a face's background pixmap must be clipped and tiled), the | 106 (@emph{e.g.}, a face's background pixmap must be clipped and tiled), the |
107 PNG file must be converted internally to a window system bitmap or | 107 PNG file must be converted internally to a window system bitmap or |
108 pixmap object. We describe this process by writing that when XEmacs | 108 pixmap object. We describe this process by writing that when XEmacs |
109 displays the image, it @dfn{instantiates} the @dfn{image instantiator} | 109 displays the image, it @dfn{instantiates} the image instantiator |
110 into an @dfn{image instance}. Image instances are an internal object | 110 into an @dfn{image instance}. Image instances are an internal object |
111 type (similar to font instances and color instances), describing how the | 111 type (similar to font instances and color instances), describing how the |
112 image appears in a particular domain. On the other hand, image | 112 image appears in a particular domain. On the other hand, image |
113 instantiators, which are just descriptions of how the image should | 113 instantiators, which are just descriptions of how the image should |
114 appear, are represented using Lisp strings or vectors. | 114 appear, are represented using Lisp strings or vectors. |
115 | 115 |
116 Furthermore the graphical realization will vary, and for some devices | 116 Furthermore the graphical realization will vary, and for some devices |
117 may not even be a bitmapped graphic. These variations may be controlled | 117 may not even be a bitmapped graphic. These variations may be |
118 by the program by specifying different @dfn{image instantiators} in | 118 controlled by the program by specifying different instantiators in |
119 different locales. This is implemented with an @dfn{image specifier}, | 119 different locales. This is implemented with an @dfn{image specifier}, |
120 a specifier whose specifications are image instantiators. | 120 a specifier whose specifications are image instantiators. |
121 | 121 |
122 Image specifiers are rarely if ever found by themselves. However, an | 122 Image specifiers are rarely if ever found by themselves. However, an |
123 image specifier results from calling @code{glyph-image} on a glyph, or | 123 image specifier results from calling @code{glyph-image} on a glyph, or |
154 pointers]; etc.) | 154 pointers]; etc.) |
155 | 155 |
156 It is important to keep the distinction between image instantiator | 156 It is important to keep the distinction between image instantiator |
157 format and image instance type in mind. Typically, a given image | 157 format and image instance type in mind. Typically, a given image |
158 instantiator format can result in many different image instance types. | 158 instantiator format can result in many different image instance types. |
159 For example, @code{xpm} can be instanced as @code{color-pixmap}, | 159 For example, @code{xpm} can be instantiated as @code{color-pixmap}, |
160 @code{mono-pixmap}, or @code{pointer}; whereas @code{cursor-font} can be | 160 @code{mono-pixmap}, or @code{pointer}; whereas @code{cursor-font} can be |
161 instanced only as @code{pointer}. On the other hand, a particular image | 161 instantiated only as @code{pointer}. On the other hand, a particular image |
162 instance type can be generated by many different image instantiator | 162 instance type can be generated by many different image instantiator |
163 formats (e.g. @code{color-pixmap} can be generated by @code{xpm}, | 163 formats (e.g. @code{color-pixmap} can be generated by @code{xpm}, |
164 @code{gif}, @code{jpeg}, etc.). | 164 @code{gif}, @code{jpeg}, etc.). |
165 | 165 |
166 @xref{Image Instances}, for a more detailed discussion of image | 166 @xref{Image Instances}, for a more detailed discussion of image |
370 are usable with each, and the kinds of instances that may result. | 370 are usable with each, and the kinds of instances that may result. |
371 | 371 |
372 @table @code | 372 @table @code |
373 @item nothing | 373 @item nothing |
374 Don't display anything; no keywords are valid for this format. Can only be | 374 Don't display anything; no keywords are valid for this format. Can only be |
375 instanced as @code{nothing}. | 375 instantiated as @code{nothing}. |
376 | 376 |
377 @item string | 377 @item string |
378 Display this image as a text string. Can only be instanced | 378 Display this image as a text string. Can only be instantiated |
379 as @code{text}, although support for instancing as @code{mono-pixmap} | 379 as @code{text}, although support for instantiation as @code{mono-pixmap} |
380 should be added. The valid keyword is @code{:data}. The value should | 380 should be added. The valid keyword is @code{:data}. The value should |
381 be a string, and it is interpreted as a string of characters. | 381 be a string, and it is interpreted as a string of characters. |
382 | 382 |
383 @item formatted-string | 383 @item formatted-string |
384 Display this image as a text string with replaceable fields, | 384 Display this image as a text string with replaceable fields, |
430 @end table | 430 @end table |
431 | 431 |
432 @item xpm | 432 @item xpm |
433 An XPM pixmap; only available if XPM support was compiled into this XEmacs. | 433 An XPM pixmap; only available if XPM support was compiled into this XEmacs. |
434 | 434 |
435 Can be instanced as @code{color-pixmap}, @code{mono-pixmap}, or | 435 Can be instantiated as @code{color-pixmap}, @code{mono-pixmap}, or |
436 @code{pointer}. | 436 @code{pointer}. |
437 | 437 |
438 XPM is an add-on library for X that was designed to rectify the | 438 XPM is an add-on library for X that was designed to rectify the |
439 shortcomings of the XBM format. Many icons and labels used in the | 439 shortcomings of the XBM format. Many icons and labels used in the |
440 XEmacs GUI are still distributed in XPM format (although we are moving | 440 XEmacs GUI are still distributed in XPM format (although we are moving |
474 | 474 |
475 @item xface | 475 @item xface |
476 An X-Face bitmap, used to encode people's faces in e-mail messages; | 476 An X-Face bitmap, used to encode people's faces in e-mail messages; |
477 only available if X-Face support was compiled into this XEmacs. | 477 only available if X-Face support was compiled into this XEmacs. |
478 | 478 |
479 Will be instanced as @code{mono-pixmap}, @code{color-pixmap}, or | 479 Will be instantiated as @code{mono-pixmap}, @code{color-pixmap}, or |
480 @code{pointer}, depending on the target instance type and the presence | 480 @code{pointer}, depending on the target instance type and the presence |
481 of color keywords. | 481 of color keywords. |
482 | 482 |
483 The valid keywords and their values are | 483 The valid keywords and their values are |
484 @table @code | 484 @table @code |
524 places'') and linked into the build. | 524 places'') and linked into the build. |
525 | 525 |
526 Note that PNG is the standard format for images distributed with XEmacs, | 526 Note that PNG is the standard format for images distributed with XEmacs, |
527 so it is highly recommended that PNG support be built in. | 527 so it is highly recommended that PNG support be built in. |
528 | 528 |
529 All of these instantiators will be instanced as @code{color-pixmap}. | 529 All of these instantiators will be instantiated as @code{color-pixmap}. |
530 | 530 |
531 The valid keywords and their values are | 531 The valid keywords and their values are |
532 @table @code | 532 @table @code |
533 @item :data | 533 @item :data |
534 A string interpreted as the contents of a file containing data in the | 534 A string interpreted as the contents of a file containing data in the |
537 The name of a file containing standard-format data. | 537 The name of a file containing standard-format data. |
538 @end table | 538 @end table |
539 | 539 |
540 @item cursor-font | 540 @item cursor-font |
541 Most window systems provide a set of standard cursors, which in X11 is | 541 Most window systems provide a set of standard cursors, which in X11 is |
542 called a cursor font. Can only be instanced as @code{pointer}. This | 542 called a cursor font. Can only be instantiated as @code{pointer}. This |
543 should probably be fixed. | 543 should probably be fixed. |
544 | 544 |
545 The valid keyword is @code{:data}. Its value should be a string | 545 The valid keyword is @code{:data}. Its value should be a string |
546 containing one of the standard cursor-font names, such as @samp{watch} | 546 containing one of the standard cursor-font names, such as @samp{watch} |
547 or @samp{right_ptr} under X. More specifically, in the X Window System | 547 or @samp{right_ptr} under X. More specifically, in the X Window System |
553 | 553 |
554 @item font | 554 @item font |
555 A glyph from a font; i.e. the name of a font, and glyph index into it | 555 A glyph from a font; i.e. the name of a font, and glyph index into it |
556 of the form @samp{@var{font} fontname index [[mask-font] mask-index]}. | 556 of the form @samp{@var{font} fontname index [[mask-font] mask-index]}. |
557 Only if X support was compiled into this XEmacs. Currently can only be | 557 Only if X support was compiled into this XEmacs. Currently can only be |
558 instanced as @code{pointer}. This should probably be fixed. | 558 instantiated as @code{pointer}. This should probably be fixed. |
559 @c #### The above description is not very helpful, so it's not obvious | 559 @c #### The above description is not very helpful, so it's not obvious |
560 @c how to instantiate a font image. | 560 @c how to instantiate a font image. |
561 | 561 |
562 @item mswindows-resource | 562 @item mswindows-resource |
563 An MS Windows pointer resource. Specifies a resource to retrieve | 563 An MS Windows pointer resource. Specifies a resource to retrieve |
564 directly from the system (an OEM resource) or from a file, particularly | 564 directly from the system (an OEM resource) or from a file, particularly |
565 an executable file. Can be instanced as @code{pointer} or | 565 an executable file. Can be instantiated as @code{pointer} or |
566 @code{color-pixmap}. | 566 @code{color-pixmap}. |
567 | 567 |
568 The valid keywords and their values are | 568 The valid keywords and their values are |
569 | 569 |
570 @table @code | 570 @table @code |
599 | 599 |
600 "sample", "hand", "ques", "bang", "note", and "winlogo". | 600 "sample", "hand", "ques", "bang", "note", and "winlogo". |
601 @end table | 601 @end table |
602 | 602 |
603 @item subwindow | 603 @item subwindow |
604 An embedded windowing system window. Can only be instanced as | 604 An embedded windowing system window. Can only be instantiated as |
605 @code{subwindow}. Not implemented. | 605 @code{subwindow}. Not implemented. |
606 @c #### Check status of subwindows ... I thought Andy implemented them. | 606 @c #### Check status of subwindows ... I thought Andy implemented them. |
607 | 607 |
608 @item button | 608 @item button |
609 A button widget; either a push button, radio button or toggle button. | 609 A button widget; either a push button, radio button or toggle button. |
610 Can only be instanced as @code{widget}. | 610 Can only be instantiated as @code{widget}. |
611 | 611 |
612 @item combo-box | 612 @item combo-box |
613 A drop list of selectable items in a widget, for editing text. | 613 A drop list of selectable items in a widget, for editing text. |
614 Can only be instanced as @code{widget}. | 614 Can only be instantiated as @code{widget}. |
615 | 615 |
616 @item edit-field | 616 @item edit-field |
617 A text editing widget. Can only be instanced as @code{widget}. | 617 A text editing widget. Can only be instantiated as @code{widget}. |
618 | 618 |
619 @item label | 619 @item label |
620 A static, text-only, widget; for displaying text. Can only be instanced | 620 A static, text-only, widget; for displaying text. Can only be instantiated |
621 as @code{widget}. | 621 as @code{widget}. |
622 | 622 |
623 @item layout | 623 @item layout |
624 A widget for controlling the positioning of children underneath it. | 624 A widget for controlling the positioning of children underneath it. |
625 Through the use of nested layouts, a widget hierarchy can be created | 625 Through the use of nested layouts, a widget hierarchy can be created |
626 which can have the appearance of any standard dialog box or similar | 626 which can have the appearance of any standard dialog box or similar |
627 arrangement; all of this is counted as one @dfn{glyph} and could appear | 627 arrangement; all of this is counted as one @dfn{glyph} and could appear |
628 in many of the places that expect a single glyph. Can only be instanced | 628 in many of the places that expect a single glyph. Can only be instantiated |
629 as @code{widget}. | 629 as @code{widget}. |
630 | 630 |
631 @item native-layout | 631 @item native-layout |
632 The native version of a layout widget. | 632 The native version of a layout widget. |
633 Can only be instanced as @code{widget}. | 633 Can only be instantiated as @code{widget}. |
634 | 634 |
635 @item progress-gauge | 635 @item progress-gauge |
636 A sliding widget, for showing progress. Can only be instanced as | 636 A sliding widget, for showing progress. Can only be instantiated as |
637 @code{widget}. | 637 @code{widget}. |
638 | 638 |
639 @item tab-control | 639 @item tab-control |
640 A tab widget; a series of user selectable tabs. Can only be instanced | 640 A tab widget; a series of user selectable tabs. Can only be instantiated |
641 as @code{widget}. | 641 as @code{widget}. |
642 | 642 |
643 The required keyword is @code{:items}. Its value should be a list of | 643 The required keyword is @code{:items}. Its value should be a list of |
644 vectors, whose first element is a string, the second element is a | 644 vectors, whose first element is a string, the second element is a |
645 callback (a Lisp expression to be eval'ed), and the remaining elements | 645 callback (a Lisp expression to be eval'ed), and the remaining elements |
652 and @code{:pixel-height} (positive integers). | 652 and @code{:pixel-height} (positive integers). |
653 | 653 |
654 (The above is incomplete and may be inaccurate.) | 654 (The above is incomplete and may be inaccurate.) |
655 | 655 |
656 @item tree-view | 656 @item tree-view |
657 A folding widget. Can only be instanced as @code{widget}. | 657 A folding widget. Can only be instantiated as @code{widget}. |
658 | 658 |
659 @item scrollbar | 659 @item scrollbar |
660 A scrollbar widget. Can only be instanced as @code{widget}. | 660 A scrollbar widget. Can only be instantiated as @code{widget}. |
661 | 661 |
662 @item autodetect | 662 @item autodetect |
663 XEmacs tries to guess what format the data is in. If X support exists, | 663 XEmacs tries to guess what format the data is in. If X support exists, |
664 the data string will be checked to see if it names a filename. If so, | 664 the data string will be checked to see if it names a filename. If so, |
665 and this filename contains XBM or XPM data, the appropriate sort of | 665 and this filename contains XBM or XPM data, the appropriate sort of |
670 Otherwise, the image will be displayed as text. If no X support exists, | 670 Otherwise, the image will be displayed as text. If no X support exists, |
671 the image will always be displayed as text. | 671 the image will always be displayed as text. |
672 | 672 |
673 @item inherit | 673 @item inherit |
674 Inherit from the background-pixmap property of a face. Can only be | 674 Inherit from the background-pixmap property of a face. Can only be |
675 instanced as @code{mono-pixmap}. | 675 instantiated as @code{mono-pixmap}. |
676 @end table | 676 @end table |
677 | 677 |
678 There are two convenience variables for use with the XBM and XPM image | 678 There are two convenience variables for use with the XBM and XPM image |
679 formats. | 679 formats. |
680 | 680 |
717 @defun image-instance-p object | 717 @defun image-instance-p object |
718 This function returns non-@code{nil} if @var{object} is an image instance. | 718 This function returns non-@code{nil} if @var{object} is an image instance. |
719 @end defun | 719 @end defun |
720 | 720 |
721 @menu | 721 @menu |
722 * Image Instance Types:: Each image instances has a particular type. | 722 * Image Instance Types:: Each image instance has a particular type. |
723 * Image Instance Functions:: Functions for working with image instances. | 723 * Image Instance Functions:: Functions for working with image instances. |
724 @end menu | 724 @end menu |
725 | 725 |
726 | 726 |
727 @node Image Instance Types | 727 @node Image Instance Types |
832 | 832 |
833 @defun make-image-instance data &optional domain dest-types noerror | 833 @defun make-image-instance data &optional domain dest-types noerror |
834 This function creates a new image-instance object. | 834 This function creates a new image-instance object. |
835 | 835 |
836 @var{data} is an image instantiator, which describes the image | 836 @var{data} is an image instantiator, which describes the image |
837 (@pxref{Image Specifiers}). | 837 (@pxref{Image Instantiators}). |
838 | 838 |
839 @var{dest-types} should be a list of allowed image instance types that | 839 @var{dest-types} should be a list of allowed image instance types that |
840 can be generated. The @var{dest-types} list is unordered. If multiple | 840 can be generated. The @var{dest-types} list is unordered. If multiple |
841 destination types are possible for a given instantiator, the ``most | 841 destination types are possible for a given instantiator, the ``most |
842 natural'' type for the instantiator's format is chosen. These are | 842 natural'' type for the instantiator's format is chosen. These are |
989 This function returns the Y coordinate of the image instance's hotspot, | 989 This function returns the Y coordinate of the image instance's hotspot, |
990 if known. | 990 if known. |
991 @end defun | 991 @end defun |
992 | 992 |
993 Mono pixmaps and pointers may have their foreground and background | 993 Mono pixmaps and pointers may have their foreground and background |
994 colors set when instanced. Use these functions to access color | 994 colors set when instantiated. Use these functions to access color |
995 information. | 995 information. |
996 | 996 |
997 @defun image-instance-foreground image-instance | 997 @defun image-instance-foreground image-instance |
998 This function returns the foreground color of @var{image-instance}, if | 998 This function returns the foreground color of @var{image-instance}, if |
999 applicable. This will be a color instance or @code{nil}. (It will only | 999 applicable. This will be a color instance or @code{nil}. (It will only |
1102 vector according to @code{console-type-image-conversion-list}, or a | 1102 vector according to @code{console-type-image-conversion-list}, or a |
1103 vector. The vector's first element specifies the @emph{external} format | 1103 vector. The vector's first element specifies the @emph{external} format |
1104 of the data, such as a string, a PNG file, or an MS Windows resource. | 1104 of the data, such as a string, a PNG file, or an MS Windows resource. |
1105 This is followed by properties (keyword-value pairs) specifying such | 1105 This is followed by properties (keyword-value pairs) specifying such |
1106 information as the name of a file containing an image, or pixmap data | 1106 information as the name of a file containing an image, or pixmap data |
1107 directly. @xref{Image Specifiers}. | 1107 directly. @xref{Image Instantiators}. |
1108 | 1108 |
1109 The optional @var{type} specifies the type of the glyph. @var{type} | 1109 The optional @var{type} specifies the type of the glyph. @var{type} |
1110 should be one of @code{buffer} (used for glyphs in an extent, the | 1110 should be one of @code{buffer} (used for glyphs in an extent, the |
1111 modeline, the toolbar, or elsewhere in a frame), @code{pointer} (used | 1111 modeline, the toolbar, or elsewhere in a frame), @code{pointer} (used |
1112 for the mouse-pointer), or @code{icon} (used for a frame's icon), and | 1112 for the mouse-pointer), or @code{icon} (used for a frame's icon), and |
1486 @subsubsection Lisp API to Native Widgets | 1486 @subsubsection Lisp API to Native Widgets |
1487 | 1487 |
1488 Native widgets are manipulated as @emph{glyphs} (@pxref{Glyphs}). Thus | 1488 Native widgets are manipulated as @emph{glyphs} (@pxref{Glyphs}). Thus |
1489 they are created using @code{make-glyph}, with a format of one of the | 1489 they are created using @code{make-glyph}, with a format of one of the |
1490 widget types and a @code{:data} property specific to the widget being | 1490 widget types and a @code{:data} property specific to the widget being |
1491 instanced. | 1491 instantiated. |
1492 | 1492 |
1493 However, there is a technical difference between widgets and other kinds | 1493 However, there is a technical difference between widgets and other kinds |
1494 of glyphs that is theoretically important. Because widgets | 1494 of glyphs that is theoretically important. Because widgets |
1495 are active (that is, they can respond to user input events themselves), | 1495 are active (that is, they can respond to user input events themselves), |
1496 it is possible for the user to become aware that two appearances of the | 1496 it is possible for the user to become aware that two appearances of the |
1836 frame or device, if it is not overridden by a more specific | 1836 frame or device, if it is not overridden by a more specific |
1837 specification. | 1837 specification. |
1838 | 1838 |
1839 If @var{property} does not name a built-in property, its value will | 1839 If @var{property} does not name a built-in property, its value will |
1840 simply be returned unless it is a specifier object, in which case it | 1840 simply be returned unless it is a specifier object, in which case it |
1841 will be instanced using @code{specifier-instance}. | 1841 will be instantiated using @code{specifier-instance}. |
1842 | 1842 |
1843 Optional arguments @var{default} and @var{no-fallback} are the same as | 1843 Optional arguments @var{default} and @var{no-fallback} are the same as |
1844 in @code{specifier-instance}. @xref{Specifiers}. | 1844 in @code{specifier-instance}. @xref{Specifiers}. |
1845 @end defun | 1845 @end defun |
1846 | 1846 |
2063 | 2063 |
2064 The parameters passed to @code{make-glyph} are called "Image | 2064 The parameters passed to @code{make-glyph} are called "Image |
2065 Specifiers", and can handle more image types than those shown above. | 2065 Specifiers", and can handle more image types than those shown above. |
2066 You can also put the raw image data into a string (e.g., if you put the | 2066 You can also put the raw image data into a string (e.g., if you put the |
2067 contents of a JPEG file into a string), and use that to create a glyph. | 2067 contents of a JPEG file into a string), and use that to create a glyph. |
2068 @xref{Image Specifiers}, for more information. | 2068 @xref{Image Instantiators}, for more information. |
2069 | 2069 |
2070 @quotation | 2070 @quotation |
2071 @strong{Caution}: In order for XEmacs to read a particular graphics file | 2071 @strong{Caution}: In order for XEmacs to read a particular graphics file |
2072 format, support for that format must have been compiled into XEmacs. | 2072 format, support for that format must have been compiled into XEmacs. |
2073 It's possible, although somewhat unlikely, for XEmacs to have been | 2073 It's possible, although somewhat unlikely, for XEmacs to have been |
2077 | 2077 |
2078 To programmatically query whether or not a particular file format is | 2078 To programmatically query whether or not a particular file format is |
2079 supported, you can use the @code{featurep} function, with one of: | 2079 supported, you can use the @code{featurep} function, with one of: |
2080 @code{gif}, @code{tiff}, @code{jpeg}, @code{xpm}, @code{xbm}, | 2080 @code{gif}, @code{tiff}, @code{jpeg}, @code{xpm}, @code{xbm}, |
2081 @code{png}, or @code{xface}. For an up-to-date list, @ref{Image | 2081 @code{png}, or @code{xface}. For an up-to-date list, @ref{Image |
2082 Specifiers}. Example: | 2082 Instantiators}. Example: |
2083 | 2083 |
2084 @example | 2084 @example |
2085 ;; Returns `t' if TIFF is supported: | 2085 ;; Returns `t' if TIFF is supported: |
2086 (featurep 'tiff) | 2086 (featurep 'tiff) |
2087 @end example | 2087 @end example |