BasicBitmap icon indicating copy to clipboard operation
BasicBitmap copied to clipboard

how to blit bitmap?

Open sailfish009 opened this issue 8 years ago • 5 comments

Hi, i am testing bitmap display with basicbitmap,

but, it didn't displayed on window, how to do it properly?

https://github.com/sailfish009/StreamPlayer/blob/master/Frame.cpp

BasicBitmap bitmap = BasicBitmap(width_, height_,BasicBitmap::A8R8G8B8, pixelsPtr_,2048); bitmap.Blit(rc.left, rc.top, &bitmap, rc.right - rc.left, rc.bottom - rc.top, width_, height_);

sailfish009 avatar May 12 '16 02:05 sailfish009

you are blitting one bitmap onto itself. use: bitmap. SetDIBitsToDevice(hdc, 0, 0, width, height); in windows instead

skywind3000 avatar May 12 '16 09:05 skywind3000

it also didn't worked.


BasicBitmap bitmap = BasicBitmap(width_, height_,BasicBitmap::A8R8G8B8, pixelsPtr_, 2048);
  PAINTSTRUCT ps;
  HDC hdc = ::BeginPaint(window, &ps);
  assert(hdc != nullptr);
  ::SetStretchBltMode(hdc, HALFTONE);
  bitmap.SetDIBitsToDevice(hdc, 0, 0, width_, height_, 0, 0);
  bitmap.Blit(rc.left, rc.top, &bitmap, rc.right - rc.left, rc.bottom - rc.top, width_, height_);
  ::EndPaint(window, &ps);

sailfish009 avatar May 12 '16 09:05 sailfish009

bitmap.SetDIBitsToDevice(hdc, 0, 0, width_, height_, width_, height_);

skywind3000 avatar May 12 '16 13:05 skywind3000

nope, it didn't worked, too. i had tried following codes, it didn't.

  BasicBitmap bitmap = BasicBitmap(width_, height_, BasicBitmap::R8G8B8, pixelsPtr_, width_ << 1);
  BasicBitmap bitmap = BasicBitmap(width_, height_, BasicBitmap::R8G8B8, pixelsPtr_, 512);
  BasicBitmap bitmap = BasicBitmap(width_, height_,BasicBitmap::A8R8G8B8, pixelsPtr_, 1024);
  BasicBitmap bitmap = BasicBitmap(width_, height_,BasicBitmap::R8G8B8, pixelsPtr_,2048);
  BasicBitmap bitmap = BasicBitmap(width_, height_, BasicBitmap::R8G8B8, pixelsPtr_, pitch_); //pitch_ = lineSize + padding;
BasicBitmap bitmap = BasicBitmap(width_, height_, BasicBitmap::R8G8B8, pixelsPtr_, width_ >> 1);

however, for sure, checked that legacy code (StretchDIBits) works fine.

sailfish009 avatar May 13 '16 00:05 sailfish009

Direct2D, Direct3D, Win32(StretchDIBits) all works fine,

But, Still BasicBitmap doesn't worked.

sailfish009 avatar May 18 '16 01:05 sailfish009