X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b8193d807ff5d2eae0c5621a38c4fce1173ed265..3030ae493df7500fd5da7555f141c0c8a690bd8a:/contrib/src/stc/PlatWX.cpp diff --git a/contrib/src/stc/PlatWX.cpp b/contrib/src/stc/PlatWX.cpp index 2e80894a47..e19b281f8c 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,78 @@ 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 + 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 + RectangleDraw(rc, outline, fill); +#endif } void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {