⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpixelrgb8.cpp

📁 简单的COM 实际例子 用法1
💻 CPP
字号:
//
// CPixelRGB8.cpp
//

#include <streams.h>
#include <olectl.h>
#include "CBasePixel.h"
#include "CPixelRGB8.h"

//////////////////////////////////////////////////////////////////////
CPixelRGB8::CPixelRGB8() :
m_nPaletteEntry(10)
{
}

CPixelRGB8::~CPixelRGB8()
{
}

void CPixelRGB8::ConvertByCover(unsigned char * inPixel)
{
	if (inPixel)
	{
		*inPixel = m_nPaletteEntry;
	}
}

void CPixelRGB8::SideEffectColorChanged(void)
{
	CBasePixel::SideEffectColorChanged();
	SetPaletteEntries();
}

//
// SetPaletteEntries
//
// If we set our palette to the current system palette + the colours we want
// the system has the least amount of work to do whilst plotting our images,
// if this stream is rendered to the current display. The first non reserved
// palette slot is at m_Palette[10], so put our first colour there. Also
// guarantees that black is always represented by zero in the frame buffer
//
bool CPixelRGB8::SetPaletteEntries(void)
{
	PALETTEENTRY    m_Palette[256];

	HDC  hdc = GetDC(NULL);	// hdc for the current display.
	UINT res = GetSystemPaletteEntries(hdc, 0, iPALETTE_COLORS, (LPPALETTEENTRY) &m_Palette);
	ReleaseDC(NULL, hdc);

	if (res != 0) 
	{
		m_Palette[m_nPaletteEntry].peBlue  = m_TargetB;
		m_Palette[m_nPaletteEntry].peGreen = m_TargetG;
		m_Palette[m_nPaletteEntry].peRed   = m_TargetR;
		m_Palette[m_nPaletteEntry].peFlags = 0;
		return true;
	}

	return false;	
} // SetPaletteEntries

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -