#include "wx/icon.h"
#include "wx/log.h"
#include "wx/control.h"
+#include "wx/dcmemory.h"
#include <Xm/Xm.h>
M_BITMAPHANDLERDATA->m_bitmapMask->SetPixmap((WXPixmap) mask);
}
+ unsigned int depthRet;
+ int xRet, yRet;
+ unsigned int widthRet, heightRet, borderWidthRet;
+ Window rootWindowRet;
+ XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
+ &widthRet, &heightRet, &borderWidthRet, &depthRet);
+
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
+
+ /*
if ( xpmAttr.npixels > 2 )
{
M_BITMAPHANDLERDATA->m_depth = 8; // TODO: next time not just a guess :-) ...
{
M_BITMAPHANDLERDATA->m_depth = 1; // mono
}
+ */
+
+ M_BITMAPHANDLERDATA->m_depth = depthRet;
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
// Set attributes
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
+
+ unsigned int depthRet;
+ int xRet, yRet;
+ unsigned int widthRet, heightRet, borderWidthRet;
+ Window rootWindowRet;
+ XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
+ &widthRet, &heightRet, &borderWidthRet, &depthRet);
+
+ /*
if ( xpmAttr.npixels > 2 )
{
M_BITMAPHANDLERDATA->m_depth = 8; // next time not just a guess :-) ...
{
M_BITMAPHANDLERDATA->m_depth = 1; // mono
}
+ */
+
+ M_BITMAPHANDLERDATA->m_depth = depthRet;
+
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
XpmFreeAttributes(&xpmAttr);
M_BITMAPHANDLERDATA->m_ok = TRUE;
{
Display *dpy = (Display*) M_BITMAPDATA->m_display;
+ if (M_BITMAPDATA->m_insensPixmap)
+ return M_BITMAPDATA->m_insensPixmap;
+
+ if (!w)
+ {
+ M_BITMAPDATA->m_insensPixmap = (WXPixmap) XCreateInsensitivePixmap(dpy, (Pixmap) M_BITMAPDATA->m_pixmap);
+ if (M_BITMAPDATA->m_insensPixmap)
+ return M_BITMAPDATA->m_insensPixmap;
+ else
+ return M_BITMAPDATA->m_pixmap;
+ }
+
if (M_BITMAPDATA->m_insensImage == (WXPixmap) 0)
return M_BITMAPDATA->m_pixmap;
return ipixmap;
}
+// Creates a bitmap with transparent areas drawn in
+// the given colour.
+wxBitmap wxCreateMaskedBitmap(wxBitmap& bitmap, wxColour& colour)
+{
+ wxBitmap newBitmap(bitmap.GetWidth(),
+ bitmap.GetHeight(),
+ bitmap.GetDepth());
+ wxMemoryDC destDC;
+ wxMemoryDC srcDC;
+ srcDC.SelectObject(bitmap);
+ destDC.SelectObject(newBitmap);
+
+ wxBrush brush(colour, wxSOLID);
+ destDC.SetOptimization(FALSE);
+ destDC.SetBackground(brush);
+ destDC.Clear();
+ destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), & srcDC, 0, 0, wxCOPY, TRUE);
+
+ return newBitmap;
+}