You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
#include <optional>
|
|
|
|
class GDIPlusImageDrawer
|
|
{
|
|
public:
|
|
GDIPlusImageDrawer(HDC hDestDC, HBITMAP hb);
|
|
|
|
// ÉèÖÃ͸Ã÷É«
|
|
void SetTransparentColor(const std::optional<Gdiplus::Color>& transparentColor);
|
|
|
|
// ÉèÖÃ͸Ã÷¶È
|
|
void SetOpacity(float opacity);
|
|
|
|
// ÉèÖÃ ROP ²Ù×÷
|
|
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;
|
|
};
|