본문 바로가기

GDI & GDI+

(3)
[C#] 이미지 출력 (확대/축소) 1. 이미지 파일로부터 이미지 로드 Bitmap _bmp = new Bitmap(imgFilePath); 2. 이미지 스케일링 double dZoomPercent = 200;// 200% 확대 Bitmap _bmpScaled = new Bitmap(_bmp, (int)(_bmp.Size.Width * dZoomPercent / 100), (int)(_bmp.Size.Height * dZoomPercent / 100)); 3. 이미지 출력 Graphics g = CreateGraphics(); g.DrawImage(_bmpScaled, 0, 0); 샘플 프로젝트
텍스트 Outline 효과 텍스트에 Outline 효과를 부여하는 다양한 방법 1. 텍스트 출력 시작 좌표를 이동하는 방법 for (int x = -m_nOutlineWidth; x SetTextColor(RGB(255,255,255)); pDC->TextOut(m_ptTextOut.x, m_ptTextOut.y, m_strText, m_strText.GetLength()); 원래의 텍스트를 출력하고자 하는 좌표값은 m_ptTextOut 이다. m_nOutlineWidth 가 외곽선의 두께를 의미하는데, 두께만큼 텍스트 출력좌표를 이동해가면서 텍스트를 그린 후에 흰색으로 텍스트 색상을 변경한 후 원래 텍스트 출력 좌표에 텍스트를 출력하면 다음과 같은 결과가 나타난다. 2. GDI의 Path 오브젝트를 활용 pDC->BeginPat..
VC++에서 GDI+ 사용 방법 VC++에서 GDI+ 사용방법 1. 프로젝트의 stdafx.h 파일에 다음 두 줄의 코드를 삽입한다. #include using namespace Gdiplus; 2. 어플리케이션 클래스에 다음 멤버를 추가한다. private: ULONG_PTR m_gdiplusToken; 3. 어플리케이션 클래스의 InitInstance 함수에 다음 GDI+ 초기화 코드를 추가한다. 코드 위치는 함수 시작 부분이 좋겠다. // Initialize GDI+ Gdiplus::GdiplusStartupInput gdiplusStartupInput; Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL); 4. 어플리케이션 클래스에 ExitInstance 함..