-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|236|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Graphical Engines


 
mike_g
Created : 20 August 2007
Edited : 20 August 2007
Language : Blitz

Fast Image Scaling



This is some code I am working on for my raycaster. It creates an array of scaled images to remove the need for realtime scaling. Each frame has its own handle and is sized appropriately to save RAM usage. At them moment there is only 1 scaled image array, but I intend to move that into a type so there can be as many as needed in-game. Anyway heres a test image for it:

And heres the code:

|edit| Oh yeah and press up/down to zoom in/out. |edit|

 

Comments


Friday, 24 August 2007, 22:22
Evil Roy Ferguso
Question: since this appears to pre-calculate the scaled images, is there any particular reason you have chosen not to use the built-in commands for this purpose?


Besides that, though, your code causes a memory access violation. I do have tree.png in the appropriate directory, and the above code works -- although you need to MaskImage the original tree image, CopyImage will transfer the mask to the scaled images as well.
Saturday, 25 August 2007, 05:22
mike_g
Question: since this appears to pre-calculate the scaled images, is there any particular reason you have chosen not to use the built-in commands for this purpose?

Oh, yeah I guess I went about this the hard way o_0 I started out coding this in realtime tho, then changed to doing it all pre-drawn.

Besides that, though, your code causes a memory access violation. I do have tree.png in the appropriate directory, and the above code works

Thats strange. It works fine for me. Did you get where the MAV was? It could be the Read/Write pixel fasts.

Anyways, I had done a little more work to this. The code below sets up a type for each image, so you can use as many different images as you want. I removed the fast bit from the read/write pixels. Hopefully I should work now. If you or anyone else is still getting MAVs, let us know. Cheers.