🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #3486

Problem: Nasty Bitmaps

#3486
From: Roman Fischer
Date: Thu, 21 Jan 1993 08:32
45 lines
2525 bytes
Hi PM-Programmers,

we are currently writting a game running under PM. The basic idea consists of
two players simutaneiously fighting against a set of evil monsters. So we need
lots (~20) of small bitmaps that move around the screen (window).
The bitmaps were created with IconEdit and are loaded with GpiLoadBitmap. Since
we need 4 versions of every monster (looking to the left, right, up and down),
we need to "turn" the bitmaps. Because we don't want to change 4 bitmaps if
we decide to change the look of a ghost, we decided to turn them "by software"
at program-startup. So far no problem.

So we load the bitmaps and put them into a presentation space (associated to a
appropriate dev.context). Still no problems, they look just great!

But now, when reading them into a buffer to perform the turning-act (using
GpiQueryBitmapBits), we noticed a strange behaviour:

The original size of the bitmaps is 20x20 pixels. When loading, we resize them
to 36x36 pixels. Now, when reading the data into the buffer, the x-dimension
is 40 !!!!

This means: a. GpiQueryBitmapInfo returns a cx value of 36 (as expected).
               But a short look at the data received from GpiQueryBitmapBits
               shows, that every scan-line consists of 40 pixels (20 bytes).
               
            b. You cannot use cx to calculate the offset of a pixel.
               To calculate the correct offset, you need to know the number
               of bytes per scan-line.

            c. If you don't know the original size of the bitmap, you cannot
               tell the correct way to address a pixel within that bitmap !!

Now:
a. Did we miss an important part in any doc ? 
b. Number of bytes per scan-line, any idea?


Please post any responses, comments or ideas here or send email to
mhof@iiic.ethz.ch or rofische@.iiic.ethz.ch.

Regards              Roman
-- 
----------------------------------------------
INTERNET: rofische@iiic.ethz.ch
----------------------------------------------
Technical Details
Message-ID: <1993Jan21.083211.3396@neptune.inf.ethz.ch>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!scsing.switch.ch!bernina!neptune!rofische

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!scsing.switch.ch!bernina!neptune!rofische
From: rofische@iiic.ethz.ch (Roman Fischer)
Subject: Problem: Nasty Bitmaps
Message-ID: <1993Jan21.083211.3396@neptune.inf.ethz.ch>
Originator: rofische@a13
Sender: news@neptune.inf.ethz.ch (Mr News)
Nntp-Posting-Host: a13
Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH)
Date: Thu, 21 Jan 1993 08:32:11 GMT
Lines: 45