comparison src/glyphs-eimage.c @ 2959:4eb2a8c07cb3

[xemacs-hg @ 2005-09-27 05:48:22 by ben] Implement color pixmap cursors glyphs.c, glyphs-eimage.c, glyphs-x.c, glyphs-gtk.c, glyphs-msw.c, console-impl.h: Allow all kinds of color images (GIF, JPEG, ...) to be mouse pointers. new -> new_, 'foo -> `foo'.
author ben
date Tue, 27 Sep 2005 05:48:27 +0000
parents 6bee993389f3
children ad2f4ae9895b
comparison
equal deleted inserted replaced
2958:9e04ad6a1ac6 2959:4eb2a8c07cb3
1 /* EImage-specific Lisp objects. 1 /* EImage-specific Lisp objects.
2 Copyright (C) 1993, 1994, 1998 Free Software Foundation, Inc. 2 Copyright (C) 1993, 1994, 1998 Free Software Foundation, Inc.
3 Copyright (C) 1995 Board of Trustees, University of Illinois. 3 Copyright (C) 1995 Board of Trustees, University of Illinois.
4 Copyright (C) 1995 Tinker Systems 4 Copyright (C) 1995 Tinker Systems
5 Copyright (C) 1995, 1996, 2001, 2002, 2004 Ben Wing 5 Copyright (C) 1995, 1996, 2001, 2002, 2004, 2005 Ben Wing
6 Copyright (C) 1995 Sun Microsystems 6 Copyright (C) 1995 Sun Microsystems
7 7
8 This file is part of XEmacs. 8 This file is part of XEmacs.
9 9
10 XEmacs is free software; you can redistribute it and/or modify it 10 XEmacs is free software; you can redistribute it and/or modify it
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */ 23 Boston, MA 02111-1307, USA. */
24 24
25 /* Synched up with: Not in FSF. */ 25 /* Synched up with: Not in FSF. */
26 26
27 /* Original author: Jamie Zawinski for 19.8 27 /* Originally part of glyphs.c.
28 font-truename stuff added by Jamie Zawinski for 19.10 28
29 subwindow support added by Chuck Thompson
30 additional XPM support added by Chuck Thompson
31 initial X-Face support added by Stig
32 rewritten/restructured by Ben Wing for 19.12/19.13
33 GIF/JPEG support added by Ben Wing for 19.14 29 GIF/JPEG support added by Ben Wing for 19.14
34 PNG support added by Bill Perry for 19.14 30 PNG support added by Bill Perry for 19.14
35 Improved GIF/JPEG support added by Bill Perry for 19.14 31 Improved GIF/JPEG support added by Bill Perry for 19.14
36 Cleanup/simplification of error handling by Ben Wing for 19.14 32 Cleanup/simplification of error handling by Ben Wing for 19.14
37 Pointer/icon overhaul, more restructuring by Ben Wing for 19.14
38 GIF support changed to external Gifreader lib by Jareth Hein for 21.0 33 GIF support changed to external Gifreader lib by Jareth Hein for 21.0
39 Many changes for color work and optimizations by Jareth Hein for 21.0 34 Many changes for color work and optimizations by Jareth Hein for 21.0
40 Switch of GIF/JPEG/PNG to new EImage intermediate code by Jareth Hein for 21.0 35 Switch of GIF/JPEG/PNG to new EImage intermediate code by Jareth Hein for 21.0
41 TIFF code by Jareth Hein for 21.0 36 TIFF code by Jareth Hein for 21.0
42 Generalization for ms-windows by Andy Piper for 21.0
43 TODO: 37 TODO:
44 Convert images.el to C and stick it in here? 38 Convert images.el to C and stick it in here?
45 */ 39 */
46 40
47 #include <config.h> 41 #include <config.h>
323 317
324 /* The code in this routine is based on example.c from the JPEG library 318 /* The code in this routine is based on example.c from the JPEG library
325 source code and from gif_instantiate() */ 319 source code and from gif_instantiate() */
326 static void 320 static void
327 jpeg_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, 321 jpeg_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
328 Lisp_Object UNUSED (pointer_fg), 322 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
329 Lisp_Object UNUSED (pointer_bg),
330 int dest_mask, Lisp_Object domain) 323 int dest_mask, Lisp_Object domain)
331 { 324 {
332 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); 325 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
333 /* It is OK for the unwind data to be local to this function, 326 /* It is OK for the unwind data to be local to this function,
334 because the unwind-protect is always executed when this 327 because the unwind-protect is always executed when this
498 /* now instantiate */ 491 /* now instantiate */
499 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), 492 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain),
500 init_image_instance_from_eimage, 493 init_image_instance_from_eimage,
501 (ii, cinfo.output_width, cinfo.output_height, 1, 494 (ii, cinfo.output_width, cinfo.output_height, 1,
502 unwind.eimage, dest_mask, 495 unwind.eimage, dest_mask,
503 instantiator, domain)); 496 instantiator, pointer_fg, pointer_bg, domain));
504 497
505 /* Step 7: Finish decompression */ 498 /* Step 7: Finish decompression */
506 499
507 jpeg_finish_decompress (&cinfo); 500 jpeg_finish_decompress (&cinfo);
508 /* We can ignore the return value since suspension is not possible 501 /* We can ignore the return value since suspension is not possible
612 longjmp (error_data->setjmp_buffer, 1); 605 longjmp (error_data->setjmp_buffer, 1);
613 } 606 }
614 607
615 static void 608 static void
616 gif_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, 609 gif_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
617 Lisp_Object UNUSED (pointer_fg), 610 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
618 Lisp_Object UNUSED (pointer_bg),
619 int dest_mask, Lisp_Object domain) 611 int dest_mask, Lisp_Object domain)
620 { 612 {
621 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); 613 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
622 /* It is OK for the unwind data to be local to this function, 614 /* It is OK for the unwind data to be local to this function,
623 because the unwind-protect is always executed when this 615 because the unwind-protect is always executed when this
727 } 719 }
728 720
729 /* now instantiate */ 721 /* now instantiate */
730 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), 722 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain),
731 init_image_instance_from_eimage, 723 init_image_instance_from_eimage,
732 (ii, width, height, unwind.giffile->ImageCount, unwind.eimage, dest_mask, 724 (ii, width, height, unwind.giffile->ImageCount,
733 instantiator, domain)); 725 unwind.eimage, dest_mask, instantiator, pointer_fg,
726 pointer_bg, domain));
734 } 727 }
735 728
736 /* We read the gif successfully. If we have more than one slice then 729 /* We read the gif successfully. If we have more than one slice then
737 animate the gif. */ 730 animate the gif. */
738 if (unwind.giffile->ImageCount > 1) 731 if (unwind.giffile->ImageCount > 1)
862 return Qnil; 855 return Qnil;
863 } 856 }
864 857
865 static void 858 static void
866 png_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, 859 png_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
867 Lisp_Object UNUSED (pointer_fg), 860 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
868 Lisp_Object UNUSED (pointer_bg),
869 int dest_mask, Lisp_Object domain) 861 int dest_mask, Lisp_Object domain)
870 { 862 {
871 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); 863 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
872 struct png_unwind_data unwind; 864 struct png_unwind_data unwind;
873 int speccount = specpdl_depth (); 865 int speccount = specpdl_depth ();
1044 1036
1045 /* now instantiate */ 1037 /* now instantiate */
1046 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), 1038 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain),
1047 init_image_instance_from_eimage, 1039 init_image_instance_from_eimage,
1048 (ii, width, height, 1, unwind.eimage, dest_mask, 1040 (ii, width, height, 1, unwind.eimage, dest_mask,
1049 instantiator, domain)); 1041 instantiator, pointer_fg, pointer_bg, domain));
1050 1042
1051 /* This will clean up everything else. */ 1043 /* This will clean up everything else. */
1052 unbind_to (speccount); 1044 unbind_to (speccount);
1053 } 1045 }
1054 1046
1240 module, warn_str); 1232 module, warn_str);
1241 } 1233 }
1242 1234
1243 static void 1235 static void
1244 tiff_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, 1236 tiff_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
1245 Lisp_Object UNUSED (pointer_fg), 1237 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
1246 Lisp_Object UNUSED (pointer_bg),
1247 int dest_mask, Lisp_Object domain) 1238 int dest_mask, Lisp_Object domain)
1248 { 1239 {
1249 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); 1240 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
1250 tiff_memory_storage mem_struct; 1241 tiff_memory_storage mem_struct;
1251 /* It is OK for the unwind data to be local to this function, 1242 /* It is OK for the unwind data to be local to this function,
1334 1325
1335 /* now instantiate */ 1326 /* now instantiate */
1336 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), 1327 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain),
1337 init_image_instance_from_eimage, 1328 init_image_instance_from_eimage,
1338 (ii, width, height, 1, unwind.eimage, dest_mask, 1329 (ii, width, height, 1, unwind.eimage, dest_mask,
1339 instantiator, domain)); 1330 instantiator, pointer_fg, pointer_bg, domain));
1340 1331
1341 unbind_to (speccount); 1332 unbind_to (speccount);
1342 } 1333 }
1343 1334
1344 #endif /* HAVE_TIFF */ 1335 #endif /* HAVE_TIFF */