TNB Library
TnbDxDraw.h
[詳解]
1#pragma once
13#include "TnbPointerHandle.h"
14
15
16
17#ifndef INITGUID
18 #define INITGUID
19#endif
20#include <ddraw.h> // SDK
21#pragma comment(lib,"ddraw.lib")
22#pragma comment(lib,"dxguid.lib")
23
24
25
26//TNB Library
27namespace TNB{
28namespace DX
29{
30
31
32
33#ifndef _TnbDOXYGEN //Document作成用シンボル
35struct TPhReleaseSurface
36{
37 void operator()(LPDIRECTDRAWSURFACE7 P) { P->Release(); }
38};
40#endif
41
42
43
56{
57public:
58
63 struct TBuffer
64 {
65 SIZE size;
66 int pitch;
69 union
70 {
71 BYTE* pB8;
72 WORD* pB16;
73 RGBTRIPLE* pB24;
74 RGBQUAD* pB32;
75 };
82 int Pos(int x, int y) const
83 {
84 return x + y * pitch;
85 }
86 };
87
101 {
102 public:
103
106 {
107 m_ReleaseRent();
108 }
109
111 CSurface(void) : m_isRentBuffer(false), m_hDC(NULL)
112 {
113 m_CheckSpec();
114 }
115
121 CSurface(LPDIRECTDRAWSURFACE7 pSurface) : m_hpSurface(pSurface)
122 {
123 m_CheckSpec();
124 }
125
132 {
133 operator=(other);
134 }
135
143 {
144 other.m_ReleaseRent();
145 m_hpSurface = other.m_hpSurface;
146 m_primarySize = other.m_primarySize;
147 m_bitsPixel = other.m_bitsPixel;
148 m_isRentBuffer = false;
149 m_hDC = NULL;
150 return *this;
151 }
152
159 void Attach(LPDIRECTDRAWSURFACE7 pSurface)
160 {
161 m_ReleaseRent();
162 m_hpSurface = pSurface;
163 m_CheckSpec();
164 }
165
174 HRESULT Create(IDirectDraw7* pDraw, LPDDSURFACEDESC2 pDdsd)
175 {
176 Destroy();
177 LPDIRECTDRAWSURFACE7 P;
178 HRESULT r = pDraw->CreateSurface(pDdsd, &P, NULL);
179 if ( r == DD_OK )
180 {
181 m_hpSurface = P;
182 m_CheckSpec();
183 }
184 return r;
185 }
186
192 void Destroy(void)
193 {
194 m_ReleaseRent();
195 m_hpSurface = NULL;
196 }
197
203 bool IsValid(void) const
204 {
205 return ! m_hpSurface.IsNull();
206 }
207
213 const SIZE& GetSize(void) const
214 {
215 return m_primarySize;
216 }
217
223 operator LPDIRECTDRAWSURFACE7(void)
224 {
225 DEBUG_ONLY( m_ReleaseRent() );
226 return m_hpSurface;
227 }
228
234 LPDIRECTDRAWSURFACE7 operator->(void)
235 {
236 DEBUG_ONLY( m_ReleaseRent() );
237 return m_hpSurface;
238 }
239
250 HRESULT BltFast(int x, int y, LPDIRECTDRAWSURFACE7 lpDdsSrc, const RECT& srcRect, DWORD dwTrans = 0)
251 {
252 CRect rc = srcRect;
253 HRESULT hr = m_hpSurface->BltFast(x, y, lpDdsSrc, &rc, DDBLTFAST_WAIT | dwTrans);
254 if ( hr == DDERR_SURFACELOST )
255 {
256 m_hpSurface->Restore();
257 hr = m_hpSurface->BltFast(x, y, lpDdsSrc, &rc, DDBLTFAST_WAIT | dwTrans);
258 }
259 return hr;
260 }
261
273 HRESULT BltFastClip(int x, int y, LPDIRECTDRAWSURFACE7 lpDdsSrc, const RECT& srcRect, DWORD dwTrans = 0)
274 {
275 RECT rc = srcRect;
276 int width = rc.right - rc.left;
277 int height = rc.bottom - rc.top;
278 // 指定範囲を超えた画像を切り取る
279 if ( x < 0 )
280 {
281 rc.left += (-x);
282 x = 0;
283 }
284 else if ( m_primarySize.cx < x + width )
285 {
286 rc.right -= (x + width - m_primarySize.cx);
287 }
288 if ( y < 0)
289 {
290 rc.top += (-y);
291 y = 0;
292 }
293 else if ( m_primarySize.cy < y + height)
294 {
295 rc.bottom -= (y + height - m_primarySize.cy);
296 }
297 //描画
298 return BltFast(x, y, lpDdsSrc, rc, dwTrans);
299 }
300
310 HRESULT Blt(const RECT& dstRect, LPDIRECTDRAWSURFACE7 lpDdsSrc, const RECT& srcRect, DWORD dwTrans = 0)
311 {
312 CRect rc1 = dstRect;
313 CRect rc2 = srcRect;
314 HRESULT hr = m_hpSurface->Blt(&rc1, lpDdsSrc, &rc2, DDBLT_WAIT | dwTrans, NULL);
315 if ( hr == DDERR_SURFACELOST )
316 {
317 m_hpSurface->Restore();
318 hr = m_hpSurface->Blt(&rc1, lpDdsSrc, &rc2, DDBLT_WAIT | dwTrans, NULL);
319 }
320 return hr;
321 }
322
333 HRESULT BltClip(const RECT& dstRect, LPDIRECTDRAWSURFACE7 lpDdsSrc, const RECT& srcRect, DWORD dwTrans = 0)
334 {
335 RECT dstRc = dstRect;
336 RECT srcRc = srcRect;
337 SIZE dstSz = { dstRc.right - dstRc.left, dstRc.bottom - dstRc.top };
338 SIZE srcSz = { srcRc.right - srcRc.left, srcRc.bottom - srcRc.top };
339 const LONG par = 1024;
340 LONG parHeight = dstSz.cx * par / srcSz.cx;
341 LONG parWidth = dstSz.cy * par / srcSz.cy;
342 // 指定範囲を超えた画像を切り取る
343 int w1 = dstRc.right - m_clipRect.right;
344 if ( w1 > 0 )
345 {
346 srcRc.right -= w1 * par / parWidth;
347 dstRc.right -= w1;
348 }
349 int w2 = dstRc.left - m_clipRect.left;
350 if ( w2 < 0)
351 {
352 srcRc.left -= w2 * par / parWidth;
353 dstRc.left -= w2;
354 }
355 int h1 = dstRc.bottom - m_clipRect.bottom;
356 if ( h1 > 0 )
357 {
358 srcRc.bottom -= h1 * par / parHeight;
359 dstRc.bottom -= h1;
360 }
361 int h2 = dstRc.top - m_clipRect.top;
362 if ( h2 < 0)
363 {
364 srcRc.top -= h2 * par / parHeight;
365 dstRc.top -= h2;
366 }
367 //
368 return Blt(dstRc, lpDdsSrc, srcRc, dwTrans);
369 }
370
379 HDC GetDC(void)
380 {
381 if ( IsValid() && m_hDC == NULL )
382 {
384 if ( m_hpSurface->GetDC(&m_hDC) == DD_OK )
385 {
386 return m_hDC;
387 }
388 }
389 return NULL;
390 }
391
396 void ReleaseDC(void)
397 {
398 if ( IsValid() && m_hDC != NULL )
399 {
400 m_hpSurface->ReleaseDC(m_hDC);
401 m_hDC = NULL;
402 }
403 }
404
413 const TBuffer* GetBuffer(void)
414 {
415 if ( IsValid() && ! m_isRentBuffer )
416 {
417 ReleaseDC();
418 DDSURFACEDESC2 ddsd = { sizeof(DDSURFACEDESC2) };
419 if ( m_hpSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL) == DD_OK )
420 {
421 m_buffer.size = m_primarySize;
422 m_buffer.pitch = ddsd.lPitch / m_bitsPixel * 8;
423 m_buffer.bitsPixel = m_bitsPixel;
424 m_buffer.pB8 = static_cast<BYTE*>(ddsd.lpSurface);
425 m_isRentBuffer = true;
426 return &m_buffer;
427 }
428 }
429 return NULL;
430 }
431
436 void ReleaseBuffer(void)
437 {
438 if ( IsValid() && m_isRentBuffer )
439 {
440 m_hpSurface->Unlock(NULL);
441 m_isRentBuffer = false;
442 }
443 }
444
451 void SetClipRect(const RECT& rect)
452 {
453 m_clipRect = rect;
454 }
455
456 private:
457
459 void m_CheckSpec(void)
460 {
461 if ( IsValid() )
462 {
463 DDSURFACEDESC2 ddsd = { sizeof(DDSURFACEDESC2) };
464 DDPIXELFORMAT ddpf = { sizeof(DDPIXELFORMAT) };
465 if ( m_hpSurface->GetSurfaceDesc(&ddsd) == DD_OK && m_hpSurface->GetPixelFormat(&ddpf) == DD_OK )
466 {
467 DWORD f = DDSD_WIDTH | DDSD_HEIGHT;
468 if ( (ddsd.dwFlags & f) == f )
469 {
470 m_primarySize.cx = ddsd.dwWidth;
471 m_primarySize.cy = ddsd.dwHeight;
472 ::SetRect(&m_clipRect, 0, 0, m_primarySize.cx, m_primarySize.cy);
473 m_bitsPixel = ddpf.dwRGBBitCount;
474 return;
475 }
476 }
477 }
478 m_primarySize.cx = 0;
479 m_primarySize.cy = 0;
480 ::SetRectEmpty(&m_clipRect);
481 m_bitsPixel = 0;
482 }
484 void m_ReleaseRent(void)
485 {
486 ReleaseDC();
488 }
489 //
490 CSurfaceHandle m_hpSurface;
491 SIZE m_primarySize;
492 int m_bitsPixel;
493 //
494 RECT m_clipRect;
495 //
496 bool m_isRentBuffer;
497 HDC m_hDC;
498 TBuffer m_buffer;
499 };
500
501
502 //------------------------
503
504
506 CDirectDraw(void) : m_pDraw(NULL), m_isFull(false), m_pClip(NULL), m_hDC(NULL), m_pGetBuffSurface(NULL)
507 {
508 m_primarySize.cx = 0;
509 m_primarySize.cy = 0;
510 m_backSize.cx = 0;
511 m_backSize.cy = 0;
512 m_offset.x = 0;
513 m_offset.y = 0;
514 m_magnific.x = 1;
515 m_magnific.y = 1;
516 }
517
520 {
521 Destroy();
522 }
523
533 bool SetFullScreenMode(bool isFull)
534 {
535 if ( m_isFull != isFull )
536 {
537 if ( m_pDraw != NULL )
538 {
539 m_DestroySurface();
540 m_isFull = isFull;
541 return m_CreateSurface();
542 }
543 m_isFull = isFull;
544 }
545 return true;
546 }
547
556 bool SetSize(const SIZE& size)
557 {
558 return SetSize(size, size);
559 }
560
570 bool SetSize(const SIZE& primarySize, const SIZE& backSize)
571 {
572 m_primarySize = primarySize;
573 m_backSize = backSize;
574 if ( m_pDraw != NULL )
575 {
576 m_DestroySurface();
577 return m_CreateSurface();
578 }
579 return true;
580 }
581
591 bool Create(HWND hWnd, int bitsPixel = -1)
592 {
593 Destroy();
594 m_hWnd = hWnd;
595 if ( bitsPixel < 0 )
596 {
597 DEVMODE dm = { sizeof(DEVMODE) };
598 if ( ! ::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm) )
599 {
600 return false;
601 }
602 bitsPixel = dm.dmBitsPerPel;
603 }
604 m_bitsPixel = bitsPixel;
605 C_ASSERT( DD_OK == 0 );
606 if ( ::DirectDrawCreateEx(NULL, reinterpret_cast<void**>(&m_pDraw), IID_IDirectDraw7, NULL) != DD_OK )
607 {
608 return false;
609 }
610 if ( ! m_CreateSurface() )
611 {
612 Destroy();
613 return false;
614 }
615 return true;
616 }
617
623 void Destroy(void)
624 {
625 if ( m_backbufferSurface.IsValid() && m_hDC != NULL )
626 {
627 m_backbufferSurface->ReleaseDC(m_hDC);
628 m_hDC = NULL;
629 }
630 m_DestroySurface();
631 m_Release(m_pDraw);
632 }
633
638 const SIZE& GetPrimarySize(void) const
639 {
640 return m_primarySize;
641 }
642
647 const SIZE& GetBackbufferSize(void) const
648 {
649 return m_backSize;
650 }
651
658 int GetBitsPixel(void) const
659 {
660 if ( m_pDraw != NULL )
661 {
662 DDSURFACEDESC2 ddsd = { sizeof(DDSURFACEDESC2) };
663 if ( m_pDraw->GetDisplayMode(&ddsd) == DD_OK )
664 {
665 return (ddsd.lPitch / ddsd.dwWidth) * 8;
666 }
667 }
668 else
669 {
670 DEVMODE dm = { sizeof(DEVMODE) };
671 if ( ::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm) )
672 {
673 return dm.dmBitsPerPel;
674 }
675 }
676 return -1;
677 }
678
688 void SetOffset(int x, int y, int magnificX, int magnificY)
689 {
690 m_offset.x = x;
691 m_offset.y = y;
692 m_magnific.x = magnificX;
693 if ( m_magnific.x < 1 )
694 {
695 m_magnific.x = 1;
696 }
697 m_magnific.y = magnificY;
698 if ( m_magnific.y < 1 )
699 {
700 m_magnific.y = 1;
701 }
702 Redraw();
703 }
704
713 void SetOffset(int x = 0, int y = 0, int magnific = 1)
714 {
715 m_offset.x = x;
716 m_offset.y = y;
717 if ( magnific < 1 )
718 {
719 magnific = 1;
720 }
721 m_magnific.x = magnific;
722 m_magnific.y = magnific;
723 Redraw();
724 }
725
734 bool Redraw(void)
735 {
736 if ( m_primarySurface.IsValid() && ! m_isFull )
737 {
738 POINT po = { 0, 0 };
739 ::ClientToScreen(m_hWnd, &po);
740 RECT r2 = { 0, 0, m_primarySize.cx, m_primarySize.cy };
741 RECT r1 = r2;
742 ::OffsetRect(&r1, po.x, po.y);
743 r2.right /= m_magnific.x;
744 r2.bottom /= m_magnific.y;
745 ::OffsetRect(&r2, m_offset.x, m_offset.y);
746 m_pDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); //同期待ち
747// return m_primarySurface->Blt(&r1, m_benchSurface, &r2, DDBLT_WAIT, NULL) == DD_OK; //こっちのほうが早いが画面外にいくと、おかしなところに表示されてしまう
748 return m_primarySurface.BltClip(r1, m_benchSurface, r2) == DD_OK;
749 }
750 return false;
751 }
752
761 bool Flip(void)
762 {
763 bool r = false;
764 if ( m_primarySurface.IsValid() )
765 {
766 if ( m_isFull )
767 {
768 //== フルモード
769 r = m_primarySurface->Flip(0, DDFLIP_WAIT) == DD_OK;
770 }
771 else
772 {
773 //== ウィンモード
774 r = m_benchSurface->BltFast(0, 0, m_backbufferSurface, NULL, DDBLTFAST_WAIT) == DD_OK;
775 if ( r )
776 {
777 r = Redraw();
778 }
779 }
780 }
781 return r;
782 }
783
789 {
790 if ( m_pDraw != NULL )
791 {
792 m_pDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); //同期待ち
793 }
794 }
795
803 {
804 if ( m_primarySurface.IsValid() )
805 {
806 return m_backbufferSurface->BltFast(0, 0, m_baseSurface, NULL, DDBLTFAST_WAIT) == DD_OK;
807 }
808 return false;
809 }
810
816 {
817 return m_backbufferSurface;
818 }
819
820 CSurface CreateWorkSurfase(int height, int width)
821 {
822 CSurface surf;
823 DDSURFACEDESC2 ddsd = { sizeof(DDSURFACEDESC2) };
824 ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT ;
825 ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
826 ddsd.dwWidth = (height > 0) ? height : m_backSize.cx;
827 ddsd.dwHeight = (width > 0) ? width : m_backSize.cy;
828 surf.Create(m_pDraw, &ddsd);
829 return surf;
830 }
831
832private:
833
835 void m_DestroySurface(void)
836 {
837 m_Release(m_baseSurface);
838 m_Release(m_backbufferSurface);
839 m_Release(m_benchSurface);
840 m_Release(m_primarySurface);
841 m_Release(m_pClip);
842 }
843
844 // サーフェス作成
845 bool m_CreateSurface(void)
846 {
847 m_DestroySurface();
848 ASSERT( m_pDraw != NULL );
849 DDSURFACEDESC2 ddsd = { sizeof(DDSURFACEDESC2) };
850 HRESULT res = DD_OK;
851 if ( m_isFull )
852 {
853 //== フル
854 //協調レベル設定
855 res |= m_pDraw->SetCooperativeLevel(m_hWnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE);
856 //画面設定
857 res |= m_pDraw->SetDisplayMode(m_primarySize.cx, m_primarySize.cy, m_bitsPixel, 0, 0);
858 //プライマリサーフェイス作成
859 ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
860 ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
861 ddsd.dwBackBufferCount = 1;
862 res |= m_primarySurface.Create(m_pDraw, &ddsd);
863 if ( res == DD_OK )
864 {
865 //バックバッファサーフェス作成
866 DDSCAPS2 ddscaps = { 0 };
867 ddscaps.dwCaps=DDSCAPS_BACKBUFFER;
868 LPDIRECTDRAWSURFACE7 pSur = NULL;
869 res |= m_primarySurface->GetAttachedSurface(&ddscaps, &pSur);
870 m_backbufferSurface.Attach(pSur);
871 }
872 ddsd.dwWidth = m_primarySize.cx;
873 ddsd.dwHeight = m_primarySize.cy;
874 }
875 else
876 {
877 //== ウィン
878 //協調レベル設定
879 m_pDraw->SetCooperativeLevel(m_hWnd, DDSCL_NORMAL);
880 //画面設定
881 DEVMODE dm = { sizeof(DEVMODE) };
882 if ( ::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm) )
883 {
884 dm.dmBitsPerPel = m_bitsPixel;
885 dm.dmFields = DM_BITSPERPEL;
886 if ( ::ChangeDisplaySettings(&dm, CDS_FULLSCREEN/*一時的の意味で使う*/) != DISP_CHANGE_SUCCESSFUL )
887 {
888 res = DD_FALSE;
889 }
890 }
891 else
892 {
893 res = DD_FALSE;
894 }
895 //クリッパー作成
896 res |= m_pDraw->CreateClipper(0, &m_pClip, NULL);
897 if ( res == DD_OK )
898 {
899 res |= m_pClip->SetHWnd(0, m_hWnd);
900 //プライマリサーフェスの作成
901 ddsd.dwFlags = DDSD_CAPS;
902 ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
903 res |= m_primarySurface.Create(m_pDraw, &ddsd);
904 }
905 if ( res == DD_OK )
906 {
907 res |= m_primarySurface->SetClipper(m_pClip);
908 //クリッピング枠更新
909 RECT nowClipRect;
910 ::GetClipCursor(&nowClipRect);
911 ::ClipCursor(NULL);
912 RECT allClipRect;
913 ::GetClipCursor(&allClipRect);
914 ::ClipCursor(&nowClipRect);
915 m_primarySurface.SetClipRect(allClipRect);
916 //バックサーフェスの作成
917 ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
918 ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
919 ddsd.dwWidth = m_backSize.cx;
920 ddsd.dwHeight = m_backSize.cy;
921 res |= m_backbufferSurface.Create(m_pDraw, &ddsd);
922 //ベンチサーフェスの作成
923 res |= m_benchSurface.Create(m_pDraw, &ddsd);
924 }
925 }
926 //
927 if ( res == DD_OK )
928 {
929 //ベースサーフェス
930 ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
931 ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
932 res |= m_baseSurface.Create(m_pDraw, &ddsd);
933 }
934 //
935 if ( res != DD_OK )
936 {
937 m_DestroySurface();
938 return false;
939 }
940 return true;
941 }
942
944 template<typename TYP>
945 void m_Release(TYP*& P)
946 {
947 if ( P != NULL )
948 {
949 P->Release();
950 P = NULL;
951 }
952 }
953
955 void m_Release(CSurface& P)
956 {
957 P.Destroy();
958 }
959
960 HWND m_hWnd;
961 SIZE m_primarySize;
962 SIZE m_backSize;
963 int m_bitsPixel;
964 bool m_isFull;
965 POINT m_offset;
966 POINT m_magnific;
967 LPDIRECTDRAW7 m_pDraw;
968 CSurface m_primarySurface;
969 CSurface m_backbufferSurface;
970 CSurface m_benchSurface;
973 CSurface m_baseSurface;
976 LPDIRECTDRAWCLIPPER m_pClip;
977 //
978 HDC m_hDC;
979 TBuffer m_buffer;
980 LPDIRECTDRAWSURFACE7 m_pGetBuffSurface;
981};
982
983
984
985};//DX
986};//TNB
987
988
997/*
998 画面として、今、こんな感じ。
999
1000 表示している、「プライマリサーフェス」
1001 編集用の、「バックバッファサーフェス」
1002 ウィンドウモード専用に、表示内容の控え、「ベンチサーフェス」
1003
1004
1005 バックバッファをクリアするための、「ベースサーフェス」
1006
1007 矩形パターンをおいておく、「パターンサーフェス」 数枚?
1008
1009 背景パターンを並べる、「バックグラウンドサーフェス」 数枚?
1010 スクロールに対応?!
1011
1012
1013
1014
1015
1016
1017 ウィンドウモードの場合、オフセット表示が可能。
1018
1019
1020
1021*/
ポインタハンドル関係のヘッダ
[ETC] コピー不可能スーパークラス.
Definition: TnbDef.h:599
ポインタハンドルテンプレートベースクラス
DirectDraw サーフェス管理.
Definition: TnbDxDraw.h:101
HRESULT BltClip(const RECT &dstRect, LPDIRECTDRAWSURFACE7 lpDdsSrc, const RECT &srcRect, DWORD dwTrans=0)
[描画] クリッピング Blt.
Definition: TnbDxDraw.h:333
void Attach(LPDIRECTDRAWSURFACE7 pSurface)
[登録] アタッチ.
Definition: TnbDxDraw.h:159
~CSurface()
デストラクタ
Definition: TnbDxDraw.h:105
HRESULT BltFast(int x, int y, LPDIRECTDRAWSURFACE7 lpDdsSrc, const RECT &srcRect, DWORD dwTrans=0)
[描画] BltFast.
Definition: TnbDxDraw.h:250
CSurface & operator=(CSurface &other)
コピーオペレータ.
Definition: TnbDxDraw.h:142
void ReleaseBuffer(void)
[取得] バッファ返却.
Definition: TnbDxDraw.h:436
HRESULT Create(IDirectDraw7 *pDraw, LPDDSURFACEDESC2 pDdsd)
[作成] 作成.
Definition: TnbDxDraw.h:174
void ReleaseDC(void)
[取得] HDC 返却.
Definition: TnbDxDraw.h:396
HRESULT BltFastClip(int x, int y, LPDIRECTDRAWSURFACE7 lpDdsSrc, const RECT &srcRect, DWORD dwTrans=0)
[描画] クリッピング BltFast.
Definition: TnbDxDraw.h:273
CSurface(void)
コンストラクタ.
Definition: TnbDxDraw.h:111
bool IsValid(void) const
[確認] 有効確認.
Definition: TnbDxDraw.h:203
LPDIRECTDRAWSURFACE7 operator->(void)
[参照] 参照.
Definition: TnbDxDraw.h:234
HDC GetDC(void)
[取得] HDC 取得.
Definition: TnbDxDraw.h:379
void Destroy(void)
[破棄] 破棄.
Definition: TnbDxDraw.h:192
const SIZE & GetSize(void) const
[取得] サイズ取得.
Definition: TnbDxDraw.h:213
HRESULT Blt(const RECT &dstRect, LPDIRECTDRAWSURFACE7 lpDdsSrc, const RECT &srcRect, DWORD dwTrans=0)
[描画] Blt.
Definition: TnbDxDraw.h:310
CSurface(CSurface &other)
コピーコンストラクタ.
Definition: TnbDxDraw.h:131
const TBuffer * GetBuffer(void)
[取得] バッファ取得.
Definition: TnbDxDraw.h:413
CSurface(LPDIRECTDRAWSURFACE7 pSurface)
コンストラクタ.
Definition: TnbDxDraw.h:121
void SetClipRect(const RECT &rect)
[設定] クリッピング範囲設定.
Definition: TnbDxDraw.h:451
DirectDraw 管理.
Definition: TnbDxDraw.h:56
const SIZE & GetBackbufferSize(void) const
[取得] バックバッファサーフェスのサイズ取得.
Definition: TnbDxDraw.h:647
bool SetFullScreenMode(bool isFull)
[設定] フルスクリーンモード設定.
Definition: TnbDxDraw.h:533
bool Flip(void)
[処理] フィリップ.
Definition: TnbDxDraw.h:761
bool ClearBackbufferSurface(void)
[描画] バックバッファクリア
Definition: TnbDxDraw.h:802
bool Redraw(void)
[表示] 再表示.
Definition: TnbDxDraw.h:734
bool SetSize(const SIZE &size)
[設定] サイズ設定.
Definition: TnbDxDraw.h:556
void SetOffset(int x, int y, int magnificX, int magnificY)
[設定] オフセット設定.
Definition: TnbDxDraw.h:688
bool SetSize(const SIZE &primarySize, const SIZE &backSize)
[設定] サイズ設定.
Definition: TnbDxDraw.h:570
void Destroy(void)
[破棄] 破棄.
Definition: TnbDxDraw.h:623
CSurface & GetBackbufferSurface(void)
[取得] バックバッファ取得.
Definition: TnbDxDraw.h:815
CDirectDraw(void)
コンストラクタ
Definition: TnbDxDraw.h:506
void SetOffset(int x=0, int y=0, int magnific=1)
[設定] オフセット設定.
Definition: TnbDxDraw.h:713
const SIZE & GetPrimarySize(void) const
[取得] プライマリサーフェスのサイズ取得.
Definition: TnbDxDraw.h:638
void WaitForVerticalBlank(void)
[処理] 垂直同期待ち.
Definition: TnbDxDraw.h:788
~CDirectDraw(void)
デストラクタ
Definition: TnbDxDraw.h:519
int GetBitsPixel(void) const
[取得] ピクセル BIT 数取得.
Definition: TnbDxDraw.h:658
bool Create(HWND hWnd, int bitsPixel=-1)
[作成] 作成.
Definition: TnbDxDraw.h:591
TNB Library
Definition: TnbDoxyTitle.txt:2
バッファ管理型.
Definition: TnbDxDraw.h:64
int pitch
次の行の先頭までの距離
Definition: TnbDxDraw.h:66
BYTE * pB8
bitsPixel が8の時
Definition: TnbDxDraw.h:71
RGBTRIPLE * pB24
bitsPixel が24の時
Definition: TnbDxDraw.h:73
SIZE size
バッファサイズ
Definition: TnbDxDraw.h:65
int Pos(int x, int y) const
[取得] ポジション計算.
Definition: TnbDxDraw.h:82
RGBQUAD * pB32
bitsPixel が32の時
Definition: TnbDxDraw.h:74
int bitsPixel
一ピクセルの bit数。 8, 16, 32。
Definition: TnbDxDraw.h:67
WORD * pB16
bitsPixel が16の時
Definition: TnbDxDraw.h:72