GDI+ ( Graphics Device Interface +)

* winapi GDI+ 강좌 : http://winapi.co.kr/project/library/gdiplus/gdiplus.htm

Microsoft GDI+ 그래픽 : http://msdn.microsoft.com/ko-kr/library/aa984108(VS.71).aspx

<codeproject >
* Using GDI+ with MFC or native C/C++ : http://www.codeproject.com/KB/GDI-plus/gdi__and_mfc.aspx

Starting with GDI+ : http://www.codeproject.com/KB/GDI-plus/startinggdiplus.aspx

Style Toolkit - Use advanced graphics techniques to create a custom user interface : http://www.codeproject.com/KB/GDI-plus/Style_Toolkit.aspx

Thumbnails viewer and image processing using GDI+ and MFC : http://www.codeproject.com/KB/GDI-plus/GdiPThumbnailsViewer.aspx

Macro to initialize GDI+ in VC6.0 MFC projects : http://www.codeproject.com/KB/GDI-plus/vc6gdiplusmacro.aspx

Printing using GDI+ : a few tips : http://www.codeproject.com/KB/GDI-plus/gdipprint.aspx

Screen Painter : http://www.codeproject.com/KB/GDI-plus/ScreenPainter.aspx

Double Buffering With GDI+ : http://www.codeproject.com/KB/GDI-plus/gdiplus.aspx

GDI+ in ActiveX Controls Using MFC : http://www.codeproject.com/KB/GDI-plus/gdipluscontrol.aspx

Further discussions on flicker free drawing : http://www.codeproject.com/KB/GDI-plus/what_is_a_basename_.aspx


Using GDI+ with MFC or native C/C++

http://www.codeproject.com/KB/GDI-plus/gdi__and_mfc.aspx


1. stdafx.h에 추가
#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment(lib, "gdiplus.lib")

2. 초기화, 닫기
        GdiplusStartupInput gdiplusStartupInput;
        ULONG_PTR           gdiplusToken;
    - InitInstance()에서 초기화   
        GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
    - ExitInstance()에서 닫기
        GdiplusShutdown(gdiplusToken);

3. 그리기
void CGdiPlusView::OnDraw(CDC* pDC)
{
...
    Graphics graphics(pDC->m_hDC);
    LinearGradientBrush linGrBrush(Point(0, 10),
                                   Point(200, 10),
                                   Color(255, 255, 0, 0),   // opaque red
                                   Color(255, 0, 0, 255));  // opaque blue

    Pen pen(&linGrBrush);
    graphics.DrawLine(&pen, 0, 10, 200, 10);
    graphics.FillEllipse(&linGrBrush, 0, 30, 200, 100);
    graphics.FillRectangle(&linGrBrush, 0, 155, 500, 30);
...
}





반응형

'Code' 카테고리의 다른 글

Pointer Test  (0) 2012.08.19
GNU선언문  (0) 2012.08.19
Export 함수 이름 변경방지  (0) 2012.08.19
Dll Injecttion  (0) 2012.08.19
Assembly 언어  (0) 2012.08.19
Posted by codens