From e45b3f17a2448ba87d4abef6df120b58364d88e4 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 26 May 2005 18:07:43 +0000 Subject: [PATCH] Since Scintilla uses XMP internally which doesn't support alpha, check if the images have alpha and convert to a mask. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34351 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/stc/gen_iface.py | 4 ++++ contrib/src/stc/stc.cpp | 4 ++++ src/stc/gen_iface.py | 4 ++++ src/stc/stc.cpp | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/contrib/src/stc/gen_iface.py b/contrib/src/stc/gen_iface.py index 9a6c188200..4e0afbb129 100644 --- a/contrib/src/stc/gen_iface.py +++ b/contrib/src/stc/gen_iface.py @@ -203,6 +203,8 @@ methodOverrideMap = { // convert bmp to a xpm in a string wxMemoryOutputStream strm; wxImage img = bmp.ConvertToImage(); + if (img.HasAlpha()) + img.ConvertAlphaToMask(); img.SaveFile(strm, wxBITMAP_TYPE_XPM); size_t len = strm.GetSize(); char* buff = new char[len+1]; @@ -299,6 +301,8 @@ methodOverrideMap = { // convert bmp to a xpm in a string wxMemoryOutputStream strm; wxImage img = bmp.ConvertToImage(); + if (img.HasAlpha()) + img.ConvertAlphaToMask(); img.SaveFile(strm, wxBITMAP_TYPE_XPM); size_t len = strm.GetSize(); char* buff = new char[len+1]; diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index 86a9690efb..6f580d7941 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -517,6 +517,8 @@ void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp) // convert bmp to a xpm in a string wxMemoryOutputStream strm; wxImage img = bmp.ConvertToImage(); + if (img.HasAlpha()) + img.ConvertAlphaToMask(); img.SaveFile(strm, wxBITMAP_TYPE_XPM); size_t len = strm.GetSize(); char* buff = new char[len+1]; @@ -896,6 +898,8 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) { // convert bmp to a xpm in a string wxMemoryOutputStream strm; wxImage img = bmp.ConvertToImage(); + if (img.HasAlpha()) + img.ConvertAlphaToMask(); img.SaveFile(strm, wxBITMAP_TYPE_XPM); size_t len = strm.GetSize(); char* buff = new char[len+1]; diff --git a/src/stc/gen_iface.py b/src/stc/gen_iface.py index 9a6c188200..4e0afbb129 100644 --- a/src/stc/gen_iface.py +++ b/src/stc/gen_iface.py @@ -203,6 +203,8 @@ methodOverrideMap = { // convert bmp to a xpm in a string wxMemoryOutputStream strm; wxImage img = bmp.ConvertToImage(); + if (img.HasAlpha()) + img.ConvertAlphaToMask(); img.SaveFile(strm, wxBITMAP_TYPE_XPM); size_t len = strm.GetSize(); char* buff = new char[len+1]; @@ -299,6 +301,8 @@ methodOverrideMap = { // convert bmp to a xpm in a string wxMemoryOutputStream strm; wxImage img = bmp.ConvertToImage(); + if (img.HasAlpha()) + img.ConvertAlphaToMask(); img.SaveFile(strm, wxBITMAP_TYPE_XPM); size_t len = strm.GetSize(); char* buff = new char[len+1]; diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 86a9690efb..6f580d7941 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -517,6 +517,8 @@ void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp) // convert bmp to a xpm in a string wxMemoryOutputStream strm; wxImage img = bmp.ConvertToImage(); + if (img.HasAlpha()) + img.ConvertAlphaToMask(); img.SaveFile(strm, wxBITMAP_TYPE_XPM); size_t len = strm.GetSize(); char* buff = new char[len+1]; @@ -896,6 +898,8 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) { // convert bmp to a xpm in a string wxMemoryOutputStream strm; wxImage img = bmp.ConvertToImage(); + if (img.HasAlpha()) + img.ConvertAlphaToMask(); img.SaveFile(strm, wxBITMAP_TYPE_XPM); size_t len = strm.GetSize(); char* buff = new char[len+1]; -- 2.45.2