OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
dibdc.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of TDibDC encapsulation class
7//----------------------------------------------------------------------------
8#include <owl/pch.h>
9#include <owl/dc.h>
10#include <owl/gdiobjec.h>
11
12namespace owl {
13
15DIAG_DECLARE_GROUP(OwlGDI); // General GDI diagnostic group
16
17//
18// Construct a DC that can be used with DI Bitmaps. Under Win32 bitmaps
19// selected must be DIBSections
20//
22:
23 TMemoryDC()
24{
25 CheckValid();
26}
27
28//
29/// Constructs a DC that can be used with DI Bitmaps, then auto select the given
30/// bitmap in. Under Win32 bitmaps selected must be DIBSections
31//
32TDibDC::TDibDC(const TBitmap& bitmap)
33:
34 TMemoryDC()
35{
36 CheckValid();
37 SelectObject(bitmap);
38}
39
40
41//
42// Get the color table of the currently selected bitmap.
43//
44uint
45TDibDC::GetDIBColorTable(uint start, uint count, RGBQUAD * colors)
46{
47 return ::GetDIBColorTable(GetHDC(), start, count, colors);
48}
49
50//
51// Set the color table of the currently selected bitmap.
52//
53uint
54TDibDC::SetDIBColorTable(uint start, uint count, const RGBQUAD * colors)
55{
56# if defined(__GNUC__)
57 return ::SetDIBColorTable(GetHDC(), start, count, (RGBQUAD*)colors);
58# else
59 return ::SetDIBColorTable(GetHDC(), start, count, colors);
60# endif //WINELIB
61}
62
63
64//
65// Dib Screen Update BitBlt's. A screen DC must be the destination.
66// BitBlts from this DIB onto the destination DC.
67//
68bool
69TDibDC::BitBltToScreen(TDC& dstDC, const TRect& dst, const TPoint& src) const
70{
71 return dstDC.BitBlt(dst, *this, src);
72}
73
74//
75// BitBlts from this DIB onto the destination DC.
76//
77bool
78TDibDC::BitBltToScreen(TDC& dstDC, int dstX, int dstY, int dstW, int dstH,
79 int srcX, int srcY) const
80{
81 return dstDC.BitBlt(dstX, dstY, dstW, dstH, *this, srcX, srcY);
82}
83
84//
85// Stretches the DIB onto the destination DC.
86//
87bool
88TDibDC::StretchBltToScreen(TDC& dstDC, const TRect& dst, const TRect& src) const
89{
90 return dstDC.StretchBlt(dst, *this, src);
91}
92
93//
94// Stretches the DIB onto the destination DC.
95//
96bool
97TDibDC::StretchBltToScreen(TDC& dstDC, int dstX, int dstY, int dstW, int dstH,
98 int srcX, int srcY, int srcW, int srcH) const
99{
100 return dstDC.StretchBlt(dstX, dstY, dstW, dstH, *this, srcX, srcY, srcW, srcH);
101}
102
103
104} // OWL namespace
105
TBitmap is the GDI bitmap class derived from TGdiObject.
Definition gdiobjec.h:510
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
void SelectObject(const TBrush &brush)
Selects the given GDI brush object into this DC.
Definition dc.cpp:113
void CheckValid(uint resId=IDS_GDIFAILURE)
Definition gdibase.cpp:49
bool BitBlt(int dstX, int dstY, int w, int h, const TDC &srcDC, int srcX, int srcY, uint32 rop=SRCCOPY)
Performs a bit-block transfer from srcDc (the given source DC) to this DC (the destination DC).
Definition dc.h:2421
bool StretchBlt(int dstX, int dstY, int dstW, int dstH, const TDC &srcDC, int srcX, int srcY, int srcW, int srcH, uint32 rop=SRCCOPY)
Copies a bitmap from the source DC to a destination rectangle on this DC specified either by upper le...
Definition dc.h:2502
HDC GetHDC() const
Return the handle of the device context.
Definition dc.h:981
uint SetDIBColorTable(uint start, uint entries, const RGBQUAD *colors)
Definition dibdc.cpp:54
uint GetDIBColorTable(uint start, uint entries, RGBQUAD *colors)
Definition dibdc.cpp:45
bool BitBltToScreen(TDC &dstDC, const TRect &dst, const TPoint &src) const
Definition dibdc.cpp:69
bool StretchBltToScreen(TDC &dstDC, const TRect &dst, const TRect &src) const
Definition dibdc.cpp:88
TMemoryDC()
Constructs a screen-compatible memory DC.
Definition memorydc.cpp:160
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
Definition of GDI DC encapsulation classes: TDC, TWindowDC, TScreenDC, TDesktopDC,...
Definition of abstract GDI object class and derived classes.
Object Windows Library (OWLNext Core).
Definition animctrl.h:22
OWL_DIAGINFO
Definition animctrl.cpp:14
unsigned int uint
Definition number.h:25
DIAG_DECLARE_GROUP(OwlThread)