1
C++ 프로그램에서 BMP 이미지를 정확히 회전시키는 방법에 대한 질문은 Stack Overflow에 게시되었습니다. 그러나 지금, 나는 나의 진보에 관해서 더 보여줄 것이있다.C++ 방식의 이미지 회전
방법 (또는 왜) 궁금 내 프로그램은 내가 이미지 계산을 한 후 출력하지 이미지는 : 사람이 어떤 도움이 포인터가있는 경우
void BMPImage::Rotate45Left(float point1, float point2, float point3)
{
float radians = (2 * 3.1416*45)/360;
float cosine = (float)cos(radians);
float sine = (float)sin(radians);
float point1Xtreme = 0;
float point1Yearly = 0;
float point2Xtreme = 0;
float point2Yearly = 0;
float point3Xtreme = 0;
float point3Yearly = 0;
int SourceBitmapHeight = m_BIH.biHeight;
int SourceBitmapWidth = m_BIH.biWidth;
point1Xtreme = (-m_BIH.biHeight*sine);
point1Yearly = (m_BIH.biHeight*cosine);
point2Xtreme = (m_BIH.biWidth*cosine - m_BIH.biHeight*sine);
point2Yearly = (m_BIH.biHeight*cosine + m_BIH.biWidth*sine);
point3Xtreme = (m_BIH.biWidth*cosine);
point3Yearly = (m_BIH.biWidth*sine);
float Minx = min(0, min(point1Xtreme, min(point2Xtreme, point3Xtreme)));
float Miny = min(0, min(point1Yearly, min(point2Yearly, point3Yearly)));
float Maxx = max(point1Xtreme, max(point2Xtreme, point3Xtreme));
float Maxy = max(point1Yearly, max(point2Yearly, point3Yearly));
int FinalBitmapWidth = (int)ceil(fabs(Maxx) - Minx);
int FinalBitmapHeight = (int)ceil(fabs(Maxy) - Miny);
FinalBitmapHeight = m_BIH.biHeight;
FinalBitmapWidth = m_BIH.biWidth;
int finalBitmap;
, 그것은 좋은 것입니다. 나는 그것을 언급해야한다 :
이- 나는이 프로그램의 목적을 위해 다른 외부 라이브러리를 사용할 수 없습니다
- 그것은 메뉴 시스템을
코드가 전혀 회전하지 않는 것 같아서 이미지 출력이 예상 된 결과가 아닐 수 있습니다. – drescherjm
BTW, 위의 게시 요지는 우리가 당신을 위해 숙제를하러 온 것이 아닙니다. 문제를 해결하려고 시도하지만 예상대로 작동하지 않는 실제 코드를 게시하면 도움이됩니다. 게시 한 코드는 이미지 회전을 시작하지 않습니다. 회전시킬 이미지조차 없다. – drescherjm