|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
|
|
|
|
class GDIPlusImageDrawer
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
GDIPlusImageDrawer(HDC hDestDC, HBITMAP hb);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><CDB8>ɫ
|
|
|
|
|
|
void SetTransparentColor(const std::optional<Gdiplus::Color>& transparentColor);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
|
|
|
|
|
void SetOpacity(float opacity);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> ROP <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
void SetROP(DWORD rop);
|
|
|
|
|
|
|
|
|
|
|
|
bool Draw(int xDest, int yDest, int nDestWidth, int nDestHeight,
|
|
|
|
|
|
int xSrc, int ySrc, int nSrcWidth, int nSrcHeight);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
void SetTransparentColor(Gdiplus::ImageAttributes& attributes);
|
|
|
|
|
|
|
|
|
|
|
|
void SetOpacity(Gdiplus::ImageAttributes& attributes);
|
|
|
|
|
|
|
|
|
|
|
|
bool PerformDraw(int xDest, int yDest, int nDestWidth, int nDestHeight,
|
|
|
|
|
|
int xSrc, int ySrc, int nSrcWidth, int nSrcHeight,
|
|
|
|
|
|
Gdiplus::ImageAttributes& attributes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool PerformROP(int xDest, int yDest, int nDestWidth, int nDestHeight,
|
|
|
|
|
|
int xSrc, int ySrc, int nSrcWidth, int nSrcHeight,
|
|
|
|
|
|
Gdiplus::ImageAttributes& attributes);
|
|
|
|
|
|
|
|
|
|
|
|
HDC m_hDestDC = nullptr;
|
|
|
|
|
|
HBITMAP m_hBitmap = nullptr;
|
|
|
|
|
|
float m_opacity = 1.0;
|
|
|
|
|
|
DWORD m_rop = 0;
|
|
|
|
|
|
std::optional<Gdiplus::Color> m_transparentColor;
|
|
|
|
|
|
};
|