git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40554
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/filefn.h"
#include "wx/rawbmp.h"
#include "wx/filefn.h"
#include "wx/rawbmp.h"
- // need this to get gdk_image_new_bitmap()
- #define GDK_ENABLE_BROKEN
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
{
char bit=1;
char shift = bit << (w % 8);
{
char bit=1;
char shift = bit << (w % 8);
- GdkVisual *visual = wxTheApp->GetGdkVisual();
-
- unsigned char *data_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
-
- GdkImage *data_image =
- gdk_image_new_bitmap( visual, data_data, width, height );
+ GdkGC* data_gc = gdk_gc_new(M_BMPDATA->m_pixmap);
+ GdkColor color;
+ color.pixel = 1;
+ gdk_gc_set_foreground(data_gc, &color);
+ gdk_draw_rectangle(M_BMPDATA->m_pixmap, data_gc, true, 0, 0, width, height);
+ GdkImage* data_image = gdk_drawable_get_image(M_BMPDATA->m_pixmap, 0, 0, width, height);
// Create mask image
GdkImage *mask_image = (GdkImage*) NULL;
// Create mask image
GdkImage *mask_image = (GdkImage*) NULL;
- unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
-
- mask_image = gdk_image_new_bitmap( visual, mask_data, width, height );
-
wxMask *mask = new wxMask();
mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 );
wxMask *mask = new wxMask();
mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 );
+ mask_gc = gdk_gc_new(mask->m_bitmap);
+ gdk_gc_set_foreground(mask_gc, &color);
+ gdk_draw_rectangle(mask->m_bitmap, mask_gc, true, 0, 0, width, height);
+ mask_image = gdk_drawable_get_image(mask->m_bitmap, 0, 0, width, height);
int b = data[index];
index++;
int b = data[index];
index++;
+ if (mask_image != NULL)
{
if ((r == r_mask) && (b == b_mask) && (g == g_mask))
{
if ((r == r_mask) && (b == b_mask) && (g == g_mask))
- gdk_image_put_pixel( mask_image, x, y, 1 );
- else
gdk_image_put_pixel( mask_image, x, y, 0 );
}
if ((r == 255) && (b == 255) && (g == 255))
gdk_image_put_pixel( mask_image, x, y, 0 );
}
if ((r == 255) && (b == 255) && (g == 255))
- gdk_image_put_pixel( data_image, x, y, 1 );
- else
gdk_image_put_pixel( data_image, x, y, 0 );
} // for
gdk_image_put_pixel( data_image, x, y, 0 );
} // for
- GdkGC *data_gc = gdk_gc_new( GetPixmap() );
-
gdk_draw_image( GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
g_object_unref (data_image);
gdk_draw_image( GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
g_object_unref (data_image);
+ if (mask_image != NULL)
- GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() );
-
gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
g_object_unref (mask_image);
gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
g_object_unref (mask_image);
- GdkImage *mask_image = (GdkImage*) NULL;
-
if (!image.HasMask())
return true;
if (!image.HasMask())
return true;
- unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
-
- mask_image = gdk_image_new_bitmap( visual, mask_data, width, height );
-
wxMask *mask = new wxMask();
mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 );
wxMask *mask = new wxMask();
mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 );
+ GdkGC* mask_gc = gdk_gc_new(mask->m_bitmap);
+ GdkColor color;
+ color.pixel = 1;
+ gdk_gc_set_foreground(mask_gc, &color);
+ gdk_draw_rectangle(mask->m_bitmap, mask_gc, true, 0, 0, width, height);
+ GdkImage* mask_image = gdk_drawable_get_image(mask->m_bitmap, 0, 0, width, height);
index++;
if ((r == r_mask) && (b == b_mask) && (g == g_mask))
index++;
if ((r == r_mask) && (b == b_mask) && (g == g_mask))
- gdk_image_put_pixel( mask_image, x, y, 1 );
- else
gdk_image_put_pixel( mask_image, x, y, 0 );
} // for
} // for
// Blit mask
gdk_image_put_pixel( mask_image, x, y, 0 );
} // for
} // for
// Blit mask
- GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() );
-
gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
g_object_unref (mask_image);
gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
g_object_unref (mask_image);