mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed a regression (in r776) that ImageCrop cannot treat a transparent part of the outside of the image.
This commit is contained in:
parent
8ddc383ed1
commit
ec49c6e588
@ -425,7 +425,8 @@ void CTintedImage::ApplyCrop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rect r(0, 0, m_Crop.Width, m_Crop.Height);
|
Rect r(0, 0, m_Crop.Width, m_Crop.Height);
|
||||||
m_BitmapTint = new Bitmap(r.Width, r.Height, AdjustNonAlphaPixelFormat(m_Bitmap));
|
m_BitmapTint = new Bitmap(r.Width, r.Height,
|
||||||
|
AdjustNonAlphaPixelFormat(m_Bitmap, x >= 0 && y >= 0 && (x + m_Crop.Width) <= imageW && (y + m_Crop.Height) <= imageH));
|
||||||
|
|
||||||
Graphics graphics(m_BitmapTint);
|
Graphics graphics(m_BitmapTint);
|
||||||
graphics.DrawImage(m_Bitmap, r, x, y, r.Width, r.Height, UnitPixel);
|
graphics.DrawImage(m_Bitmap, r, x, y, r.Width, r.Height, UnitPixel);
|
||||||
|
@ -85,8 +85,8 @@ public:
|
|||||||
void DisposeImage();
|
void DisposeImage();
|
||||||
void LoadImage(const std::wstring& imageName, bool bLoadAlways);
|
void LoadImage(const std::wstring& imageName, bool bLoadAlways);
|
||||||
|
|
||||||
static Gdiplus::PixelFormat AdjustNonAlphaPixelFormat(Gdiplus::Bitmap* bitmap)
|
static Gdiplus::PixelFormat AdjustNonAlphaPixelFormat(Gdiplus::Bitmap* bitmap, bool additionalCondition = true)
|
||||||
{ return (bitmap->GetPixelFormat() == PixelFormat24bppRGB) ? PixelFormat24bppRGB : PixelFormat32bppPARGB; }
|
{ return (bitmap->GetPixelFormat() == PixelFormat24bppRGB && additionalCondition) ? PixelFormat24bppRGB : PixelFormat32bppPARGB; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum CROPMODE
|
enum CROPMODE
|
||||||
|
Loading…
Reference in New Issue
Block a user