colorpixel.cpp

来自「刚上传内容的相关CODEC不能单独上传。于是」· C++ 代码 · 共 45 行

CPP
45
字号
// ColorPixel.cpp: implementation of the CColorPixel class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ColorPixel.h"

#include <math.h>
#include <conio.h>

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

#define PI	3.14159265358979
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CColorPixel::CColorPixel()
{
	r = g = b = 0;
}

CColorPixel::~CColorPixel()
{

}

void CColorPixel::operator = (COLORREF& pixel)
{
	r = (BYTE)(pixel&0x000000FF);
	g = (BYTE)((pixel&0x0000FF00)>>8);
	b = (BYTE)((pixel&0x00FF0000)>>16);
}

void CColorPixel::operator = (int& pixel)
{
	r = (BYTE)(pixel&0x000000FF);
	g = (BYTE)((pixel&0x0000FF00)>>8);
	b = (BYTE)((pixel&0x00FF0000)>>16);
}

⌨️ 快捷键说明

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