summaryrefslogtreecommitdiff
path: root/src/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c53
1 files changed, 42 insertions, 11 deletions
diff --git a/src/image.c b/src/image.c
index 5eb41322950..74cd6b854d7 100644
--- a/src/image.c
+++ b/src/image.c
@@ -129,6 +129,10 @@ typedef struct ns_bitmap_record Bitmap_Record;
#endif /* HAVE_NS */
+#ifdef HAVE_PGTK
+typedef struct pgtk_bitmap_record Bitmap_Record;
+#endif /* HAVE_PGTK */
+
#if (defined HAVE_X_WINDOWS \
&& ! (defined HAVE_NTGUI || defined USE_CAIRO || defined HAVE_NS))
/* W32_TODO : Color tables on W32. */
@@ -430,6 +434,14 @@ image_create_bitmap_from_data (struct frame *f, char *bits,
return -1;
#endif
+#ifdef HAVE_PGTK
+ Emacs_Pixmap bitmap = image_pix_container_create_from_bitmap_data(f, bits,
+ width,
+ height,
+ 0xffffffff,
+ 0xff000000);
+#endif
+
id = image_allocate_bitmap_record (f);
#ifdef HAVE_NS
@@ -437,6 +449,11 @@ image_create_bitmap_from_data (struct frame *f, char *bits,
dpyinfo->bitmaps[id - 1].depth = 1;
#endif
+#ifdef HAVE_PGTK
+ dpyinfo->bitmaps[id - 1].img = bitmap;
+ dpyinfo->bitmaps[id - 1].depth = 1;
+#endif
+
dpyinfo->bitmaps[id - 1].file = NULL;
dpyinfo->bitmaps[id - 1].height = height;
dpyinfo->bitmaps[id - 1].width = width;
@@ -489,6 +506,10 @@ image_create_bitmap_from_file (struct frame *f, Lisp_Object file)
return id;
#endif
+#ifdef HAVE_PGTK
+ return -1; // fixme:
+#endif
+
#ifdef HAVE_X_WINDOWS
unsigned int width, height;
Pixmap bitmap;
@@ -561,6 +582,9 @@ free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm)
ns_release_object (bm->img);
#endif
+#ifdef HAVE_PGTK
+#endif
+
if (bm->file)
{
xfree (bm->file);
@@ -1320,7 +1344,6 @@ image_ascent (struct image *img, struct face *face, struct glyph_slice *slice)
return ascent;
}
-
/* Image background colors. */
@@ -1344,6 +1367,7 @@ four_corners_best (Emacs_Pix_Context pimg, int *corners,
corner_pixels[3] = GET_PIXEL (pimg, corners[LEFT_CORNER], corners[BOT_CORNER] - 1);
}
else
+
{
/* Get the colors at the corner_pixels of pimg. */
corner_pixels[0] = GET_PIXEL (pimg, 0, 0);
@@ -3908,6 +3932,13 @@ xbm_load (struct frame *f, struct image *img)
XPM images
***********************************************************************/
+#if defined (HAVE_XPM) || defined (HAVE_NS) || defined (HAVE_PGTK)
+
+static bool xpm_image_p (Lisp_Object object);
+static bool xpm_load (struct frame *f, struct image *img);
+
+#endif /* HAVE_XPM || HAVE_NS */
+
#ifdef HAVE_XPM
#ifdef HAVE_NTGUI
/* Indicate to xpm.h that we don't have Xlib. */
@@ -4795,7 +4826,7 @@ xpm_load_image (struct frame *f,
Lisp_Object (*get_color_table) (Lisp_Object, const char *, int);
Lisp_Object frame, color_symbols, color_table;
int best_key;
-#ifndef HAVE_NS
+#if !defined(HAVE_NS)
bool have_mask = false;
#endif
Emacs_Pix_Container ximg = NULL, mask_img = NULL;
@@ -4849,7 +4880,7 @@ xpm_load_image (struct frame *f,
}
if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)
-#ifndef HAVE_NS
+#if !defined(HAVE_NS)
|| !image_create_x_image_and_pixmap (f, img, width, height, 1,
&mask_img, 1)
#endif
@@ -4977,7 +5008,7 @@ xpm_load_image (struct frame *f,
PUT_PIXEL (ximg, x, y,
FIXNUMP (color_val) ? XFIXNUM (color_val) : frame_fg);
-#ifndef HAVE_NS
+#if !defined(HAVE_NS)
PUT_PIXEL (mask_img, x, y,
(!EQ (color_val, Qt) ? PIX_MASK_DRAW
: (have_mask = true, PIX_MASK_RETAIN)));
@@ -4998,7 +5029,7 @@ xpm_load_image (struct frame *f,
IMAGE_BACKGROUND (img, f, ximg);
image_put_x_image (f, img, ximg, 0);
-#ifndef HAVE_NS
+#if !defined(HAVE_NS)
if (have_mask)
{
/* Fill in the background_transparent field while we have the
@@ -5729,7 +5760,7 @@ image_disable_image (struct frame *f, struct image *img)
if (n_planes < 2 || cross_disabled_images)
{
#ifndef HAVE_NTGUI
-#ifndef HAVE_NS /* TODO: NS support, however this not needed for toolbars */
+#if !defined(HAVE_NS) /* TODO: NS support, however this not needed for toolbars */
#ifndef USE_CAIRO
#define CrossForeground(f) BLACK_PIX_DEFAULT (f)
@@ -5807,7 +5838,7 @@ image_build_heuristic_mask (struct frame *f, struct image *img,
image_clear_image_1 (f, img, CLEAR_IMAGE_MASK);
#ifndef HAVE_NTGUI
-#ifndef HAVE_NS
+#if !defined HAVE_NS
/* Create an image and pixmap serving as mask. */
if (! image_create_x_image_and_pixmap (f, img, img->width, img->height, 1,
&mask_img, 1))
@@ -5869,7 +5900,7 @@ image_build_heuristic_mask (struct frame *f, struct image *img,
if (XGetPixel (ximg, x, y) == bg)
ns_set_alpha (ximg, x, y, 0);
#endif /* HAVE_NS */
-#ifndef HAVE_NS
+#if !defined HAVE_NS
/* Fill in the background_transparent field while we have the mask handy. */
image_background_transparent (img, f, mask_img);
@@ -9314,8 +9345,8 @@ imagemagick_load_image (struct frame *f, struct image *img,
color_scale * pixel.red,
color_scale * pixel.green,
color_scale * pixel.blue));
- }
- }
+ }
+ }
DestroyPixelIterator (iterator);
}
@@ -10511,7 +10542,7 @@ static struct image_type const image_types[] =
{ SYMBOL_INDEX (Qjpeg), jpeg_image_p, jpeg_load, image_clear_image,
IMAGE_TYPE_INIT (init_jpeg_functions) },
#endif
-#if defined HAVE_XPM || defined HAVE_NS
+#if defined HAVE_XPM || defined HAVE_NS || defined USE_CAIRO
{ SYMBOL_INDEX (Qxpm), xpm_image_p, xpm_load, image_clear_image,
IMAGE_TYPE_INIT (init_xpm_functions) },
#endif