Mercurial > hg > xemacs-beta
comparison src/glyphs-x.c @ 225:12579d965149 r20-4b11
Import from CVS: tag r20-4b11
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:11:40 +0200 |
parents | 2c611d1463a6 |
children | 557eaa0339bf |
comparison
equal
deleted
inserted
replaced
224:4663b37daab6 | 225:12579d965149 |
---|---|
55 #include "opaque.h" | 55 #include "opaque.h" |
56 | 56 |
57 #include "sysfile.h" | 57 #include "sysfile.h" |
58 | 58 |
59 #ifdef HAVE_IMAGEMAGICK | 59 #ifdef HAVE_IMAGEMAGICK |
60 #ifdef SOLARIS2 /* Try to trick magick.h into not including Xos.h */ | |
61 #define _XOS_H_ | 60 #define _XOS_H_ |
62 #endif | |
63 #ifdef MAGICK_HEADERS_ARE_UNDER_X11 | 61 #ifdef MAGICK_HEADERS_ARE_UNDER_X11 |
64 #include <X11/magick/magick.h> | 62 #include <X11/magick/magick.h> |
65 #else | 63 #else |
66 #include <magick/magick.h> | 64 #include <magick/magick.h> |
67 #endif | 65 #endif |
1754 Screen *scr; | 1752 Screen *scr; |
1755 Visual *visual; | 1753 Visual *visual; |
1756 Colormap cmap; | 1754 Colormap cmap; |
1757 Dimension depth; | 1755 Dimension depth; |
1758 struct imagick_unwind_data unwind; | 1756 struct imagick_unwind_data unwind; |
1759 int speccount = specpdl_depth (); | 1757 int speccount; |
1760 ImageInfo image_info; | 1758 ImageInfo image_info; |
1761 | 1759 |
1762 /* ImageMagick variables */ | 1760 /* ImageMagick variables */ |
1763 | 1761 |
1764 /* Basic error checking */ | 1762 /* Basic error checking */ |
1773 | 1771 |
1774 /* Set up the unwind */ | 1772 /* Set up the unwind */ |
1775 memset (&unwind, 0, sizeof (unwind)); | 1773 memset (&unwind, 0, sizeof (unwind)); |
1776 unwind.dpy = dpy; | 1774 unwind.dpy = dpy; |
1777 unwind.cmap = cmap; | 1775 unwind.cmap = cmap; |
1776 speccount = specpdl_depth(); | |
1778 record_unwind_protect(imagick_instantiate_unwind,make_opaque_ptr(&unwind)); | 1777 record_unwind_protect(imagick_instantiate_unwind,make_opaque_ptr(&unwind)); |
1779 | 1778 |
1780 /* Write out to a temp file - not sure if ImageMagick supports the | 1779 /* Write out to a temp file - not sure if ImageMagick supports the |
1781 ** notion of an abstract 'data source' right now. | 1780 ** notion of an abstract 'data source' right now. |
1782 ** JH: It doesn't as of 3.9.3 | 1781 ** JH: It doesn't as of 3.9.3 |
1880 */ | 1879 */ |
1881 { | 1880 { |
1882 int i,j,x,b; | 1881 int i,j,x,b; |
1883 unsigned int bytes_per_pixel, scanline_pad; | 1882 unsigned int bytes_per_pixel, scanline_pad; |
1884 unsigned long pixval; | 1883 unsigned long pixval; |
1885 unsigned char *q; | 1884 unsigned char *q, pixar[3]; |
1886 RunlengthPacket *p; | 1885 RunlengthPacket *p; |
1887 | 1886 |
1888 q = (unsigned char *) unwind.ximage->data; | 1887 q = (unsigned char *) unwind.ximage->data; |
1889 x = 0; | 1888 x = 0; |
1890 p = unwind.image->pixels; | 1889 p = unwind.image->pixels; |
1900 else | 1899 else |
1901 { | 1900 { |
1902 /* ### NOW what? */ | 1901 /* ### NOW what? */ |
1903 pixval = 0; | 1902 pixval = 0; |
1904 } | 1903 } |
1905 | 1904 |
1905 for (b=0; b < bytes_per_pixel; b++) { | |
1906 if (unwind.ximage->bitmap_bit_order == LSBFirst) | |
1907 pixar[b] = (unsigned char)pixval; | |
1908 else | |
1909 pixar[bytes_per_pixel - 1 - b] = (unsigned char)pixval; | |
1910 pixval>>=8; | |
1911 } | |
1912 | |
1906 for (j=0; j <= ((int) p->length); j++) { | 1913 for (j=0; j <= ((int) p->length); j++) { |
1907 for (b=0; b < bytes_per_pixel; b++) | 1914 for (b=0; b < bytes_per_pixel; b++) |
1908 *q++=(unsigned char) (pixval >> (8*b)); | 1915 *q++= pixar[b]; |
1909 x++; | 1916 x++; |
1910 if (x == unwind.ximage->width) { | 1917 if (x == unwind.ximage->width) { |
1911 x=0; | 1918 x=0; |
1912 q+=scanline_pad; | 1919 q+=scanline_pad; |
1913 } | 1920 } |