comparison src/glyphs.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 0293115a14e9
children 8d2a9b52c682
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
138 if (decode_image_instantiator_format (format, ERROR_ME_NOT)) 138 if (decode_image_instantiator_format (format, ERROR_ME_NOT))
139 return 1; 139 return 1;
140 return 0; 140 return 0;
141 } 141 }
142 142
143 DEFUN ("valid-image-instantiator-format-p", Fvalid_image_instantiator_format_p, 143 DEFUN ("valid-image-instantiator-format-p",
144 Svalid_image_instantiator_format_p, 1, 1, 0 /* 144 Fvalid_image_instantiator_format_p, 1, 1, 0, /*
145 Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid. 145 Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid.
146 Valid formats are some subset of 'nothing, 'string, 'formatted-string, 'xpm, 146 Valid formats are some subset of 'nothing, 'string, 'formatted-string, 'xpm,
147 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font, 'autodetect, 147 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font, 'autodetect,
148 and 'subwindow, depending on how XEmacs was compiled. 148 and 'subwindow, depending on how XEmacs was compiled.
149 */ ) 149 */
150 (image_instantiator_format) 150 (image_instantiator_format))
151 Lisp_Object image_instantiator_format;
152 { 151 {
153 if (valid_image_instantiator_format_p (image_instantiator_format)) 152 if (valid_image_instantiator_format_p (image_instantiator_format))
154 return Qt; 153 return Qt;
155 else 154 else
156 return Qnil; 155 return Qnil;
157 } 156 }
158 157
159 DEFUN ("image-instantiator-format-list", Fimage_instantiator_format_list, 158 DEFUN ("image-instantiator-format-list",
160 Simage_instantiator_format_list, 159 Fimage_instantiator_format_list, 0, 0, 0, /*
161 0, 0, 0 /*
162 Return a list of valid image-instantiator formats. 160 Return a list of valid image-instantiator formats.
163 */ ) 161 */
164 () 162 ())
165 { 163 {
166 return Fcopy_sequence (Vimage_instantiator_format_list); 164 return Fcopy_sequence (Vimage_instantiator_format_list);
167 } 165 }
168 166
169 void 167 void
185 { 183 {
186 return &decode_console_type (console_type, ERROR_ME)->image_conversion_list; 184 return &decode_console_type (console_type, ERROR_ME)->image_conversion_list;
187 } 185 }
188 186
189 DEFUN ("set-console-type-image-conversion-list", 187 DEFUN ("set-console-type-image-conversion-list",
190 Fset_console_type_image_conversion_list, 188 Fset_console_type_image_conversion_list, 2, 2, 0, /*
191 Sset_console_type_image_conversion_list, 2, 2, 0 /*
192 Set the image-conversion-list for consoles of the given TYPE. 189 Set the image-conversion-list for consoles of the given TYPE.
193 The image-conversion-list specifies how image instantiators that 190 The image-conversion-list specifies how image instantiators that
194 are strings should be interpreted. Each element of the list should be 191 are strings should be interpreted. Each element of the list should be
195 a list of two elements (a regular expression string and a vector) or 192 a list of two elements (a regular expression string and a vector) or
196 a list of three elements (the preceding two plus an integer index into 193 a list of three elements (the preceding two plus an integer index into
201 Note: The conversion above is applied when the image instantiator is 198 Note: The conversion above is applied when the image instantiator is
202 added to an image specifier, not when the specifier is actually 199 added to an image specifier, not when the specifier is actually
203 instantiated. Therefore, changing the image-conversion-list only affects 200 instantiated. Therefore, changing the image-conversion-list only affects
204 newly-added instantiators. Existing instantiators in glyphs and image 201 newly-added instantiators. Existing instantiators in glyphs and image
205 specifiers will not be affected. 202 specifiers will not be affected.
206 */ ) 203 */
207 (console_type, list) 204 (console_type, list))
208 Lisp_Object console_type, list;
209 { 205 {
210 Lisp_Object tail; 206 Lisp_Object tail;
211 Lisp_Object *imlist = get_image_conversion_list (console_type); 207 Lisp_Object *imlist = get_image_conversion_list (console_type);
212 208
213 /* Check the list to make sure that it only has valid entries. */ 209 /* Check the list to make sure that it only has valid entries. */
256 *imlist = Fcopy_tree (list, Qt); 252 *imlist = Fcopy_tree (list, Qt);
257 return list; 253 return list;
258 } 254 }
259 255
260 DEFUN ("console-type-image-conversion-list", 256 DEFUN ("console-type-image-conversion-list",
261 Fconsole_type_image_conversion_list, 257 Fconsole_type_image_conversion_list, 1, 1, 0, /*
262 Sconsole_type_image_conversion_list, 1, 1, 0 /*
263 Return the image-conversion-list for devices of the given TYPE. 258 Return the image-conversion-list for devices of the given TYPE.
264 The image-conversion-list specifies how to interpret image string 259 The image-conversion-list specifies how to interpret image string
265 instantiators for the specified console type. See 260 instantiators for the specified console type. See
266 `set-console-type-image-conversion-list' for a description of its syntax. 261 `set-console-type-image-conversion-list' for a description of its syntax.
267 */ ) 262 */
268 (console_type) 263 (console_type))
269 Lisp_Object console_type;
270 { 264 {
271 return Fcopy_tree (*get_image_conversion_list (console_type), Qt); 265 return Fcopy_tree (*get_image_conversion_list (console_type), Qt);
272 } 266 }
273 267
274 /* Process an string instantiator according to the image-conversion-list for 268 /* Process an string instantiator according to the image-conversion-list for
918 if (!NILP (memq_no_quit (type, Vimage_instance_type_list))) 912 if (!NILP (memq_no_quit (type, Vimage_instance_type_list)))
919 return 1; 913 return 1;
920 return 0; 914 return 0;
921 } 915 }
922 916
923 DEFUN ("valid-image-instance-type-p", Fvalid_image_instance_type_p, 917 DEFUN ("valid-image-instance-type-p", Fvalid_image_instance_type_p, 1, 1, 0, /*
924 Svalid_image_instance_type_p, 1, 1, 0 /*
925 Given an IMAGE-INSTANCE-TYPE, return non-nil if it is valid. 918 Given an IMAGE-INSTANCE-TYPE, return non-nil if it is valid.
926 Valid types are some subset of 'nothing, 'text, 'mono-pixmap, 'color-pixmap, 919 Valid types are some subset of 'nothing, 'text, 'mono-pixmap, 'color-pixmap,
927 'pointer, and 'subwindow, depending on how XEmacs was compiled. 920 'pointer, and 'subwindow, depending on how XEmacs was compiled.
928 */ ) 921 */
929 (image_instance_type) 922 (image_instance_type))
930 Lisp_Object image_instance_type;
931 { 923 {
932 if (valid_image_instance_type_p (image_instance_type)) 924 if (valid_image_instance_type_p (image_instance_type))
933 return Qt; 925 return Qt;
934 else 926 else
935 return Qnil; 927 return Qnil;
936 } 928 }
937 929
938 DEFUN ("image-instance-type-list", Fimage_instance_type_list, 930 DEFUN ("image-instance-type-list", Fimage_instance_type_list, 0, 0, 0, /*
939 Simage_instance_type_list,
940 0, 0, 0 /*
941 Return a list of valid image-instance types. 931 Return a list of valid image-instance types.
942 */ ) 932 */
943 () 933 ())
944 { 934 {
945 return Fcopy_sequence (Vimage_instance_type_list); 935 return Fcopy_sequence (Vimage_instance_type_list);
946 } 936 }
947 937
948 Error_behavior 938 Error_behavior
993 signal_simple_error ("inheritance not allowed here", data); 983 signal_simple_error ("inheritance not allowed here", data);
994 ii = instantiate_image_instantiator (device, data, Qnil, Qnil, dest_mask); 984 ii = instantiate_image_instantiator (device, data, Qnil, Qnil, dest_mask);
995 RETURN_UNGCPRO (ii); 985 RETURN_UNGCPRO (ii);
996 } 986 }
997 987
998 DEFUN ("make-image-instance", Fmake_image_instance, Smake_image_instance, 988 DEFUN ("make-image-instance", Fmake_image_instance, 1, 4, 0, /*
999 1, 4, 0 /*
1000 Create a new `image-instance' object. 989 Create a new `image-instance' object.
1001 990
1002 Image-instance objects encapsulate the way a particular image (pixmap, 991 Image-instance objects encapsulate the way a particular image (pixmap,
1003 etc.) is displayed on a particular device. In most circumstances, you 992 etc.) is displayed on a particular device. In most circumstances, you
1004 do not need to directly create image instances; use a glyph instead. 993 do not need to directly create image instances; use a glyph instead.
1052 1041
1053 NO-ERROR controls what happens when the image cannot be generated. 1042 NO-ERROR controls what happens when the image cannot be generated.
1054 If nil, an error message is generated. If t, no messages are 1043 If nil, an error message is generated. If t, no messages are
1055 generated and this function returns nil. If anything else, a warning 1044 generated and this function returns nil. If anything else, a warning
1056 message is generated and this function returns nil. 1045 message is generated and this function returns nil.
1057 */ ) 1046 */
1058 (data, device, dest_types, no_error) 1047 (data, device, dest_types, no_error))
1059 Lisp_Object data, device, dest_types, no_error;
1060 { 1048 {
1061 Error_behavior errb = decode_error_behavior_flag (no_error); 1049 Error_behavior errb = decode_error_behavior_flag (no_error);
1062 1050
1063 return call_with_suspended_errors ((lisp_fn_t) make_image_instance_1, 1051 return call_with_suspended_errors ((lisp_fn_t) make_image_instance_1,
1064 Qnil, Qimage, errb, 1052 Qnil, Qimage, errb,
1065 3, data, device, dest_types); 1053 3, data, device, dest_types);
1066 } 1054 }
1067 1055
1068 DEFUN ("image-instance-p", Fimage_instance_p, Simage_instance_p, 1, 1, 0 /* 1056 DEFUN ("image-instance-p", Fimage_instance_p, 1, 1, 0, /*
1069 Return non-nil if OBJECT is an image instance. 1057 Return non-nil if OBJECT is an image instance.
1070 */ ) 1058 */
1071 (object) 1059 (object))
1072 Lisp_Object object;
1073 { 1060 {
1074 return (IMAGE_INSTANCEP (object) ? Qt : Qnil); 1061 return (IMAGE_INSTANCEP (object) ? Qt : Qnil);
1075 } 1062 }
1076 1063
1077 DEFUN ("image-instance-type", Fimage_instance_type, Simage_instance_type, 1064 DEFUN ("image-instance-type", Fimage_instance_type, 1, 1, 0, /*
1078 1, 1, 0 /*
1079 Return the type of the given image instance. 1065 Return the type of the given image instance.
1080 The return value will be one of 'nothing, 'text, 'mono-pixmap, 1066 The return value will be one of 'nothing, 'text, 'mono-pixmap,
1081 'color-pixmap, 'pointer, or 'subwindow. 1067 'color-pixmap, 'pointer, or 'subwindow.
1082 */ ) 1068 */
1083 (image_instance) 1069 (image_instance))
1084 Lisp_Object image_instance;
1085 { 1070 {
1086 CHECK_IMAGE_INSTANCE (image_instance); 1071 CHECK_IMAGE_INSTANCE (image_instance);
1087 return encode_image_instance_type (XIMAGE_INSTANCE_TYPE (image_instance)); 1072 return encode_image_instance_type (XIMAGE_INSTANCE_TYPE (image_instance));
1088 } 1073 }
1089 1074
1090 DEFUN ("image-instance-name", Fimage_instance_name, 1075 DEFUN ("image-instance-name", Fimage_instance_name, 1, 1, 0, /*
1091 Simage_instance_name, 1, 1, 0 /*
1092 Return the name of the given image instance. 1076 Return the name of the given image instance.
1093 */ ) 1077 */
1094 (image_instance) 1078 (image_instance))
1095 Lisp_Object image_instance;
1096 { 1079 {
1097 CHECK_IMAGE_INSTANCE (image_instance); 1080 CHECK_IMAGE_INSTANCE (image_instance);
1098 return (XIMAGE_INSTANCE_NAME (image_instance)); 1081 return (XIMAGE_INSTANCE_NAME (image_instance));
1099 } 1082 }
1100 1083
1101 DEFUN ("image-instance-string", Fimage_instance_string, 1084 DEFUN ("image-instance-string", Fimage_instance_string, 1, 1, 0, /*
1102 Simage_instance_string, 1, 1, 0 /*
1103 Return the string of the given image instance. 1085 Return the string of the given image instance.
1104 This will only be non-nil for text image instances. 1086 This will only be non-nil for text image instances.
1105 */ ) 1087 */
1106 (image_instance) 1088 (image_instance))
1107 Lisp_Object image_instance;
1108 { 1089 {
1109 CHECK_IMAGE_INSTANCE (image_instance); 1090 CHECK_IMAGE_INSTANCE (image_instance);
1110 if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_TEXT) 1091 if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_TEXT)
1111 return (XIMAGE_INSTANCE_TEXT_STRING (image_instance)); 1092 return (XIMAGE_INSTANCE_TEXT_STRING (image_instance));
1112 else 1093 else
1113 return Qnil; 1094 return Qnil;
1114 } 1095 }
1115 1096
1116 DEFUN ("image-instance-file-name", Fimage_instance_file_name, 1097 DEFUN ("image-instance-file-name", Fimage_instance_file_name, 1, 1, 0, /*
1117 Simage_instance_file_name, 1, 1, 0 /*
1118 Return the file name from which IMAGE-INSTANCE was read, if known. 1098 Return the file name from which IMAGE-INSTANCE was read, if known.
1119 */ ) 1099 */
1120 (image_instance) 1100 (image_instance))
1121 Lisp_Object image_instance;
1122 { 1101 {
1123 CHECK_IMAGE_INSTANCE (image_instance); 1102 CHECK_IMAGE_INSTANCE (image_instance);
1124 1103
1125 switch (XIMAGE_INSTANCE_TYPE (image_instance)) 1104 switch (XIMAGE_INSTANCE_TYPE (image_instance))
1126 { 1105 {
1132 default: 1111 default:
1133 return Qnil; 1112 return Qnil;
1134 } 1113 }
1135 } 1114 }
1136 1115
1137 DEFUN ("image-instance-mask-file-name", Fimage_instance_mask_file_name, 1116 DEFUN ("image-instance-mask-file-name", Fimage_instance_mask_file_name, 1, 1, 0, /*
1138 Simage_instance_mask_file_name, 1, 1, 0 /*
1139 Return the file name from which IMAGE-INSTANCE's mask was read, if known. 1117 Return the file name from which IMAGE-INSTANCE's mask was read, if known.
1140 */ ) 1118 */
1141 (image_instance) 1119 (image_instance))
1142 Lisp_Object image_instance;
1143 { 1120 {
1144 CHECK_IMAGE_INSTANCE (image_instance); 1121 CHECK_IMAGE_INSTANCE (image_instance);
1145 1122
1146 switch (XIMAGE_INSTANCE_TYPE (image_instance)) 1123 switch (XIMAGE_INSTANCE_TYPE (image_instance))
1147 { 1124 {
1153 default: 1130 default:
1154 return Qnil; 1131 return Qnil;
1155 } 1132 }
1156 } 1133 }
1157 1134
1158 DEFUN ("image-instance-depth", Fimage_instance_depth, 1135 DEFUN ("image-instance-depth", Fimage_instance_depth, 1, 1, 0, /*
1159 Simage_instance_depth, 1, 1, 0 /*
1160 Return the depth of the image instance. 1136 Return the depth of the image instance.
1161 This is 0 for a bitmap, or a positive integer for a pixmap. 1137 This is 0 for a bitmap, or a positive integer for a pixmap.
1162 */ ) 1138 */
1163 (image_instance) 1139 (image_instance))
1164 Lisp_Object image_instance;
1165 { 1140 {
1166 CHECK_IMAGE_INSTANCE (image_instance); 1141 CHECK_IMAGE_INSTANCE (image_instance);
1167 1142
1168 switch (XIMAGE_INSTANCE_TYPE (image_instance)) 1143 switch (XIMAGE_INSTANCE_TYPE (image_instance))
1169 { 1144 {
1175 default: 1150 default:
1176 return Qnil; 1151 return Qnil;
1177 } 1152 }
1178 } 1153 }
1179 1154
1180 DEFUN ("image-instance-height", Fimage_instance_height, 1155 DEFUN ("image-instance-height", Fimage_instance_height, 1, 1, 0, /*
1181 Simage_instance_height, 1, 1, 0 /*
1182 Return the height of the image instance, in pixels. 1156 Return the height of the image instance, in pixels.
1183 */ ) 1157 */
1184 (image_instance) 1158 (image_instance))
1185 Lisp_Object image_instance;
1186 { 1159 {
1187 CHECK_IMAGE_INSTANCE (image_instance); 1160 CHECK_IMAGE_INSTANCE (image_instance);
1188 1161
1189 switch (XIMAGE_INSTANCE_TYPE (image_instance)) 1162 switch (XIMAGE_INSTANCE_TYPE (image_instance))
1190 { 1163 {
1196 default: 1169 default:
1197 return Qnil; 1170 return Qnil;
1198 } 1171 }
1199 } 1172 }
1200 1173
1201 DEFUN ("image-instance-width", Fimage_instance_width, 1174 DEFUN ("image-instance-width", Fimage_instance_width, 1, 1, 0, /*
1202 Simage_instance_width, 1, 1, 0 /*
1203 Return the width of the image instance, in pixels. 1175 Return the width of the image instance, in pixels.
1204 */ ) 1176 */
1205 (image_instance) 1177 (image_instance))
1206 Lisp_Object image_instance;
1207 { 1178 {
1208 CHECK_IMAGE_INSTANCE (image_instance); 1179 CHECK_IMAGE_INSTANCE (image_instance);
1209 1180
1210 switch (XIMAGE_INSTANCE_TYPE (image_instance)) 1181 switch (XIMAGE_INSTANCE_TYPE (image_instance))
1211 { 1182 {
1217 default: 1188 default:
1218 return Qnil; 1189 return Qnil;
1219 } 1190 }
1220 } 1191 }
1221 1192
1222 DEFUN ("image-instance-hotspot-x", Fimage_instance_hotspot_x, 1193 DEFUN ("image-instance-hotspot-x", Fimage_instance_hotspot_x, 1, 1, 0, /*
1223 Simage_instance_hotspot_x, 1, 1, 0 /*
1224 Return the X coordinate of the image instance's hotspot, if known. 1194 Return the X coordinate of the image instance's hotspot, if known.
1225 This is a point relative to the origin of the pixmap. When an image is 1195 This is a point relative to the origin of the pixmap. When an image is
1226 used as a mouse pointer, the hotspot is the point on the image that sits 1196 used as a mouse pointer, the hotspot is the point on the image that sits
1227 over the location that the pointer points to. This is, for example, the 1197 over the location that the pointer points to. This is, for example, the
1228 tip of the arrow or the center of the crosshairs. 1198 tip of the arrow or the center of the crosshairs.
1229 This will always be nil for a non-pointer image instance. 1199 This will always be nil for a non-pointer image instance.
1230 */ ) 1200 */
1231 (image_instance) 1201 (image_instance))
1232 Lisp_Object image_instance;
1233 { 1202 {
1234 CHECK_IMAGE_INSTANCE (image_instance); 1203 CHECK_IMAGE_INSTANCE (image_instance);
1235 1204
1236 switch (XIMAGE_INSTANCE_TYPE (image_instance)) 1205 switch (XIMAGE_INSTANCE_TYPE (image_instance))
1237 { 1206 {
1243 default: 1212 default:
1244 return Qnil; 1213 return Qnil;
1245 } 1214 }
1246 } 1215 }
1247 1216
1248 DEFUN ("image-instance-hotspot-y", Fimage_instance_hotspot_y, 1217 DEFUN ("image-instance-hotspot-y", Fimage_instance_hotspot_y, 1, 1, 0, /*
1249 Simage_instance_hotspot_y, 1, 1, 0 /*
1250 Return the Y coordinate of the image instance's hotspot, if known. 1218 Return the Y coordinate of the image instance's hotspot, if known.
1251 This is a point relative to the origin of the pixmap. When an image is 1219 This is a point relative to the origin of the pixmap. When an image is
1252 used as a mouse pointer, the hotspot is the point on the image that sits 1220 used as a mouse pointer, the hotspot is the point on the image that sits
1253 over the location that the pointer points to. This is, for example, the 1221 over the location that the pointer points to. This is, for example, the
1254 tip of the arrow or the center of the crosshairs. 1222 tip of the arrow or the center of the crosshairs.
1255 This will always be nil for a non-pointer image instance. 1223 This will always be nil for a non-pointer image instance.
1256 */ ) 1224 */
1257 (image_instance) 1225 (image_instance))
1258 Lisp_Object image_instance;
1259 { 1226 {
1260 CHECK_IMAGE_INSTANCE (image_instance); 1227 CHECK_IMAGE_INSTANCE (image_instance);
1261 1228
1262 switch (XIMAGE_INSTANCE_TYPE (image_instance)) 1229 switch (XIMAGE_INSTANCE_TYPE (image_instance))
1263 { 1230 {
1269 default: 1236 default:
1270 return Qnil; 1237 return Qnil;
1271 } 1238 }
1272 } 1239 }
1273 1240
1274 DEFUN ("image-instance-foreground", Fimage_instance_foreground, 1241 DEFUN ("image-instance-foreground", Fimage_instance_foreground, 1, 1, 0, /*
1275 Simage_instance_foreground, 1, 1, 0 /*
1276 Return the foreground color of IMAGE-INSTANCE, if applicable. 1242 Return the foreground color of IMAGE-INSTANCE, if applicable.
1277 This will be a color instance or nil. (It will only be non-nil for 1243 This will be a color instance or nil. (It will only be non-nil for
1278 colorized mono pixmaps and for pointers.) 1244 colorized mono pixmaps and for pointers.)
1279 */ ) 1245 */
1280 (image_instance) 1246 (image_instance))
1281 Lisp_Object image_instance;
1282 { 1247 {
1283 CHECK_IMAGE_INSTANCE (image_instance); 1248 CHECK_IMAGE_INSTANCE (image_instance);
1284 1249
1285 switch (XIMAGE_INSTANCE_TYPE (image_instance)) 1250 switch (XIMAGE_INSTANCE_TYPE (image_instance))
1286 { 1251 {
1292 default: 1257 default:
1293 return Qnil; 1258 return Qnil;
1294 } 1259 }
1295 } 1260 }
1296 1261
1297 DEFUN ("image-instance-background", Fimage_instance_background, 1262 DEFUN ("image-instance-background", Fimage_instance_background, 1, 1, 0, /*
1298 Simage_instance_background, 1, 1, 0 /*
1299 Return the background color of IMAGE-INSTANCE, if applicable. 1263 Return the background color of IMAGE-INSTANCE, if applicable.
1300 This will be a color instance or nil. (It will only be non-nil for 1264 This will be a color instance or nil. (It will only be non-nil for
1301 colorized mono pixmaps and for pointers.) 1265 colorized mono pixmaps and for pointers.)
1302 */ ) 1266 */
1303 (image_instance) 1267 (image_instance))
1304 Lisp_Object image_instance;
1305 { 1268 {
1306 CHECK_IMAGE_INSTANCE (image_instance); 1269 CHECK_IMAGE_INSTANCE (image_instance);
1307 1270
1308 switch (XIMAGE_INSTANCE_TYPE (image_instance)) 1271 switch (XIMAGE_INSTANCE_TYPE (image_instance))
1309 { 1272 {
1316 return Qnil; 1279 return Qnil;
1317 } 1280 }
1318 } 1281 }
1319 1282
1320 1283
1321 DEFUN ("colorize-image-instance", Fcolorize_image_instance, 1284 DEFUN ("colorize-image-instance", Fcolorize_image_instance, 3, 3, 0, /*
1322 Scolorize_image_instance, 3, 3, 0 /*
1323 Make the image instance be displayed in the given colors. 1285 Make the image instance be displayed in the given colors.
1324 This function returns a new image instance that is exactly like the 1286 This function returns a new image instance that is exactly like the
1325 specified one except that (if possible) the foreground and background 1287 specified one except that (if possible) the foreground and background
1326 colors and as specified. Currently, this only does anything if the image 1288 colors and as specified. Currently, this only does anything if the image
1327 instance is a mono pixmap; otherwise, the same image instance is returned. 1289 instance is a mono pixmap; otherwise, the same image instance is returned.
1328 */ ) 1290 */
1329 (image_instance, foreground, background) 1291 (image_instance, foreground, background))
1330 Lisp_Object image_instance, foreground, background;
1331 { 1292 {
1332 Lisp_Object new; 1293 Lisp_Object new;
1333 Lisp_Object device; 1294 Lisp_Object device;
1334 1295
1335 CHECK_IMAGE_INSTANCE (image_instance); 1296 CHECK_IMAGE_INSTANCE (image_instance);
1788 UNGCPRO; 1749 UNGCPRO;
1789 1750
1790 return retlist; 1751 return retlist;
1791 } 1752 }
1792 1753
1793 DEFUN ("image-specifier-p", Fimage_specifier_p, Simage_specifier_p, 1, 1, 0 /* 1754 DEFUN ("image-specifier-p", Fimage_specifier_p, 1, 1, 0, /*
1794 Return non-nil if OBJECT is an image specifier. 1755 Return non-nil if OBJECT is an image specifier.
1795 1756
1796 An image specifier is used for images (pixmaps and the like). It is used 1757 An image specifier is used for images (pixmaps and the like). It is used
1797 to describe the actual image in a glyph. It is instanced as an image- 1758 to describe the actual image in a glyph. It is instanced as an image-
1798 instance. 1759 instance.
1948 instantiator will be converted into one of the inline-data forms, with 1909 instantiator will be converted into one of the inline-data forms, with
1949 the filename retained using a :file keyword. This implies that the 1910 the filename retained using a :file keyword. This implies that the
1950 file must exist when the instantiator is added to the image, but does 1911 file must exist when the instantiator is added to the image, but does
1951 not need to exist at any other time (e.g. it may safely be a temporary 1912 not need to exist at any other time (e.g. it may safely be a temporary
1952 file). 1913 file).
1953 */ ) 1914 */
1954 (object) 1915 (object))
1955 Lisp_Object object;
1956 { 1916 {
1957 return (IMAGE_SPECIFIERP (object) ? Qt : Qnil); 1917 return (IMAGE_SPECIFIERP (object) ? Qt : Qnil);
1958 } 1918 }
1959 1919
1960 1920
2214 if (!NILP (memq_no_quit (type, Vglyph_type_list))) 2174 if (!NILP (memq_no_quit (type, Vglyph_type_list)))
2215 return 1; 2175 return 1;
2216 return 0; 2176 return 0;
2217 } 2177 }
2218 2178
2219 DEFUN ("valid-glyph-type-p", Fvalid_glyph_type_p, 2179 DEFUN ("valid-glyph-type-p", Fvalid_glyph_type_p, 1, 1, 0, /*
2220 Svalid_glyph_type_p, 1, 1, 0 /*
2221 Given a GLYPH-TYPE, return non-nil if it is valid. 2180 Given a GLYPH-TYPE, return non-nil if it is valid.
2222 Valid types are `buffer', `pointer', and `icon'. 2181 Valid types are `buffer', `pointer', and `icon'.
2223 */ ) 2182 */
2224 (glyph_type) 2183 (glyph_type))
2225 Lisp_Object glyph_type;
2226 { 2184 {
2227 if (valid_glyph_type_p (glyph_type)) 2185 if (valid_glyph_type_p (glyph_type))
2228 return Qt; 2186 return Qt;
2229 else 2187 else
2230 return Qnil; 2188 return Qnil;
2231 } 2189 }
2232 2190
2233 DEFUN ("glyph-type-list", Fglyph_type_list, 2191 DEFUN ("glyph-type-list", Fglyph_type_list, 0, 0, 0, /*
2234 Sglyph_type_list,
2235 0, 0, 0 /*
2236 Return a list of valid glyph types. 2192 Return a list of valid glyph types.
2237 */ ) 2193 */
2238 () 2194 ())
2239 { 2195 {
2240 return Fcopy_sequence (Vglyph_type_list); 2196 return Fcopy_sequence (Vglyph_type_list);
2241 } 2197 }
2242 2198
2243 DEFUN ("make-glyph-internal", Fmake_glyph_internal, Smake_glyph_internal, 2199 DEFUN ("make-glyph-internal", Fmake_glyph_internal, 0, 1, 0, /*
2244 0, 1, 0 /*
2245 Create a new, uninitialized glyph. 2200 Create a new, uninitialized glyph.
2246 2201
2247 TYPE specifies the type of the glyph; this should be one of `buffer', 2202 TYPE specifies the type of the glyph; this should be one of `buffer',
2248 `pointer', or `icon', and defaults to `buffer'. The type of the glyph 2203 `pointer', or `icon', and defaults to `buffer'. The type of the glyph
2249 specifies in which contexts the glyph can be used, and controls the 2204 specifies in which contexts the glyph can be used, and controls the
2259 image can be instantiated as `pointer'. 2214 image can be instantiated as `pointer'.
2260 2215
2261 `icon' glyphs can be used to specify the icon used when a frame is 2216 `icon' glyphs can be used to specify the icon used when a frame is
2262 iconified. Their image can be instantiated as `mono-pixmap' and 2217 iconified. Their image can be instantiated as `mono-pixmap' and
2263 `color-pixmap'. 2218 `color-pixmap'.
2264 */ ) 2219 */
2265 (type) 2220 (type))
2266 Lisp_Object type;
2267 { 2221 {
2268 enum glyph_type typeval = decode_glyph_type (type, ERROR_ME); 2222 enum glyph_type typeval = decode_glyph_type (type, ERROR_ME);
2269 return allocate_glyph (typeval, 0); 2223 return allocate_glyph (typeval, 0);
2270 } 2224 }
2271 2225
2272 DEFUN ("glyphp", Fglyphp, Sglyphp, 1, 1, 0 /* 2226 DEFUN ("glyphp", Fglyphp, 1, 1, 0, /*
2273 Return non-nil if OBJECT is a glyph. 2227 Return non-nil if OBJECT is a glyph.
2274 2228
2275 A glyph is an object used for pixmaps and the like. It is used 2229 A glyph is an object used for pixmaps and the like. It is used
2276 in begin-glyphs and end-glyphs attached to extents, in marginal and textual 2230 in begin-glyphs and end-glyphs attached to extents, in marginal and textual
2277 annotations, in overlay arrows (overlay-arrow-* variables), in toolbar 2231 annotations, in overlay arrows (overlay-arrow-* variables), in toolbar
2278 buttons, and the like. Its image is described using an image specifier -- 2232 buttons, and the like. Its image is described using an image specifier --
2279 see `image-specifier-p'. 2233 see `image-specifier-p'.
2280 */ ) 2234 */
2281 (object) 2235 (object))
2282 Lisp_Object object;
2283 { 2236 {
2284 return GLYPHP (object) ? Qt : Qnil; 2237 return GLYPHP (object) ? Qt : Qnil;
2285 } 2238 }
2286 2239
2287 DEFUN ("glyph-type", Fglyph_type, Sglyph_type, 2240 DEFUN ("glyph-type", Fglyph_type, 1, 1, 0, /*
2288 1, 1, 0 /*
2289 Return the type of the given glyph. 2241 Return the type of the given glyph.
2290 The return value will be one of 'buffer, 'pointer, or 'icon. 2242 The return value will be one of 'buffer, 'pointer, or 'icon.
2291 */ ) 2243 */
2292 (glyph) 2244 (glyph))
2293 Lisp_Object glyph;
2294 { 2245 {
2295 CHECK_GLYPH (glyph); 2246 CHECK_GLYPH (glyph);
2296 switch (XGLYPH_TYPE (glyph)) 2247 switch (XGLYPH_TYPE (glyph))
2297 { 2248 {
2298 case GLYPH_BUFFER: 2249 case GLYPH_BUFFER:
2370 abort (); 2321 abort ();
2371 return 0; 2322 return 0;
2372 } 2323 }
2373 } 2324 }
2374 2325
2375 DEFUN ("glyph-width", Fglyph_width, Sglyph_width, 1, 2, 0 /* 2326 DEFUN ("glyph-width", Fglyph_width, 1, 2, 0, /*
2376 Return the width of GLYPH on WINDOW. 2327 Return the width of GLYPH on WINDOW.
2377 This may not be exact as it does not take into account all of the context 2328 This may not be exact as it does not take into account all of the context
2378 that redisplay will. 2329 that redisplay will.
2379 */ ) 2330 */
2380 (glyph, window) 2331 (glyph, window))
2381 Lisp_Object glyph, window;
2382 { 2332 {
2383 XSETWINDOW (window, decode_window (window)); 2333 XSETWINDOW (window, decode_window (window));
2384 CHECK_GLYPH (glyph); 2334 CHECK_GLYPH (glyph);
2385 2335
2386 return (make_int (glyph_width (glyph, Qnil, DEFAULT_INDEX, window))); 2336 return (make_int (glyph_width (glyph, Qnil, DEFAULT_INDEX, window)));
2500 { 2450 {
2501 return glyph_height_internal (glyph, frame_face, window_findex, window, 2451 return glyph_height_internal (glyph, frame_face, window_findex, window,
2502 RETURN_HEIGHT); 2452 RETURN_HEIGHT);
2503 } 2453 }
2504 2454
2505 DEFUN ("glyph-ascent", Fglyph_ascent, Sglyph_ascent, 1, 2, 0 /* 2455 DEFUN ("glyph-ascent", Fglyph_ascent, 1, 2, 0, /*
2506 Return the ascent value of GLYPH on WINDOW. 2456 Return the ascent value of GLYPH on WINDOW.
2507 This may not be exact as it does not take into account all of the context 2457 This may not be exact as it does not take into account all of the context
2508 that redisplay will. 2458 that redisplay will.
2509 */ ) 2459 */
2510 (glyph, window) 2460 (glyph, window))
2511 Lisp_Object glyph, window;
2512 { 2461 {
2513 XSETWINDOW (window, decode_window (window)); 2462 XSETWINDOW (window, decode_window (window));
2514 CHECK_GLYPH (glyph); 2463 CHECK_GLYPH (glyph);
2515 2464
2516 return (make_int (glyph_ascent (glyph, Qnil, DEFAULT_INDEX, window))); 2465 return (make_int (glyph_ascent (glyph, Qnil, DEFAULT_INDEX, window)));
2517 } 2466 }
2518 2467
2519 DEFUN ("glyph-descent", Fglyph_descent, Sglyph_descent, 1, 2, 0 /* 2468 DEFUN ("glyph-descent", Fglyph_descent, 1, 2, 0, /*
2520 Return the descent value of GLYPH on WINDOW. 2469 Return the descent value of GLYPH on WINDOW.
2521 This may not be exact as it does not take into account all of the context 2470 This may not be exact as it does not take into account all of the context
2522 that redisplay will. 2471 that redisplay will.
2523 */ ) 2472 */
2524 (glyph, window) 2473 (glyph, window))
2525 Lisp_Object glyph, window;
2526 { 2474 {
2527 XSETWINDOW (window, decode_window (window)); 2475 XSETWINDOW (window, decode_window (window));
2528 CHECK_GLYPH (glyph); 2476 CHECK_GLYPH (glyph);
2529 2477
2530 return (make_int (glyph_descent (glyph, Qnil, DEFAULT_INDEX, window))); 2478 return (make_int (glyph_descent (glyph, Qnil, DEFAULT_INDEX, window)));
2531 } 2479 }
2532 2480
2533 /* This is redundant but I bet a lot of people expect it to exist. */ 2481 /* This is redundant but I bet a lot of people expect it to exist. */
2534 DEFUN ("glyph-height", Fglyph_height, Sglyph_height, 1, 2, 0 /* 2482 DEFUN ("glyph-height", Fglyph_height, 1, 2, 0, /*
2535 Return the height of GLYPH on WINDOW. 2483 Return the height of GLYPH on WINDOW.
2536 This may not be exact as it does not take into account all of the context 2484 This may not be exact as it does not take into account all of the context
2537 that redisplay will. 2485 that redisplay will.
2538 */ ) 2486 */
2539 (glyph, window) 2487 (glyph, window))
2540 Lisp_Object glyph, window;
2541 { 2488 {
2542 XSETWINDOW (window, decode_window (window)); 2489 XSETWINDOW (window, decode_window (window));
2543 CHECK_GLYPH (glyph); 2490 CHECK_GLYPH (glyph);
2544 2491
2545 return (make_int (glyph_height (glyph, Qnil, DEFAULT_INDEX, window))); 2492 return (make_int (glyph_height (glyph, Qnil, DEFAULT_INDEX, window)));
2793 void 2740 void
2794 syms_of_glyphs (void) 2741 syms_of_glyphs (void)
2795 { 2742 {
2796 /* image instantiators */ 2743 /* image instantiators */
2797 2744
2798 defsubr (&Simage_instantiator_format_list); 2745 DEFSUBR (Fimage_instantiator_format_list);
2799 defsubr (&Svalid_image_instantiator_format_p); 2746 DEFSUBR (Fvalid_image_instantiator_format_p);
2800 defsubr (&Sset_console_type_image_conversion_list); 2747 DEFSUBR (Fset_console_type_image_conversion_list);
2801 defsubr (&Sconsole_type_image_conversion_list); 2748 DEFSUBR (Fconsole_type_image_conversion_list);
2802 2749
2803 defkeyword (&Q_file, ":file"); 2750 defkeyword (&Q_file, ":file");
2804 defkeyword (&Q_data, ":data"); 2751 defkeyword (&Q_data, ":data");
2805 defkeyword (&Q_face, ":face"); 2752 defkeyword (&Q_face, ":face");
2806 2753
2807 /* image specifiers */ 2754 /* image specifiers */
2808 2755
2809 defsubr (&Simage_specifier_p); 2756 DEFSUBR (Fimage_specifier_p);
2810 /* Qimage in general.c */ 2757 /* Qimage in general.c */
2811 2758
2812 /* image instances */ 2759 /* image instances */
2813 2760
2814 defsymbol (&Qimage_instancep, "image-instance-p"); 2761 defsymbol (&Qimage_instancep, "image-instance-p");
2818 defsymbol (&Qmono_pixmap_image_instance_p, "mono-pixmap-image-instance-p"); 2765 defsymbol (&Qmono_pixmap_image_instance_p, "mono-pixmap-image-instance-p");
2819 defsymbol (&Qcolor_pixmap_image_instance_p, "color-pixmap-image-instance-p"); 2766 defsymbol (&Qcolor_pixmap_image_instance_p, "color-pixmap-image-instance-p");
2820 defsymbol (&Qpointer_image_instance_p, "pointer-image-instance-p"); 2767 defsymbol (&Qpointer_image_instance_p, "pointer-image-instance-p");
2821 defsymbol (&Qsubwindow_image_instance_p, "subwindow-image-instance-p"); 2768 defsymbol (&Qsubwindow_image_instance_p, "subwindow-image-instance-p");
2822 2769
2823 defsubr (&Smake_image_instance); 2770 DEFSUBR (Fmake_image_instance);
2824 defsubr (&Simage_instance_p); 2771 DEFSUBR (Fimage_instance_p);
2825 defsubr (&Simage_instance_type); 2772 DEFSUBR (Fimage_instance_type);
2826 defsubr (&Svalid_image_instance_type_p); 2773 DEFSUBR (Fvalid_image_instance_type_p);
2827 defsubr (&Simage_instance_type_list); 2774 DEFSUBR (Fimage_instance_type_list);
2828 defsubr (&Simage_instance_name); 2775 DEFSUBR (Fimage_instance_name);
2829 defsubr (&Simage_instance_string); 2776 DEFSUBR (Fimage_instance_string);
2830 defsubr (&Simage_instance_file_name); 2777 DEFSUBR (Fimage_instance_file_name);
2831 defsubr (&Simage_instance_mask_file_name); 2778 DEFSUBR (Fimage_instance_mask_file_name);
2832 defsubr (&Simage_instance_depth); 2779 DEFSUBR (Fimage_instance_depth);
2833 defsubr (&Simage_instance_height); 2780 DEFSUBR (Fimage_instance_height);
2834 defsubr (&Simage_instance_width); 2781 DEFSUBR (Fimage_instance_width);
2835 defsubr (&Simage_instance_hotspot_x); 2782 DEFSUBR (Fimage_instance_hotspot_x);
2836 defsubr (&Simage_instance_hotspot_y); 2783 DEFSUBR (Fimage_instance_hotspot_y);
2837 defsubr (&Simage_instance_foreground); 2784 DEFSUBR (Fimage_instance_foreground);
2838 defsubr (&Simage_instance_background); 2785 DEFSUBR (Fimage_instance_background);
2839 defsubr (&Scolorize_image_instance); 2786 DEFSUBR (Fcolorize_image_instance);
2840 2787
2841 /* Qnothing defined as part of the "nothing" image-instantiator 2788 /* Qnothing defined as part of the "nothing" image-instantiator
2842 type. */ 2789 type. */
2843 /* Qtext defined in general.c */ 2790 /* Qtext defined in general.c */
2844 defsymbol (&Qmono_pixmap, "mono-pixmap"); 2791 defsymbol (&Qmono_pixmap, "mono-pixmap");
2856 defsymbol (&Qpointer_glyph_p, "pointer-glyph-p"); 2803 defsymbol (&Qpointer_glyph_p, "pointer-glyph-p");
2857 defsymbol (&Qicon_glyph_p, "icon-glyph-p"); 2804 defsymbol (&Qicon_glyph_p, "icon-glyph-p");
2858 2805
2859 defsymbol (&Qconst_glyph_variable, "const-glyph-variable"); 2806 defsymbol (&Qconst_glyph_variable, "const-glyph-variable");
2860 2807
2861 defsubr (&Sglyph_type); 2808 DEFSUBR (Fglyph_type);
2862 defsubr (&Svalid_glyph_type_p); 2809 DEFSUBR (Fvalid_glyph_type_p);
2863 defsubr (&Sglyph_type_list); 2810 DEFSUBR (Fglyph_type_list);
2864 defsubr (&Sglyphp); 2811 DEFSUBR (Fglyphp);
2865 defsubr (&Smake_glyph_internal); 2812 DEFSUBR (Fmake_glyph_internal);
2866 defsubr (&Sglyph_width); 2813 DEFSUBR (Fglyph_width);
2867 defsubr (&Sglyph_ascent); 2814 DEFSUBR (Fglyph_ascent);
2868 defsubr (&Sglyph_descent); 2815 DEFSUBR (Fglyph_descent);
2869 defsubr (&Sglyph_height); 2816 DEFSUBR (Fglyph_height);
2870 2817
2871 /* Qbuffer defined in general.c. */ 2818 /* Qbuffer defined in general.c. */
2872 /* Qpointer defined above */ 2819 /* Qpointer defined above */
2873 defsymbol (&Qicon, "icon"); 2820 defsymbol (&Qicon, "icon");
2874 } 2821 }