Added image manipulation codes to Meter=BITMAP/BUTTON/HISTOGRAM and refactored them.

For BITMAP/BUTTON:
- Greyscale
- ImageTint
- ImageAlpha
- ColorMatrixN
- ImageFlip
Note: BITMAP and BUTTON are not able to support ImageRotate.

For HISTOGRAM:
- PrimaryGreyscale
- PrimaryImageTint
- PrimaryImageAlpha
- PrimaryColorMatrixN
- PrimaryImageFlip
- PrimaryImageRotate
- Secondary***
- Both***
This commit is contained in:
spx
2010-11-27 19:53:23 +00:00
parent 674cebda64
commit a0ae80cd04
15 changed files with 967 additions and 753 deletions

View File

@ -20,17 +20,13 @@
#define __METERIMAGE_H__
#include "Meter.h"
#include "TintedImage.h"
#include "MeterWindow.h"
namespace Gdiplus
{
class Bitmap;
};
class CMeterImage : public CMeter
{
public:
CMeterImage(CMeterWindow* meterWindow, WCHAR* wName = L"W", WCHAR* hName = L"H");
CMeterImage(CMeterWindow* meterWindow);
virtual ~CMeterImage();
virtual void ReadConfig(const WCHAR* section);
@ -41,34 +37,15 @@ public:
protected:
void LoadImage(bool bLoadAlways);
bool CompareColorMatrix(const Gdiplus::ColorMatrix& a, const Gdiplus::ColorMatrix& b);
void ApplyTint();
Gdiplus::Bitmap* TurnGreyscale();
void ApplyTransform();
const std::wstring m_ImageWidthString;
const std::wstring m_ImageHeightString;
Gdiplus::Bitmap* m_Bitmap; // The bitmap
Gdiplus::Bitmap* m_BitmapTint; // The bitmap
CTintedImage m_Image;
std::wstring m_ImageName; // Name of the image
std::wstring m_Path;
bool m_NeedsReload;
bool m_NeedsTinting;
bool m_NeedsTransform;
bool m_WidthDefined;
bool m_HeightDefined;
bool m_PreserveAspectRatio; // If true, aspect ratio of the image is preserved when the image is scaled
HGLOBAL m_hBuffer;
FILETIME m_Modified;
bool m_GreyScale;
Gdiplus::ColorMatrix m_ColorMatrix;
Gdiplus::RotateFlipType m_Flip;
Gdiplus::REAL m_Rotate;
static const Gdiplus::ColorMatrix c_GreyScaleMatrix;
static const Gdiplus::ColorMatrix c_IdentifyMatrix;
};
#endif