|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
hcavolsdsadgadsg I'm a spammer Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Jun 22, 2009 1:08 am Post subject: Bitmap scaling |
|
|
This one had me stumped for a little while since I couldn't find any resources on it, so I eventually just sat down an wrote my own routine.
I think I have my stuff set up in a fairly clever way. Scaling is almost free, drawing the bitmap is where 99% of the work is done. It should be fairly fast and all the scaling is nearest neighbor. I guess there's a couple ways I could have sped it up more, but whatever, it's very cheap to do anyway. Scaling a 256x256 bitmap takes 0% cpu time for me, 1024x1024 is around 10%~. Performance basically scales entirely with pixel count. It's done in GDI, so don't count on your video hardware doing too much. The scaling is all done manually and uses no GDI calls.
Scaling is a simple idea actually. Divide the width / height by the new height to get the ratio. This ratio dictates how many pixels to skip or draw. As a bonus, I also use a faster alpha blending method than I used in other little releases I've made. It's very similar to the one here: http://www.stereopsis.com/doubleblend.html
Arrow keys scale the bitmap accordingly. Numpad - and + mess with the amount of alpha (although it isn't shown very well, since it is blending against a black background).
It will look for any 32 bit bitmap aptly named 'test.bmp' and try to draw it. I used GIMP to save it since not even MS-Paint will save a 32 bit one. The way the bytes are set up is different, so yes, it will probably crash horribly (or display garbage) trying to display anything other than 32 bits currently.
As usual, the actual .exe is small as hell and about as streamlined as it can hope to get and it's written in C.
I haven't gotten around to actually giving it a window yet, so it just draws on it's console window.
http://www.mediafire.com/?wztnqvhwzz4
|
|
Back to top |
|
|
DoomsDay Grandmaster Cheater Reputation: 0
Joined: 06 Jan 2007 Posts: 768 Location: %HomePath%
|
Posted: Mon Jun 22, 2009 10:02 am Post subject: |
|
|
One question: Why are you preventing FFFFFF from being processed?
|
|
Back to top |
|
|
hcavolsdsadgadsg I'm a spammer Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Jun 22, 2009 3:40 pm Post subject: |
|
|
DoomsDay wrote: | One question: Why are you preventing FFFFFF from being processed? |
The function can also ignore a color and simply not draw it. The first image I made originally had a ton of white. I didn't see anything visually wrong with this one, since there's probably no white in it at all, so I forgot to change it.
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|