亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? crgbsurface.h

?? 這是一個用于生成等值線的源代碼
?? H
字號:


#ifndef _CRGBSURFACE_H_
#define _CRGBSURFACE_H_

// Make integer i divideable by integer a
#define ALIGN(i, a) (((i) + ((a) - 1))/(a)*(a))

// Convert from COLORREF to DIB's BGRA
inline DWORD COLORREFtoBGRA(COLORREF cr, BYTE bAlpha = 255)
{
	return ((DWORD(bAlpha)) << 24) + RGB(GetBValue(cr), GetGValue(cr), GetRValue(cr));
}

inline DWORD ReverseRGB(COLORREF cr, BYTE bAlpha = 255)
{
	return COLORREFtoBGRA(cr, bAlpha);
}

#define RGBA(b,g,r,a)       ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))|(((DWORD)(BYTE)(a))<<24))

// 24 and 32 bit DIB's pixelformat
#define BGR(b,g,r)          ((COLORREF)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16)))
#define BGRA(b,g,r,a)       ((COLORREF)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16))|(((DWORD)(BYTE)(a))<<24))


/*! \brief A wraper to a 24 bit or 32 bit RGB DIB section GDI object.

\ingroup OGLToolsGroup
CRGBSurface is a wraper to a 24 bit or 32 bit RGB
DIB section GDI object.
After creating a RGB surface with one of its Create() methods,
use GetDC() to access a surface thrugh it's DC or
GetPixels() to directly access the surface RGB pixels.
Use Draw() for easy drawing of RGB DIB section
and CopyToClipboard() for copying or seting RGB DIB section
to clipboard.

Call DeleteDC() if you no longer need the surface's DC
(Draw() and Blt() functions don't need it).


 With CRGBSurface you can:
<ol>
<li> Create an empty 24 or 32 bit RGB DIB section.
<li> Convert a device dependent bitmap, passed as
     HBITMAP or CBitmap, to 24 or 32 RGB DIB section.
<li> Create a 24 or 32 RGB DIB section from
     a DIB or JPEG file on disk.
<li> Save a DIB section to disk in bitmap or JPEG format.
<li> Draw() and Blt() a DIB section to a DC.
</ol>

\sa CGLImage
\sa CWGL
\author (c) W.Weyna 'Voytec', http://shiptech.tuniv.szczecin.pl/~weyna/OpenGL/
*/
class OGLTOOLS_EXT_CLASS CRGBSurface
{
// Construction
public:
	CRGBSurface();
	virtual ~CRGBSurface();

// Attributes
public:
	/*! Attributes:*/
	//@{
	//! returns device context associated with DIB section object selected into it.
	CDC* GetDC() const {return m_pDC;}	      
	//! returns a handle to DIB section GDI object
	HBITMAP GetHandle() const {return m_hDIBSection;}  
	//! returns a pointer for a direct access to 24 or 32 bit RGB pixels of DIB section
	BYTE* GetPixels() const {GdiFlush(); return m_pDIBits; } 

	/*! \name  Image sizes in pixels*/
	//@{
	//! returns a CSize structure containing size of DIB
	CSize GetSize() const {return CSize(m_bih.biWidth, m_bih.biHeight); };
	//! width (in pixels) of DIB
	int GetWidth() const {return m_bih.biWidth; };
	//! height (in pixels) of DIB
	int GetHeight() const {return m_bih.biHeight; };
	//@}

	/*! \name  Image sizes in bytes*/
	//@{
	//! returns number of bytes per row of DIB
	DWORD GetRowSize_Bytes() const { return m_bih.biWidth * m_bih.biBitCount / 8; }
	//! returns number of aligned bytes per row of DIB
	DWORD GetAlignedRowSize_Bytes() const { return ALIGN(GetRowSize_Bytes(), 4); }
	//! returns size (in bytes) of DIB
	DWORD GetSize_Bytes() const { return GetAlignedRowSize_Bytes() * m_bih.biHeight; }

	//! Image size in bytes for m_bih.biBitCount = 24.
	DWORD GetSize24_Bytes() const { return ALIGN(m_bih.biWidth * 3, 4) * m_bih.biHeight; }
	//@}

	/*! \name  Image sizes in logical units*/
	//@{
	//! returns Size log
	CSize GetSizeLog(CDC* pDC) const {
		CSize imageSize(m_bih.biWidth, m_bih.biHeight);
		pDC->DPtoLP(&imageSize);
		return imageSize; }
	//@}

	//! Get bitmap info of DIB
	const BITMAPINFOHEADER* GetBIH() const {return &m_bih; }
	//! returns size in pixels
	int GetPixelSize_Bytes() {return m_bih.biBitCount / 8; }
	//! internal.
	bool CheckSaveError_FileExists(){ return m_bSaveFile_FileExists; }
	//@}

protected:
	HBITMAP m_hDIBSection;
	HBITMAP m_hDIBSectionOld;
	BYTE* m_pDIBits;	

	CDC* m_pDC;
	BITMAPINFOHEADER m_bih;

	bool m_bSaveFile_FileExists;

// Operations
public:    
	/*! @name Operations: */
	//@{
	bool Create(CRGBSurface* const pSourceSurface);
	bool Create(int cx, int cy, int nBitsPerPixel = 24);
	bool Create(BYTE* pDIB, int nBitsPerPixel = 24);
	bool Create(HANDLE hFile, int nBitsPerPixel = 24);
	bool Create(const char* szPath, int nBitsPerPixel = 24);
	bool Create(HBITMAP hBitmap, int nBitsPerPixel = 24, CDC* pBitmapDC = NULL);
	//! Create DIB using Create(HBITMAP,int,CDC*)
	bool Create(CBitmap* pBitmap, int nBitsPerPixel = 24, CDC* pBitmapDC = NULL) {return Create(HBITMAP(*pBitmap), nBitsPerPixel, pBitmapDC); }
	//! Create DIB using Create(HBITMAP,int,CDC*)
	bool Create(const CBitmap& bitmap, int nBitsPerPixel = 24, CDC* pBitmapDC = NULL) {return Create(HBITMAP(bitmap), nBitsPerPixel, pBitmapDC); }

	void Draw(CDC* pDestDC, int x, int y, int destWidth = -1, int destHeight  = -1) const; 
	void Draw(CDC* pDestDC, int srcx, int srcy, int srcWidth, int srcHeight,int destx, int desty, int destWidth =-1, int destHeight=-1)  const;
	void Blt(CDC* pDestDC) const;
	bool CopyTo(CRGBSurface* pDestSurface, DWORD dwDestX = 0, DWORD dwDestY = 0) const;
	bool CopyToClipboard(bool bNoCopy = false); 
	bool SaveToFile(const CString& strPath, bool bAllowOverwrite = false, int nQuality = -1); 
	
	BYTE* CreateDIB();
	HGLOBAL CreateDIB_Win16();

	void Delete();
	void DeleteDC();
	bool RecreateDC();
	
	BYTE* LoadDIB(const CString& strPath);
	BYTE* LoadDIBFromOpenedFile(HANDLE hFile);
	bool SaveDIBToOpenedFile(HANDLE hFile);
	bool SaveDIB(const CString& strPath, bool bAllowOverwrite = false);
	bool SaveAsJPEGFile(const CString& strPath, int nQuality = -1, bool bAllowOverwrite = false);
	bool CreateFromJPEGFile(const CString& strPath, int nBitsPerPixel = 24);
	bool CreateFromOpenedStdioJPEGFile(FILE* infile, int nBitsPerPixel = 24);
	bool CreateFromDIBFile(const CString& strPath, int nBitsPerPixel = 24);
	//@}


// Operations that directly manipulate the DIB bits
public:
	/*! @name Operations that directly manipulate the DIB bits: */
	//@{
	void Clear(DWORD dwBGRA = BGRA(255, 255, 255, 255));
	void ClearCR(DWORD dwRGBA = RGBA(255, 255, 255, 255));
	void Brightness(double dBrightness);
	//@}	
// Validity check
public:

#ifdef _DEBUG
	void AssertValid() const {
		ASSERT_VALID(m_pDC);
		ASSERT(m_hDIBSection);
		ASSERT(m_pDIBits);
		ASSERT(m_bih.biBitCount == 24 || m_bih.biBitCount == 32);
		ASSERT(m_bih.biWidth > 0);
		ASSERT(m_bih.biHeight > 0);
		ASSERT(GetObjectType(m_hDIBSection) == OBJ_BITMAP); }
#else
	void AssertValid() {};
#endif
	
// Helpers
private:
	BYTE* GetPointerToDIBits(BYTE* pDIB);

// Friends
	friend bool operator==(const CRGBSurface& l, const CRGBSurface& r);
	friend bool operator!=(const CRGBSurface& l, const CRGBSurface& r);

};

inline bool operator>(const CRGBSurface& l, const CRGBSurface& r)
{
	return l.GetWidth() > r.GetWidth() &&
		l.GetHeight() > r.GetHeight();
}

inline bool operator>=(const CRGBSurface& l, const CRGBSurface& r) 
{
	return l.GetWidth() >= r.GetWidth() &&
		l.GetHeight() >= r.GetHeight();
}

inline bool operator<(const CRGBSurface& l, const CRGBSurface& r) 
{
	return l.GetWidth() < r.GetWidth() &&
		l.GetHeight() < r.GetHeight();
}

inline bool operator<=(const CRGBSurface& l, const CRGBSurface& r)
{
	return l.GetWidth() <= r.GetWidth() &&
		l.GetHeight() <= r.GetHeight();
}

inline bool operator==(const CRGBSurface& l, const CRGBSurface& r) 
{
	return l.GetWidth() == r.GetWidth() &&
		l.GetHeight() == r.GetHeight() && 
		l.m_bih.biBitCount == r.m_bih.biBitCount;
}

inline bool operator!=(const CRGBSurface& l, const CRGBSurface& r) 
{
	return l.GetWidth() != r.GetWidth() ||
		l.GetHeight() != r.GetHeight() ||
		l.m_bih.biBitCount != r.m_bih.biBitCount;
}

#endif 


//////////////////////////////////////////////////////////////////////

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费一区二区三区在线观看| 久久久久国产免费免费| 成人污污视频在线观看| 激情综合网av| 狠狠色丁香婷婷综合| 蜜桃在线一区二区三区| 全国精品久久少妇| 麻豆精品精品国产自在97香蕉| 日韩av二区在线播放| 免费av网站大全久久| 老司机免费视频一区二区| 美日韩一级片在线观看| 美女国产一区二区三区| 国产一区欧美日韩| 成人做爰69片免费看网站| 99精品一区二区三区| 91久久久免费一区二区| 欧美精品日韩一区| 欧美电影免费提供在线观看| 久久综合九色综合97_久久久| 久久久另类综合| 一区二区在线观看视频| 亚洲chinese男男1069| 日本一道高清亚洲日美韩| 久久99精品一区二区三区| 国产很黄免费观看久久| 91在线视频播放| 国产目拍亚洲精品99久久精品| 国产欧美久久久精品影院| 亚洲视频每日更新| 美女视频黄久久| 成人免费福利片| 欧美久久一二区| 国产三级久久久| 性欧美疯狂xxxxbbbb| 国产制服丝袜一区| 欧美性欧美巨大黑白大战| 日韩女优视频免费观看| 中文字幕一区av| 日本91福利区| 色综合天天综合| 欧美成人video| 一区二区在线看| 国产精品自拍三区| 欧美日本一区二区三区四区| 欧美激情一区二区三区蜜桃视频| 亚洲影视资源网| 成人sese在线| 日韩精品一区二区三区三区免费 | 欧美日韩免费不卡视频一区二区三区| 日韩欧美成人午夜| 亚洲一区二区高清| 国产91丝袜在线观看| 欧美日韩高清一区二区三区| 国产精品电影一区二区| 国内精品自线一区二区三区视频| 欧美视频精品在线| 国产精品国产精品国产专区不片| 激情综合色播激情啊| 欧美日韩午夜在线| 夜夜精品视频一区二区| 成av人片一区二区| 国产午夜亚洲精品不卡| 伦理电影国产精品| 欧美日韩色综合| 亚洲国产另类av| 色综合久久99| 成人欧美一区二区三区小说| 国产精品亚洲专一区二区三区| 欧美精品vⅰdeose4hd| 亚洲午夜私人影院| 在线视频亚洲一区| 亚洲猫色日本管| 日本乱人伦一区| 一个色妞综合视频在线观看| 色伊人久久综合中文字幕| 国产精品久久久久影院| 成人高清免费观看| 国产精品国产三级国产aⅴ入口| 精品夜夜嗨av一区二区三区| 欧美精品一区二区三区视频 | 欧美精品一区二区三区高清aⅴ| 免费在线观看成人| 欧美一区二区黄色| 精品亚洲成a人| 欧美激情一区二区三区四区 | 亚洲午夜精品久久久久久久久| 日本韩国一区二区三区视频| 亚洲欧美国产三级| 欧美日韩国产美| 青青草国产成人99久久| 欧美va亚洲va| 北条麻妃国产九九精品视频| 亚洲精品中文在线影院| 欧美日韩成人在线一区| 久久99国内精品| 欧美韩国一区二区| 91国在线观看| 美女一区二区在线观看| 国产精品人成在线观看免费 | 午夜久久久久久久久| 制服丝袜亚洲网站| 国产不卡高清在线观看视频| 亚洲欧洲制服丝袜| 欧美一区二区三区影视| 国产精品影音先锋| 一区二区激情小说| 日韩欧美一区二区不卡| 不卡在线观看av| 丝袜亚洲另类欧美| 国产精品高清亚洲| 欧美精品一卡二卡| 成人激情av网| 青青草国产成人av片免费| 亚洲国产精品高清| 欧美一卡二卡三卡四卡| 成人精品国产福利| 日本亚洲天堂网| 亚洲欧美电影院| 国产亚洲欧美日韩在线一区| 欧美在线免费观看亚洲| 国产91清纯白嫩初高中在线观看 | 国产在线精品一区二区三区不卡 | 国模少妇一区二区三区| 亚洲资源在线观看| 国产欧美一区二区三区网站| 91精品国产乱码久久蜜臀| 91麻豆文化传媒在线观看| 老司机精品视频一区二区三区| 亚洲综合在线第一页| 国产精品久久久久影院色老大| 欧美成人一级视频| 欧美日韩国产精品成人| 91视频免费播放| 99久久综合99久久综合网站| 精品一区二区三区在线观看国产| 亚洲国产成人av网| 亚洲精品成a人| 亚洲手机成人高清视频| 欧美激情一二三区| 精品久久一区二区| 日韩视频免费观看高清完整版在线观看| 日日夜夜免费精品| 亚洲高清免费一级二级三级| 亚洲激情网站免费观看| 国产精品成人一区二区艾草 | 91麻豆精品国产无毒不卡在线观看| 成人午夜激情视频| 国产在线精品免费| 国产一区二区精品在线观看| 麻豆国产91在线播放| 日韩国产欧美三级| 日韩中文字幕亚洲一区二区va在线| 亚洲午夜久久久久久久久久久| 亚洲精品伦理在线| 一区二区三区中文字幕| 亚洲尤物在线视频观看| 亚洲国产综合在线| 日韩精品国产精品| 免费日韩伦理电影| 国内精品伊人久久久久av一坑 | 国产成人免费9x9x人网站视频| 久久91精品国产91久久小草| 久久超碰97人人做人人爱| 韩国av一区二区三区在线观看| 国产精品自产自拍| eeuss鲁一区二区三区| 91一区在线观看| 欧美日韩在线直播| 日韩一级成人av| 国产女主播一区| 亚洲精品视频在线观看网站| 亚洲综合免费观看高清完整版| 亚洲高清视频在线| 精品在线观看免费| 高清不卡在线观看| 欧美伊人久久久久久久久影院 | 欧美日韩国产一级二级| 欧美巨大另类极品videosbest| 欧美一区二区三区日韩视频| 2023国产精品| 亚洲天天做日日做天天谢日日欢| 亚洲小说欧美激情另类| 免费欧美高清视频| 大胆欧美人体老妇| 欧美视频一二三区| 久久蜜桃av一区二区天堂| 亚洲人成精品久久久久久| 日韩精品一级二级| 成人晚上爱看视频| 欧美日韩大陆一区二区| 国产欧美日本一区视频| 午夜精品福利一区二区三区蜜桃| 国内精品久久久久影院薰衣草| 972aa.com艺术欧美| 精品少妇一区二区三区免费观看 | 亚洲成av人片在www色猫咪| 欧美午夜精品电影| 国产性做久久久久久| 午夜影视日本亚洲欧洲精品|