PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Help Please

Moose or Chuck · 13 Jun 2001, 11:04 UTC

[pre]
Private Sub back_load_Click()
CommonDialog1.Filter = "Bitmap Files (*.bmp)|*.bmp|" ' Show only *.bmp-files.
CommonDialog1.Action = 1 ' Show the Open Window.

   RH = 0
   RW = 0
   GH = 0
   GW = 0
   dummy = LoadPicture(CommonDialog1.FileName)
   
 
SH = dummy.ScaleHeight * 2 ' take orignal Picture height and bump it 2x
SW = dummy.ScaleWidth * 2 ' take orignal Picture width and bump it 2x

   
           Do Until RW >= SW
               DoEvents
               picMap.Refresh
               BitBlt picMap.hDC, GW, GH, 1, 1, dummy.hDC, RW, RH, SRCCOPY
               BitBlt picMap.hDC, GW + 1, GH, 1, 1, dummy.hDC, RW, RH, SRCCOPY
               BitBlt picMap.hDC, GW, GH + 1, 1, 1, dummy.hDC, RW, RH, SRCCOPY
               BitBlt picMap.hDC, GW + 1, GH + 1, 1, 1, dummy.hDC, RW, RH, SRCCOPY
               RW = RW + 1
               GW = GW + 2
           Loop
           RW = 0
           GW = 0
           RH = RH + 1
           GH = GH + 2

frmMapEditor.Caption = "Ultimate Chaos Map Editor - " + CommonDialog1.FileTitle

End Sub
[/pre]


Okay, WTF is wrong. Everything is defined. dummy is a picture box, that is not visible. picMap is the Destination Picture box.This should use bitblt to blow up the picture they pic, to 2x, but obviously it is not working. It loads and all. Just it doesn't display the new picture. Any help would be greatly appreciated, as without fixing this i can't do much more. for the time beingLast modification: Same old Chuck - 06/13/01 at 09:04:55
Moose or Chuck · 13 Jun 2001, 11:27 UTC
well, i got it to output, BUT this is tooo slow. Its really really slow, i mean it takes almost two minutest to blow up the pic. Does anybody know of a faster routine.
I read on some GAPI explanation page somewhere that BitBlt is excruciatingly slow - like, it was taking 50 ms to blast a small area to the screen.

It'd take some more work to device your own bit-blasting routine, and you'd have to keep in mind memory orientation differences between IPAQs and other devices, but for real-time stuff you cannot use bitblt.  - Richard
Moose or Chuck · 13 Jun 2001, 11:40 UTC
this isn't for PPC, this is a map editor for Argentum, the problem is that when i use bitblt even for desktop it takes like two minutes. I believe the problem is, is that it doesn't really like that long ass loop. Could i use directx. But would that be complicated as a big whore? hmmm.. so many questions so little time.
What about just scaling the bitmap once, and save it into a buffer, then just bitblt the whole thing.

// Fredrik
Moose or Chuck · 13 Jun 2001, 12:41 UTC
I think Jimmy was the one behind the "All your base" thing. And it wasn't intentional. It was probably his predecessor to Turjah, which was leaked out, so he canned it. But that's just my theory.
I can't see that dinky ass code on my screen, so I'll just GUESS at what it says.

It looks like you are bitblt-ing each pixel while you are trying to resize it. I ran across that problem a long time ago- and it is slow as hell.

A much faster way is to run a loop that resizes and stores it in a buffer. Then bitblt the entire image to the screen.

bitblt is to slow to work with single pixels, and is much more efficient with copying larger images from a buffer to the screen.

I think that is what Frederik was trying to say.
Ohhhhh you're _Scaling_ this stuff...

Honestly, I think DX8 is mature enough right now that it would make this a very trivial matter - scaling bitmaps is very built-in, and I _heard_ initialization of the graphics was a snap.

If you ever needed to scale bitmaps on devices that do not have DirectX, a quick and easy way is to use a pair of DDA's (differential data analyzers) to determine which columns/rows to skip or repeat.  This is similar to Bresenham's line drawing algorithm would draw a line of different slopes, using simple integer math.

- Richard
Randall: That was what I was trying to say, except for that my name is spelled Fredrik. :)

As for "All your base are belong to us"...your theory might have some truth in it ;), but the original is from a sega genesis game named Zero Wing. Do a search on all your base...and you will get all the info you need.

Personally I think "Can you save your earth planet" is "better". Specially since it is in a banner, and the fact that it is NEW. Some mispeligns (smile) are ok, but not an obvious error like that in the banner...

// F
Quit messing around and just use StretchBlt.

Moose or Chuck · 14 Jun 2001, 04:25 UTC
hahaha, thanks digby, i completely forgot about that. umm code example smart guy :) I guess i could find some at planetsource.com but i'm lazy. Well after this, its just on to figuring out how to save where a bitmap is placed on a window and i'll have a basic editor :) runnin along smoothly. I'll probably have a simple beta for you to test Fredrik in like hrmmm.. by monday or so. I gotta werk alot this week some i'm not sure.
Moose or Chuck · 14 Jun 2001, 04:27 UTC
O ya another thing, is strechblt available in eVB, i was thinking about building another copy of this editor for ppc when i finish with the desktop version. I think that would be incredibly cool, play the map you just made :)
Chuck,

I'm not VB saavy so I can't give you a sample using StretchBlt in your native tongue.  It's basically the same API as BitBlt but has more params so that you can specify the size of both the source and destination rectangles.  If you think you could benefit from a sample using the API written in C I'd be happy to oblige.

StretchBlt is supported in the Pocket PC SDK.

Moose or Chuck · 14 Jun 2001, 21:45 UTC
good deal, I'll just find some samples on planetsourcecode.com that place is invaluable in learning anything. And  good, i hope i can get a usable version for ppc i would very much like it. well i'm gonna werk on this code a bunch tonight.
Seems to me the editor might be kinda slow on a Pocket PC if using an inherent blit routine in the SDK--especially if the person starts scrolling around their newly designed map in it. But, I'm no expert. GAPI would be good. I did some scaling in some game or so back around DirectX6 but I can't seem to find the source code right now :(
Ah well...