ghaerr / ghaerr/microwindows

Load and display bitmaps at runtime

Open
#82 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
858
Forks
112
Avg merge
1d 13h
Merged PRs (30d)
4

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the assertion at src/drivers/genmem.c:144 and trace the bitmap-loading and drawing calls shown in the issue, including GdLoadImageFromFile, DrawDIB, StretchBlt, and GdDrawImageFromFile. Reproduce both the assertion and the partially displayed 8-bit BMP, then determine the supported runtime path and verify that bitmap display works correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.