๋ฐ˜์‘ํ˜•

GDI+ ๋Š” GDI ์—์„œ ํ™•์žฅ๋œ ๊ฐœ๋…์ž…๋‹ˆ๋‹ค. ๋” ๋งŽ์€ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋ฉฐ ์‚ฌ์šฉํ•˜๊ธฐ ์‰ฝ๊ณ  ์„ฑ๋Šฅ์ด ๋›ฐ์–ด๋‚ฉ๋‹ˆ๋‹ค.

[GDI] Part 1. GDI ๊ฐœ๋…


์•ˆํ‹ฐ ์—์ผ๋ฆฌ์–ด์‹ฑ(Anti-Aliasing), ๋ ์  ์ฒ˜๋ฆฌ, ํˆฌ๋ช…๋„ ๋“ฑ ๋ณด๋‹ค ์‰ฝ๊ฒŒ ๋งŽ์€ ๊ธฐ๋Šฅ๋“ค์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


ํ”„๋กœ์ ํŠธ์—์„œ GDI+๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์ค€๋น„๋‹จ๊ณ„๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.


stdafx.h ์— ๋‹ค์Œ์˜ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

// stdafx.h
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")
using namespace Gdiplus;

App header file์— ๋‹ค์Œ์˜ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

// Project Name : My_GDIPlus
class CMy_GDIPlusApp : public CWinApp
{
public:
    CMy_GDIPlusApp();
     //์•„๋ž˜ ๋ถ€๋ถ„์„ ์ถ”๊ฐ€.
    ULONG_PTR m_gdiplusToken;
// Overrides
public:
    virtual BOOL InitInstance();

// Implementation

    DECLARE_MESSAGE_MAP()
};

extern CMy_GDIPlusApp theApp;

App source file ์— ๋‹ค์Œ์˜ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

//xxxApp.cpp
BOOL CMy_GDIPlusApp::InitInstance()
{
    // InitCommonControlsEx() is required on Windows XP if an application
    // manifest specifies use of ComCtl32.dll version 6 or later to enable
    // visual styles.  Otherwise, any window creation will fail.
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    // Set this to include all the common control classes you want to use
    // in your application.
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinApp::InitInstance();

    // ๋‘ ์ค„์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
    Gdiplus::GdiplusStartupInput gdiplusStartupInput;
    Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
    // ์—ฌ๊ธฐ๊นŒ์ง€.

    AfxEnableControlContainer();
    ...
}


์œ„ 3๋‹จ๊ณ„๋ฅผ ๋ชจ๋‘ ์ถ”๊ฐ€ํ–ˆ์œผ๋ฉด Project๋ฅผ Buildํ•ฉ๋‹ˆ๋‹ค.

์—ฌ๊ธฐ๊นŒ์ง€๊ฐ€ GDI+๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ์ค€๋น„๋‹จ๊ณ„ ์˜€์Šต๋‹ˆ๋‹ค. ์ฐธ ์‰ฝ์ฃ ?

๋ฐ˜์‘ํ˜•