X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b8193d807ff5d2eae0c5621a38c4fce1173ed265..93df3f5f7318c1aa3f930e9e4f631a2569948149:/contrib/src/stc/PlatWX.cpp?ds=sidebyside diff --git a/contrib/src/stc/PlatWX.cpp b/contrib/src/stc/PlatWX.cpp index 2e80894a47..f41304a50a 100644 --- a/contrib/src/stc/PlatWX.cpp +++ b/contrib/src/stc/PlatWX.cpp @@ -14,6 +14,10 @@ #include "wx/imaglist.h" #include "wx/tokenzr.h" +#ifdef wxHAVE_RAW_BITMAP +#include "wx/rawbmp.h" +#endif + #include "Platform.h" #include "PlatWX.h" #include "wx/stc/stc.h" @@ -334,12 +338,85 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4); } +#ifdef __WXMSW__ +#define wxPy_premultiply(p, a) ((p) * (a) / 0xff) +#else +#define wxPy_premultiply(p, a) (p) +#endif + void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags) { -// ** TODO + ColourAllocated outline, int alphaOutline, + int /*flags*/) { +#ifdef wxHAVE_RAW_BITMAP + + // TODO: do something with cornerSize + wxUnusedVar(cornerSize); + + int x, y; + wxRect r = wxRectFromPRectangle(rc); + wxBitmap bmp(r.width, r.height, 32); + wxAlphaPixelData pixData(bmp); + pixData.UseAlpha(); + + // Set the fill pixels + ColourDesired cdf(fill.AsLong()); + int red = cdf.GetRed(); + int green = cdf.GetGreen(); + int blue = cdf.GetBlue(); + + wxAlphaPixelData::Iterator p(pixData); + for (y=0; yDrawBitmap(bmp, r.x, r.y, true); + +#else + wxUnusedVar(cornerSize); + wxUnusedVar(alphaFill); + wxUnusedVar(alphaOutline); RectangleDraw(rc, outline, fill); +#endif } void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {