mfc_GDI_Rotation - 8BitsCoding/RobotMentor GitHub Wiki
CPaintDC dc(this);
Graphics ScreenG(dc.GetSafeHdc());
Bitmap *pBitmap;
pBitmap = (Bitmap*)Image::FromFile(๊ฐ์ ธ์ฌJPG๊ฒฝ๋ก);
Gdiplus::Matrix matrix;
matrix.RotateAt(์ํ๋ ๊ฐ๋(์:235.7), Gdiplus::PointF((float)(pBitmap->GetWidth()/2), (float)(pBitmap->GetHeight()/2)));
//ํด๋น ์ด๋ฏธ์ง์ ์ ์ค์์ ๊ธฐ์ค์ผ๋ก 235.7๋ ๋๋ฆฌ๋ผ๋ ์๊ธฐ์
๋๋ค.
//์ฐธ๊ณ ๋ก ๊ฐ์ด๋ฐ๋ฅผ ๊ธฐ์ค์ผ๋ก ๋๋ฆฌ๊ธฐ ์ํด์๋ ์ด๋ฏธ์ง์ ๊ฐ๋ก์ธ๋ก ์ฌ์ด์ฆ๊ฐ ํ์์ฌ์ผ ๊น๋ํ๊ฒ ๋์๊ฐ๊ฒ๋๋ค.
ScreenG.SetTransform(&matrix); //ScreenG๋ฅผ ์์ ๊ท์น๋๋ก ๋๋ ค๋ฒ๋ ธ์ต๋๋ค.
ScreenG.DrawImage(pBitmap, 0, 0); //์ด๋ฏธ ๋์๊ฐ ScreenG์ pBitmap ์ด๋ฏธ์ง๋ฅผ ๊ทธ๋ ค์ค๋๋ค. ์์์ ๊ฐ์ด ๋์๊ฐ๊ฒ๋ฉ๋๋ค.
delete pBitmap;
Roation์ Matrix ์ค๋ณตํด์ ์ฌ์ฉํ๋ฉด ์๋จ
Rotation์ดํ Matrix ๋ฆฌ์ ํด์ค์ผํจ ์ดํ์ ์ํฅ์ ์ค