HRESULT AviFile::AddFrame(const Bitmap& bmp) { HRESULT hr = E_FAIL; if (!iserr && !play && bmp.IsHighColor() && bmp.Width() == rect.w && bmp.Height() == rect.h) { int w = bmp.Width(); int h = bmp.Height(); BYTE* buffer = new(__FILE__,__LINE__) BYTE[frame_size]; BYTE* dst = buffer; for (int y = 0; y < bmp.Height(); y++) { Color* src = bmp.HiPixels() + (h - 1 - y) * w; for (int x = 0; x < bmp.Width(); x++) { *dst++ = (BYTE) src->Blue(); *dst++ = (BYTE) src->Green(); *dst++ = (BYTE) src->Red(); src++; } } #pragma warning(suppress: 6001) hr = AVIStreamWrite(ps_comp, nframe, 1, buffer, frame_size, AVIIF_KEYFRAME, 0, 0); if (SUCCEEDED(hr)) { nframe++; } else { Print("AVIStreamWriteFile failed. %08x\n", hr); iserr = true; } delete [] buffer; } return hr; }
int Mouse::LoadCursor(CURSOR c, const char* name, HOTSPOT hs) { int result = 0; delete image[c]; image[c] = 0; if (name && *name) { image[c] = new(__FILE__,__LINE__) Bitmap; result = DataLoader::GetLoader()->LoadBitmap(name, *image[c], Bitmap::BMP_TRANSPARENT); if (result) { Bitmap* bmp = image[c]; if (bmp && bmp->HiPixels()) image[c]->CopyAlphaRedChannel(image[c]->Width(), image[c]->Height(), (LPDWORD) image[c]->HiPixels()); hotspot[c] = hs; } } return result; }