Skip to content

Load and display bitmaps at runtime #82

@uklatt

Description

@uklatt

Hello Greg,

what is the "best" solution to load and display a BMP bitmap file with actual 0.94 version?
The following code doesn't work.

  image = GdLoadImageFromFile( filename, 0 );
  hdcMem = CreateCompatibleDC( hdc );
  hbmp = CreateCompatibleBitmap( hdcMem, SCREENX, SCREENY );
  hbmpOrg = SelectObject( hdcMem, hbmp );
  DrawDIB( hdcMem, 0, 0, image );
  StretchBlt( hdc, x, y, dx, dy, hdcMem, 0, 0, image->width, image->height, MWROP_SRC_OVER );
  DeleteObject(SelectObject(hdcMem, hbmpOrg));
  DeleteDC(hdcMem);

I got the following error:

/home/root/microwindows-0.94pre/src/drivers/genmem.c:144: gen_allocatememgc: Assertion `psd == &scrdev' failed.

When I display the bitmap file (8 bit palette image) with
GdDrawImageFromFile(hdc->psd, x,y,dx,dy, filename,0);
only the top half of the bitmap is displayed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions