image.h
来自「源代码演示了在Windows下角色扮演游戏的制作过程」· C头文件 代码 · 共 70 行
H
70 行
//
// 24Bits/Pixel图像
//
// Copyright (c) 2000-2002 Chihiro.SAKAMOTO (HyperWorks)
//
#ifndef __image_h
#define __image_h
#include "Dib.h"
#include "Misc.h"
class CDC;
//
// 专给24bit使用的DIB类
//
class CImage: public CDib {
public:
CImage(): CDib() {}
CImage(int width, int height);
BOOL Create(int width, int height);
BOOL LoadImage(const char *name, int ox=0, int oy=0);
void Copy(const CImage *image, const CRect &rect);
void Copy(const CImage *image);
void FillRect(const CRect &rect, COLORREF color);
void FillRect(int x, int y, int w, int h, COLORREF color);
void MixImage(const CImage *image, const CRect &rect, COLORREF trans=RGB(0, 255, 0));
void DrawRect(const CRect &rect, COLORREF color);
void DrawRect(int x, int y, int w, int h, COLORREF color);
void FillHalfToneRect(const CRect &rect);
void FillHalfToneRect(int x, int y, int w, int h);
void DrawFrameRect(const CRect &rect, COLORREF color=WhitePixel);
void DrawFrameRect(int x, int y, int w, int h, COLORREF color=WhitePixel);
} ;
// inline 成员函数
//
// 同名的函数与不同形式的引数以行内来定义
//
inline void CImage::Copy(const CImage *image)
{
Copy(image, CRect(0, 0, image->Width(), image->Height()));
}
inline void CImage::FillRect(int x, int y, int w, int h, COLORREF color)
{
FillRect(CRect(x, y, x + w, y + h), color);
}
inline void CImage::DrawRect(int x, int y, int w, int h, COLORREF color)
{
DrawRect(CRect(x, y, x + w, y + h), color);
}
inline void CImage::FillHalfToneRect(int x, int y, int w, int h)
{
FillHalfToneRect(CRect(x, y, x + w, y + h));
}
inline void CImage::DrawFrameRect(const CRect &rect, COLORREF color)
{
DrawFrameRect(rect.left, rect.top, rect.Width(), rect.Height(), color);
}
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?