Best way to alpha blend over a bitmap.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I'm writing an app that creates a bitmap of a map (land, trees, ocean). The
resolution of the map is ~84x52 (it can change but will get no larger than
256x128).

Since this is so small I resize it (using NearestNeighbor to retain the
definition between squares) to a larger size. I have two QoS points: 1) I
would like to keep the resizing fast enough to have it attached to the
window Resize event; and 2) I would like to create an alpha blended red
square to float, constrained by the resolution of the map (I want it to snap
to each square, not just float around), to help the user see what square
they are pointing to.

To do this I tried to use GDI+ to resize the map using NearestNeighbor.
This worked plenty fast enough and I could use a little math to find where
the click on the bitmap translated to on the land map. One problem I
noticed right away, the border squares were only half as big as squares
inside the bitmap.

When I tried to add the floating red square the same math did not work in
reverse and usually ended up about half a square off. Also, the additional
bitmap took quite a bit longer to render and is way too slow for mouseover
tracking.

Since I could not get the math to work right I finally decided to draw the
bit map myself then I could draw the same size bitmap with a red pixel where
I wanted it and overlay the two. Now the map takes too long to render and
has gaps between the boxes (look like grid lines) because the resizing isn't
always on a factor of the height or width.

So I need to know, what is the fastest way to draw a bitmap, resize a
bitmap, not have gaps in the resized bitmap, and alpha blend a red square on
top of all that bound by the resolution of the original map?

Other than that I'm all set.

Thanks in advance,
Tom P.


.



Relevant Pages

  • Re: Image Distort Question
    ... probably the best is to use a conformal map of a ... >> unit disk to a square using, say, the usual Schwarz-Christoffel ... and reflections of course) conformal map from the square to the ...
    (comp.graphics.apps.gimp)
  • Re: Square LOS
    ... of fixing the map view to the size of the square. ... Lair and Crawl have this). ... by stretching or replacing the graphic tiles, and in the long term you ...
    (rec.games.roguelike.development)
  • Help Drawing into a Dialog
    ... What I have done now is simple draw a BITMAP into a dialogue ... the map only calling the CDialog::OnInitDialogroutine. ... //for clear map no markrs ... int xposition = 194; ...
    (microsoft.public.vc.mfc)
  • Re: GPath performance issue
    ... I'm drawing a map from coordinates temporarily stored in double arrays. ... the Bitmap to gain performance. ... Is the graphics memory full? ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Plain English Djikstra - help??
    ... On a real-life map, thsi makes sense - there are discrete distances ... The problem is you can only fill one square as a time, ... We will use a queue, and I will explain the difference later. ... the distance "one step" larger (where the step is the cost of movement ...
    (rec.games.roguelike.development)