日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Chapter 3.GDI/DirectDraw Internal Data Structures

發布時間:2024/7/19 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Chapter 3.GDI/DirectDraw Internal Data Structures 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

說明,在這里決定跳過第二章,實在是因為里面涉及的內容太理論,對我而言又太艱深

3.1 HANDLES AND OBJECT-ORIRNTED PROGRAMMING

In normal object-oriented programming practice,information hiding is achieved by declaring certain members as private or protected,so the client side code can't access them directly.But the compiler still needs to know perfectly well all members,their types,names,and orders in a class.At least,the compiler needs to know the exact size of an instance of an object for memory allocation.This can cause lots of problems for the modular development of programs,Every time a data member or member function is changed,the whole program needs to be recompiled.Programs complied with older versions of class definition would not work with newer version.To solve this problem,there is the abstract bass class.The abstract bass class,which uses virtual functions to define the interface the clien-side program can see while completely hiding away the implementation,improves information hiding and the modularity of programs even further...For hiding the implementation away from the client side of a class, normally a special function is provided to create an instance of a derived class,including memory allocation; another special function is provided to destroy an instance,including freeing its memory.

Objects in the Win32 API can be seen as being implemented using abstract base class with no data members. The data representation of an object is completely hidden from the user application...the perfect information hiding provided by the Win32 API greatly improves the portability of programs. GDI normally provides several functions to create an instance of an object and several functions to destroy them.

To illustrate our comparison between object-roiented programming and the Win32 API,let's try to provide some minimum pseudo-implementation of GDI using C++.

//gdi.h #include<windows.h> class _GdiObj { public:virtual int GetObjectType(void) = 0;virtual int GetObject(int cbBuffer, void * pBuffer) =0;virtual bool DeleteObject(void) = 0;virtual bool UnrealizeObject(void) = 0; };class _Pen:public _GdiObj { public:virtual int GetObjectType(void){return OBJ_PEN;}virtual int GetObject(int cbBuffer,void *pBuff)=0;virtual bool DeleteObject(void)=0;virtual bool UnrealizeObject(void){return true;} };_Pen * _CreatePen(int fnPenStyle, int nWidth, COLORREF crColor); //gdi.cpp#define STRICT #define WIN32_LEAN_AND_MEAN #include <windows.h> #include "gdi.h" class _RealPen : public _Pen {LOGPEN m_LogPen; public:_RealPen(int fnPenStyle, int nWidth, COLORREF crColor){m_LogPen.lopnStyle = fnPenStyle;m_LogPen.lopnWidth.x = nWidth;m_LogPen.lopnWidth.y = 0;m_LogPen.lopnColor = crColor;}int GetObject(int cbBuffer, void * pBuffer){if ( pBuffer==NULL )return sizeof(LOGPEN);else if ( cbBuffer>=sizeof(m_LogPen) ){memcpy(pBuffer, & m_LogPen, sizeof(m_LogPen));return sizeof(LOGPEN);}else{SetLastError(ERROR_INVALID_PARAMETER);return 0;}}bool DeleteObject(void){if ( this ){delete this;return true;}elsereturn false;} }; _Pen * _CreatePen(int fnPenStyle, int nWidth, COLORREF crColor) {return new _RealPen(fnPenStyle, nWidth, crColor); } //test.cpp #include "gdi.h"void Test(void) {_Pen * pPen = _CreatePen(PS_SOLID, 1, RGB(0, 0, 0xFF));////pPen->DeleteObject(); } int WINAPI WinMain(HINSTANCE hInsatcne,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd) {return 0; }

這個程序定義_GdiObj這樣一個抽象基類,緊接著派生出_Pen類,同為抽象基類,在_Pen類的子類_RealPen中才將純虛函數一一實現。另外從這個程序中也可以看出,創建畫筆對象調用的函數,其實是填充一個LOGPEN結構類型數據的幾個字段

轉載于:https://www.cnblogs.com/lanf/p/5094385.html

總結

以上是生活随笔為你收集整理的Chapter 3.GDI/DirectDraw Internal Data Structures的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 色婷婷a | 色眯眯网| 久久精品视频在线免费观看 | 最新福利在线 | 国产黄色视 | 鸥美毛片 | 中文字幕免费中文 | 亚洲国产精品久久久久久6q | 亚洲综合图片网 | 国产激情网站 | 国产欧美精品在线观看 | 久久精品国产一区二区电影 | 青青草在线观看视频 | 无套内谢88av免费看 | 无遮挡av | 91大神久久 | 实拍澡堂美女洗澡av | 黄色网址大全免费 | 国产精品无码AV | 中文字幕日韩国产 | 性高潮在线观看 | 激情五月婷婷久久 | 天堂在线官网 | 国产伦精品一区二区 | 久久亚洲国产成人精品性色 | 草逼导航 | 成人wwwww免费观看 | 国产wwwwww| 亚洲欧美日韩在线一区 | 人妻在卧室被老板疯狂进入 | 一级片视频免费看 | 久久精品一日日躁夜夜躁 | 亚洲AV无码精品一区二区三区 | 欧美爽爽 | 伊人激情影院 | 欧美精品网 | 最新视频–x99av | 天天草天天干 | 啪啪网站视频 | 免费成人美女女电影 | 美女干b视频 | 婷婷丁香激情 | 99热这里只有精品久久 | 亚洲免费网站在线观看 | 好看的中文字幕电影 | 午夜资源网 | 色婷婷六月天 | 女同性αv亚洲女同志 | 国产三级网站 | 亚洲欧美日韩综合一区二区 | 福利影院在线观看 | 日韩午夜视频在线观看 | 亚洲精品9999| 美女福利视频一区 | 高清中文字幕av | 欧美三级小说 | 免费在线小视频 | 天天射,天天干 | 日日摸夜夜添夜夜添高潮喷水 | wwwwxxxxx日本 | 国产精品久久久久久无人区 | 视色在线 | 国内少妇毛片视频 | 男人的天堂av网 | 五月激情天 | 日韩在线天堂 | 97人人模人人爽人人少妇 | 18做爰免费视频网站 | 91在线免费播放 | 亚洲尤物在线 | 极品尤物魔鬼身材啪啪仙踪林 | 疯狂做爰高潮videossex | 欧美日韩精品一区二区在线观看 | 精品一二区 | 欧美人与禽zozzo性之恋的特点 | 亚洲熟妇国产熟妇肥婆 | 美女扒开腿让人桶爽原神 | 亚洲天堂av在线播放 | 亚欧视频在线观看 | 亚洲欧美日韩一区二区三区在线观看 | 欧美日韩免费观看一区=区三区 | 搡老熟女老女人一区二区 | 久久久久久久久久久久久久久久久久 | 噜噜色av| 电影《走路上学》免费 | 日韩黄色一级 | 久久精品国产成人av | 精品国产aⅴ一区二区三区东京热 | 亚洲精品乱码久久久久久麻豆不卡 | 天天摸天天舔 | 日韩一级片 | 丰满白嫩尤物一区二区 | 国产精品一区二区av白丝下载 | 九九这里只有精品视频 | 亚洲免费精品视频在线观看 | 天干夜夜爽爽日日日日 | 中文字幕av久久爽一区 | 色香蕉影院 | 私人毛片|