'GDI+'에 해당되는 글 1건

  1. 2008/12/22 GDI+ 사용 스레드.

GDI+ 사용 스레드.

from Study/API 2008/12/22 16:28 view 45228
1. GDI+ 기본정의

#pragma comment (lib, "gdiplus.lib")

#include <gdiplus.h>
using namespace Gdiplus;

 ULONG_PTR gpToken;
 GdiplusStartupInput gpsi;
VERIFY(GdiplusStartup( &gpToken, &gpsi, NULL ) == Ok );
//////////////////////////////////////////////////////////////////////
// Grahpics g;
////////////////////////////////////////////////////////////////////

GdiplusShutdown(gpToken);


2. MFC 에서 GDI+를 사용하기 위한 정의
 PRB: Microsoft Foundation Classes DEBUG_NEW Does Not Work with GDI+
" error C2660: 'Gdiplus::GdiplusBase::operator new' : 함수는 3개의 매개 변수를 사용하지 않습니다. "

#define ULONG_PTR DWORD
//// Ensure that GdiPlus header files work properly with MFC DEBUG_NEW and STL header files.
#define iterator _iterator

#ifdef _DEBUG

namespace Gdiplus
{
    namespace DllExports
    {
#include "GdiplusMem.h"
    };
#ifndef _GDIPLUSBASE_H
#define _GDIPLUSBASE_H
    class GdiplusBase
    {
    public:
        void (operator delete)(void* in_pVoid)
        {
            DllExports::GdipFree(in_pVoid);
        }
        void* (operator new)(size_t in_size)
        {
            return DllExports::GdipAlloc(in_size);
        }
       
        void (operator delete[])(void* in_pVoid) { DllExports::GdipFree(in_pVoid); } void* (operator new[])(size_t in_size)
        {
            return DllExports::GdipAlloc(in_size);
        }
       
        void * (operator new)(size_t nSize, LPCSTR lpszFileName, int nLine)
        {
            return DllExports::GdipAlloc(nSize);
        }
       
        void operator delete(void* p, LPCSTR lpszFileName, int nLine)
        {
            DllExports::GdipFree(p);
        }
       
    };
#endif // #ifndef _GDIPLUSBASE_H
}
#endif // #ifdef _DEBUG

#include "GdiPlus.h"
using namespace Gdiplus;
#undef iterator
    //// Ensure that Gdiplus.lib is linked.
#pragma comment(lib, "gdiplus.lib")


3. 알수 없는 에러가 쭉 나오는 현상..
//MFC를 사용하지 않는 경우에 컴파일 시간을 줄이기 위해 정의한다.(GDI+ 에러남.)
#define WIN32_LEAN_AND_MEAN  // 원흉의 매크로~주석처리~



4. 유용한 사이트
  1) winapi.co.kr/gdi+
Tag |