📄 color.h
字号:
// (C) Copyright 1996 by Anthony J. Carin. All Rights Reserved.
#ifndef COLOR_H
#define COLOR_H
#include <windef.h>
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned long ulong;
typedef unsigned char uchar;
class tccolor
{
public:
tccolor() { val = 0; }
tccolor(COLORREF c) { val = c; }
tccolor(tccolor &c) { val = c.val; }
operator COLORREF() { return val; }
void operator =(COLORREF c) { val = c; }
float rvalue() { return (float) GetRValue(val)/255.0f; }
float gvalue() { return (float) GetGValue(val)/255.0f; }
float bvalue() { return (float) GetBValue(val)/255.0f; }
friend COLORREF operator +(tccolor& c, uchar v);
friend COLORREF operator -(tccolor& c, uchar v);
private:
COLORREF val;
};
inline COLORREF operator +(tccolor& c, uchar v)
{
return RGB((((GetRValue(c.val)+v))<256) ? ((GetRValue(c.val))+v):255,
(((GetGValue(c.val)+v))<256) ? ((GetGValue(c.val))+v):255,
(((GetBValue(c.val)+v))<256) ? ((GetBValue(c.val))+v):255);
}
inline COLORREF operator -(tccolor& c, uchar v)
{
return RGB((((GetRValue(c.val)-v))>=0) ? ((GetRValue(c.val))-v):0,
(((GetGValue(c.val)-v))>=0) ? ((GetGValue(c.val))-v):0,
(((GetBValue(c.val)-v))>=0) ? ((GetBValue(c.val))-v):0);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -