mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
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:
85
Library/TintedImage.h
Normal file
85
Library/TintedImage.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
Copyright (C) 2010 Kimmo Pekkola, MattKing, spx
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __TINTEDIMAGE_H__
|
||||
#define __TINTEDIMAGE_H__
|
||||
|
||||
#include "Meter.h"
|
||||
#include "MeterWindow.h"
|
||||
|
||||
class CTintedImage
|
||||
{
|
||||
public:
|
||||
CTintedImage(bool disableTransform = false);
|
||||
virtual ~CTintedImage();
|
||||
|
||||
void SetConfigAttributes(const WCHAR* name, const WCHAR* prefix);
|
||||
void ReadConfig(CConfigParser& parser, const WCHAR* section);
|
||||
|
||||
bool IsLoaded() { return (m_Bitmap != NULL); }
|
||||
bool IsTinted() { return (m_BitmapTint != NULL); }
|
||||
bool IsConfigsChanged() { return m_NeedsTinting || m_NeedsTransform; }
|
||||
void ClearConfigFlags() { m_NeedsTinting = m_NeedsTransform = false; }
|
||||
|
||||
Gdiplus::Bitmap* GetOriginalImage() { return m_Bitmap; }
|
||||
Gdiplus::Bitmap* GetTintedImage() { return m_BitmapTint; }
|
||||
Gdiplus::Bitmap* GetImage() { return (m_BitmapTint) ? m_BitmapTint : m_Bitmap; }
|
||||
|
||||
void DisposeImage();
|
||||
void LoadImage(const std::wstring& imageName, bool bLoadAlways);
|
||||
|
||||
protected:
|
||||
void ApplyTint();
|
||||
void ApplyTransform();
|
||||
|
||||
static Gdiplus::Bitmap* TurnGreyscale(Gdiplus::Bitmap* source);
|
||||
static bool CompareColorMatrix(const Gdiplus::ColorMatrix& a, const Gdiplus::ColorMatrix& b);
|
||||
|
||||
Gdiplus::Bitmap* m_Bitmap; // The bitmap
|
||||
Gdiplus::Bitmap* m_BitmapTint; // The tinted bitmap
|
||||
|
||||
HGLOBAL m_hBuffer;
|
||||
FILETIME m_Modified;
|
||||
|
||||
std::wstring m_ConfigName;
|
||||
std::wstring m_ConfigGreyscale;
|
||||
std::wstring m_ConfigImageTint;
|
||||
std::wstring m_ConfigImageAlpha;
|
||||
std::wstring m_ConfigColorMatrix1;
|
||||
std::wstring m_ConfigColorMatrix2;
|
||||
std::wstring m_ConfigColorMatrix3;
|
||||
std::wstring m_ConfigColorMatrix4;
|
||||
std::wstring m_ConfigColorMatrix5;
|
||||
std::wstring m_ConfigImageFlip;
|
||||
std::wstring m_ConfigImageRotate;
|
||||
|
||||
const bool m_DisableTransform;
|
||||
|
||||
bool m_NeedsTinting;
|
||||
bool m_NeedsTransform;
|
||||
|
||||
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
|
Reference in New Issue
Block a user