|
답변 감사합니다.
8비트 4채널 이미지(즉 32비트)는 출력이 잘되네요.
그렇다면 가지고 있는 이미지가 24비트 버퍼라면
무조건 32비트 버퍼로 옮겨서 bmiHeader.biBitCount = 32 로 하여
StretchDIBits() 함수를 수행해야하는건가요?
아니면 24비트 버퍼 이미지를 정상적으로 뿌려주는 다른 방법은 없는건가요?
다시 한번 답변 부탁 드립니다.
감사합니다.
크레브 님이 쓰신 글 :
: 직접 해보지는 않았지만...
: 이미지 프로세싱에서 윈도우즈 OS가 32 bit 이기 때문에
: 버퍼의 가로 크기를 4바이트 단위로 잡아야 하는게 아닌가 합니다.
: 예를들어 이미지 버퍼의 크기가 10 * 6 (pixels) 라면
: 그대로 버퍼를 할당하지 말구 4의 배수인 12 * 6 (pixels) 로
: 할당해서 사용하면 괜찮을것 같습니다.
:
:
: 김정현 님이 쓰신 글 :
: : TImage에 buffer에 있는 이미지 데이터를 뿌려주려고 합니다.
: :
: : 그런데 이상한 점은 buffer의 width가 4의 배수인 경우에만 정상 출력되고
: : 아닌 경우에는 틀어져서 나옵니다.
: :
: : 이유를 모르겠네요. 꼭 좀 가르쳐주세요.
: :
: :
: : m_bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
: : m_bmiHeader.biWidth = image_width;
: : m_bmiHeader.biHeight = image_height;
: : m_bmiHeader.biPlanes = 1;
: : m_bmiHeader.biBitCount = 24;
: : m_bmiHeader.biCompression = BI_RGB;
: : m_bmiHeader.biSizeImage = width * height * 3;
: : m_bmiHeader.biXPelsPerMeter = 0;
: : m_bmiHeader.biYPelsPerMeter = 0;
: : m_bmiHeader.biClrUsed = 0;
: : m_bmiHeader.biClrImportant = 0;
: :
: : Image->Width = image_width;
: : Image->Height = image_height;
: : Image->Picture->Bitmap->Width = image_width;
: : Image->Picture->Bitmap->Height = image_height;
: :
: : SetStretchBltMode(Image->Handle, COLORONCOLOR);
: : int nRtn = StretchDIBits( Image->Canvas->Handle,
: : 0, 0, Image->Width, Image->Height,
: : 0, 0, image_width, image_height,
: : image_buffer, (LPBITMAPINFO)&m_bmiHeader,
: : DIB_RGB_COLORS, SRCCOPY);
|