티스토리 뷰
CDC
The CDC class defines a class of device-context objects. The CDC object provides member functions for working with a device context, such as a display or printer, as well as members for working with a display context associated with the client area of a window.
Do all drawing through the member functions of a CDC object. The class provides member functions for device-context operations, working with drawing tools, type-safe graphics device interface (GDI) object selection, and working with colors and palettes. It also provides member functions for getting and setting drawing attributes, mapping, working with the viewport, working with the window extent, converting coordinates, working with regions, clipping, drawing lines, and drawing simple shapes, ellipses, and polygons. Member functions are also provided for drawing text, working with fonts, using printer escapes, scrolling, and playing metafiles.
To use a CDC object, construct it, and then call its member functions that parallel Windows functions that use device contexts.
Note Under Windows 95, all screen coordinates are limited to 16 bits. Therefore, an int passed to a CDC member function must lie in the range –32768 to 32767.
For specific uses, the Microsoft Foundation Class Library provides several classes derived from CDC . CPaintDC encapsulates calls to BeginPaint and EndPaint. CClientDC manages a display context associated with a window’s client area. CWindowDC manages a display context associated with an entire window, including its frame and controls. CMetaFileDC associates a device context with a metafile.
CDC contains two device contexts, m_hDC and m_hAttribDC, which, on creation of a CDC object, refer to the same device. CDC directs all output GDI calls to m_hDC and most attribute GDI calls to m_hAttribDC. (An example of an attribute call is GetTextColor, while SetTextColor is an output call.)
For example, the framework uses these two device contexts to implement a CMetaFileDC object that will send output to a metafile while reading attributes from a physical device. Print preview is implemented in the framework in a similar fashion. You can also use the two device contexts in a similar way in your application-specific code.
There are times when you may need text-metric information from both the m_hDC and m_hAttribDC device contexts. The following pairs of functions provide this capability:
Uses m_hAttribDC | Uses m_hDC |
GetTextExtent | GetOutputTextExtent |
GetTabbedTextExtent | GetOutputTabbedTextExtent |
GetTextMetrics | GetOutputTextMetrics |
GetCharWidth | GetOutputCharWidth |
For more information on CDC, see Device Contexts in Visual C++ Programmer's Guide.
#include <afxwin.h>
Class Members | Base Class | Hierarchy Chart
See Also CPaintDC, CWindowDC, CClientDC, CMetaFileDC
CDC Class Members
Data Members
Construction/Destruction
Initialization
Device-Context
Functions
Drawing-Tool
Functions
Type-Safe
Selection. Helpers
Color and Color Palette
Functions
Drawing-Attribute
Functions
Mapping
Functions
Coordinate
Functions
Region Functions
Clipping Functions
Line-Output Functions
Simple Drawing Functions
Ellipse and Polygon
Functions
Bitmap Functions
Text Functions
Font Functions
Printer Escape Functions
Scrolling Functions
Metafile Functions
Path Functions
m_hDC | The output-device context used by this CDC object. |
m_hAttribDC | The attribute-device context used by this CDC object. |
CDC | Constructs a CDC object. |
CreateDC | Creates a device context for a specific device. |
CreateIC | Creates an information context for a specific device. This provides a fast way to get information about the device without creating a device context. |
CreateCompatibleDC | Creates a memory-device context that is compatible with another device context. You can use it to prepare images in memory. |
DeleteDC | Deletes the Windows device context associated with this CDC object. |
FromHandle | Returns a pointer to a CDC object when given a handle to a device context. If a CDC object is not attached to the handle, a temporary CDC object is created and attached. |
DeleteTempMap | Called by the CWinApp idle-time handler to delete any temporary CDC object created by FromHandle. Also detaches the device context. |
Attach | Attaches a Windows device context to this CDC object. |
Detach | Detaches the Windows device context from this CDC object. |
SetAttribDC | Sets m_hAttribDC, the attribute device context. |
SetOutputDC | Sets m_hDC, the output device context. |
ReleaseAttribDC | Releases m_hAttribDC, the attribute device context. |
ReleaseOutputDC | Releases m_hDC, the output device context. |
GetCurrentBitmap | Returns a pointer to the currently selected CBitmap object. |
GetCurrentBrush | Returns a pointer to the currently selected CBrush object. |
GetCurrentFont | Returns a pointer to the currently selected CFont object. |
GetCurrentPalette | Returns a pointer to the currently selected CPalette object. |
GetCurrentPen | Returns a pointer to the currently selected CPen object. |
GetWindow | Returns the window associated with the display device context. |
GetSafeHdc | Returns m_hDC, the output device context. |
SaveDC | Saves the current state of the device context. |
RestoreDC | Restores the device context to a previous state saved with SaveDC. |
ResetDC | Updates the m_hAttribDC device context. |
GetDeviceCaps | Retrieves a specified kind of device-specific information about a given display device’s capabilities. |
IsPrinting | Determines whether the device context is being used for printing. |
GetBrushOrg | Retrieves the origin of the current brush. |
SetBrushOrg | Specifies the origin for the next brush selected into a device context. |
EnumObjects | Enumerates the pens and brushes available in a device context. |
SelectObject | Selects a GDI drawing object such as a pen. |
SelectStockObject | Selects one of the predefined stock pens, brushes, or fonts provided by Windows. |
Color and Color Palette Functions
GetNearestColor | Retrieves the closest logical color to a specified logical color that the given device can represent. |
SelectPalette | Selects the logical palette. |
RealizePalette | Maps palette entries in the current logical palette to the system palette. |
UpdateColors | Updates the client area of the device context by matching the current colors in the client area to the system palette on a pixel-by-pixel basis. |
GetHalftoneBrush | Retrieves a halftone brush. |
GetBkColor | Retrieves the current background color. |
SetBkColor | Sets the current background color. |
GetBkMode | Retrieves the background mode. |
SetBkMode | Sets the background mode. |
GetPolyFillMode | Retrieves the current polygon-filling mode. |
SetPolyFillMode | Sets the polygon-filling mode. |
GetROP2 | Retrieves the current drawing mode. |
SetROP2 | Sets the current drawing mode. |
GetStretchBltMode | Retrieves the current bitmap-stretching mode. |
SetStretchBltMode | Sets the bitmap-stretching mode. |
GetTextColor | Retrieves the current text color. |
SetTextColor | Sets the text color. |
GetColorAdjustment | Retrieves the color adjustment values for the device context. |
SetColorAdjustment | Sets the color adjustment values for the device context using the specified values. |
GetMapMode | Retrieves the current mapping mode. |
SetMapMode | Sets the current mapping mode. |
GetViewportOrg | Retrieves the x- and y-coordinates of the viewport origin. |
SetViewportOrg | Sets the viewport origin. |
OffsetViewportOrg | Modifies the viewport origin relative to the coordinates of the current viewport origin. |
GetViewportExt | Retrieves the x- and y-extents of the viewport. |
SetViewportExt | Sets the x- and y-extents of the viewport. |
ScaleViewportExt | Modifies the viewport extent relative to the current values. |
GetWindowOrg | Retrieves the x- and y-coordinates of the origin of the associated window. |
SetWindowOrg | Sets the window origin of the device context. |
OffsetWindowOrg | Modifies the window origin relative to the coordinates of the current window origin. |
GetWindowExt | Retrieves the x- and y-extents of the associated window. |
SetWindowExt | Sets the x- and y-extents of the associated window. |
ScaleWindowExt | Modifies the window extents relative to the current values. |
DPtoHIMETRIC | Converts device units into HIMETRIC units. |
DPtoLP | Converts device units into logical units. |
HIMETRICtoDP | Converts HIMETRIC units into device units. |
HIMETRICtoLP | Converts HIMETRIC units into logical units. |
LPtoDP | Converts logical units into device units. |
LPtoHIMETRIC | Converts logical units into HIMETRIC units. |
FillRgn | Fills a specific region with the specified brush. |
FrameRgn | Draws a border around a specific region using a brush. |
InvertRgn | Inverts the colors in a region. |
PaintRgn | Fills a region with the selected brush. |
SetBoundsRect | Controls the accumulation of bounding-rectangle information for the specified device context. |
GetBoundsRect | Returns the current accumulated bounding rectangle for the specified device context. |
GetClipBox | Retrieves the dimensions of the tightest bounding rectangle around the current clipping boundary. |
SelectClipRgn | Combines the given region with the current clipping region by using the specified mode. |
ExcludeClipRect | Creates a new clipping region that consists of the existing clipping region minus the specified rectangle. |
ExcludeUpdateRgn | Prevents drawing within invalid areas of a window by excluding an updated region in the window from a clipping region. |
IntersectClipRect | Creates a new clipping region by forming the intersection of the current region and a rectangle. |
OffsetClipRgn | Moves the clipping region of the given device. |
PtVisible | Specifies whether the given point is within the clipping region. |
RectVisible | Determines whether any part of the given rectangle lies within the clipping region. |
GetCurrentPosition | Retrieves the current position of the pen (in logical coordinates). |
MoveTo | Moves the current position. |
LineTo | Draws a line from the current position up to, but not including, a point. |
Arc | Draws an elliptical arc. |
ArcTo | Draws an elliptical arc. This function is similar to Arc, except that the current position is updated. |
AngleArc | Draws a line segment and an arc, and moves the current position to the ending point of the arc. |
GetArcDirection | Returns the current arc direction for the device context. |
SetArcDirection | Sets the drawing direction to be used for arc and rectangle functions. |
PolyDraw | Draws a set of line segments and Bézier splines. This function updates the current position. |
Polyline | Draws a set of line segments connecting the specified points. |
PolyPolyline | Draws multiple series of connected line segments. The current position is neither used nor updated by this function. |
PolylineTo | Draws one or more straight lines and moves the current position to the ending point of the last line. |
PolyBezier | Draws one or more Bézier splines. The current position is neither used nor updated. |
PolyBezierTo | Draws one or more Bézier splines, and moves the current position to the ending point of the last Bézier spline. |
FillRect | Fills a given rectangle by using a specific brush. |
FrameRect | Draws a border around a rectangle. |
InvertRect | Inverts the contents of a rectangle. |
DrawIcon | Draws an icon. |
DrawDragRect | Erases and redraws a rectangle as it is dragged. |
FillSolidRect | Fills a rectangle with a solid color. |
Draw3dRect | Draws a three-dimensional rectangle. |
DrawEdge | Draws the edges of a rectangle. |
DrawFrameControl | Draw a frame control. |
DrawState | Displays an image and applies a visual effect to indicate a state. |
Chord | Draws a chord (a closed figure bounded by the intersection of an ellipse and a line segment). |
DrawFocusRect | Draws a rectangle in the style used to indicate focus. |
Ellipse | Draws an ellipse. |
Pie | Draws a pie-shaped wedge. |
Polygon | Draws a polygon consisting of two or more points (vertices) connected by lines. |
PolyPolygon | Creates two or more polygons that are filled using the current polygon-filling mode. The polygons may be disjoint or they may overlap. |
Polyline | Draws a polygon consisting of a set of line segments connecting specified points. |
Rectangle | Draws a rectangle using the current pen and fills it using the current brush. |
RoundRect | Draws a rectangle with rounded corners using the current pen and filled using the current brush. |
PatBlt | Creates a bit pattern. |
BitBlt | Copies a bitmap from a specified device context. |
StretchBlt | Moves a bitmap from a source rectangle and device into a destination rectangle, stretching or compressing the bitmap if necessary to fit the dimensions of the destination rectangle. |
GetPixel | Retrieves the RGB color value of the pixel at the specified point. |
SetPixel | Sets the pixel at the specified point to the closest approximation of the specified color. |
SetPixelV | Sets the pixel at the specified coordinates to the closest approximation of the specified color. SetPixelV is faster than SetPixel because it does not need to return the color value of the point actually painted. |
FloodFill | Fills an area with the current brush. |
ExtFloodFill | Fills an area with the current brush. Provides more flexibility than the FloodFill member function. |
MaskBlt | Combines the color data for the source and destination bitmaps using the given mask and raster operation. |
PlgBlt | Performs a bit-block transfer of the bits of color data from the specified rectangle in the source device context to the specified parallelogram in the given device context. |
TextOut | Writes a character string at a specified location using the currently selected font. |
ExtTextOut | Writes a character string within a rectangular region using the currently selected font. |
TabbedTextOut | Writes a character string at a specified location, expanding tabs to the values specified in an array of tab-stop positions. |
DrawText | Draws formatted text in the specified rectangle. |
GetTextExtent | Computes the width and height of a line of text on the attribute device context using the current font to determine the dimensions. |
GetOutputTextExtent | Computes the width and height of a line of text on the output device context using the current font to determine the dimensions. |
GetTabbedTextExtent | Computes the width and height of a character string on the attribute device context. |
GetOutputTabbedTextExtent | Computes the width and height of a character string on the output device context. |
GrayString | Draws dimmed (grayed) text at the given location. |
GetTextAlign | Retrieves the text-alignment flags. |
SetTextAlign | Sets the text-alignment flags. |
GetTextFace | Copies the typeface name of the current font into a buffer as a null-terminated string. |
GetTextMetrics | Retrieves the metrics for the current font from the attribute device context. |
GetOutputTextMetrics | Retrieves the metrics for the current font from the output device context. |
SetTextJustification | Adds space to the break characters in a string. |
GetTextCharacterExtra | Retrieves the current setting for the amount of intercharacter spacing. |
SetTextCharacterExtra | Sets the amount of intercharacter spacing. |
GetFontData | Retrieves font metric information from a scalable font file. The information to retrieve is identified by specifying an offset into the font file and the length of the information to return. |
GetKerningPairs | Retrieves the character kerning pairs for the font that is currently selected in the specified device context. |
GetOutlineTextMetrics | Retrieves font metric information for TrueType fonts. |
GetGlyphOutline | Retrieves the outline curve or bitmap for an outline character in the current font. |
GetCharABCWidths | Retrieves the widths, in logical units, of consecutive characters in a given range from the current font. |
GetCharWidth | Retrieves the fractional widths of consecutive characters in a given range from the current font. |
GetOutputCharWidth | Retrieves the widths of individual characters in a consecutive group of characters from the current font using the output device context. |
SetMapperFlags | Alters the algorithm that the font mapper uses when it maps logical fonts to physical fonts. |
GetAspectRatioFilter | Retrieves the setting for the current aspect-ratio filter. |
QueryAbort | Calls the AbortProc callback function for a printing application and queries whether the printing should be terminated. |
Escape | Allows applications to access facilities that are not directly available from a particular device through GDI. Also allows access to Windows escape functions. Escape calls made by an application are translated and sent to the device driver. |
DrawEscape | Accesses drawing capabilities of a video display that are not directly available through the graphics device interface (GDI). |
StartDoc | Informs the device driver that a new print job is starting. |
StartPage | Informs the device driver that a new page is starting. |
EndPage | Informs the device driver that a page is ending. |
SetAbortProc | Sets a programmer-supplied callback function that Windows calls if a print job must be aborted. |
AbortDoc | Terminates the current print job, erasing everything the application has written to the device since the last call of the StartDoc member function. |
EndDoc | Ends a print job started by the StartDoc member function. |
ScrollDC | Scrolls a rectangle of bits horizontally and vertically. |
PlayMetaFile | Plays the contents of the specified metafile on the given device. The enhanced version of PlayMetaFile displays the picture stored in the given enhanced-format metafile. The metafile can be played any number of times. |
AddMetaFileComment | Copies the comment from a buffer into a specified enhanced-format metafile. |
AbortPath | Closes and discards any paths in the device context. |
BeginPath | Opens a path bracket in the device context. |
CloseFigure | Closes an open figure in a path. |
EndPath | Closes a path bracket and selects the path defined by the bracket into the device context. |
FillPath | Closes any open figures in the current path and fills the path’s interior by using the current brush and polygon-filling mode. |
FlattenPath | Transforms any curves in the path selected into the current device context, and turns each curve into a sequence of lines. |
GetMiterLimit | Returns the miter limit for the device context. |
GetPath | Retrieves the coordinates defining the endpoints of lines and the control points of curves found in the path that is selected into the device context. |
SelectClipPath | Selects the current path as a clipping region for the device context, combining the new region with any existing clipping region by using the specified mode. |
SetMiterLimit | Sets the limit for the length of miter joins for the device context. |
StrokeAndFillPath | Closes any open figures in a path, strikes the outline of the path by using the current pen, and fills its interior by using the current brush. |
StrokePath | Renders the specified path by using the current pen. |
WidenPath | Redefines the current path as the area that would be painted if the path were stroked using the pen currently selected into the device context. |
- Total
- Today
- Yesterday
- 메이븐(maven)
- await
- nl2br
- java web-mvc
- 문자 자르기
- 제품 등록
- java 키워드 정리
- error-java
- MainActor
- 람다식(lambda expression)
- java.sql
- 특정 문자를 기준으로 자르기
- 스프링 프레임워크(spring framework)
- 인텔리제이(intellij)
- jstl(java standard tag library)-core
- java-개발 환경 설정하기
- 스프링 프레임워크(spring framewordk)
- docker
- system.io
- REST API
- jsp 오픈 소스
- React
- 표현 언어(expression language)
- 스프링 시큐리티(spring security)-http basic 인증
- System.Diagnostics
- .submit()
- jstl(java standard tag library)
- In App Purchase
- 스프링 시큐리티(spring security)
- 진수 변환
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |