c++ - GDI+ Bitmap LockBits returns rotated image? -
i loaded image file , want write avi file:
gdiplus::bitmap frame(l"test.png", false); gdiplus::bitmapdata bmp_data = {}; gdiplus::rect rect(0, 0, frame.getwidth(), frame.getheight()); frame.lockbits(&rect, gdiplus::imagelockmoderead, frame.getpixelformat(), &bmp_data); avistreamwrite(avi_stream, i, 1, bmp_data.scan0, std::abs(bmp_data.stride) * bmp_data.height, aviif_keyframe, null, null); frame.unlockbits(&bmp_data);
resulting avi-file rotated 180 degrees. what's wrong?
also noticed original image bottom-up (bitmap::lockbits()
returned negative bitmapdata::stride
). saved disk bitmap::save()
. after loading image top-down.
Comments
Post a Comment