Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Axe Programmer on May 19, 2014, 12:13:46 pm

Title: Zooming Graphics In Axe
Post by: Axe Programmer on May 19, 2014, 12:13:46 pm
Hi guys I have been wondering lately if there is a way to zoom on the screen during a program. Especially for graphics. Like just say I had a normal 8x8 sprite of the letter E. how could I get that to zoom towards you to the point where it is so big it no longer shows on the screen? I just cant seem to figure out a good method. :banghead:


Axe Programmer
Title: Re: Zooming Graphics In Axe
Post by: TheCoder1998 on May 20, 2014, 02:45:18 am
is this even possible in axe?
Title: Re: Zooming Graphics In Axe
Post by: Streetwalrus on May 20, 2014, 02:47:11 am
Yes but it is complicated bitmath. ASM is going to be easier and faster for this.
Title: Re: Zooming Graphics In Axe
Post by: Hayleia on May 20, 2014, 07:08:54 am
is this even possible in axe?
I don't see where the problem is. As long as you can read and write anywhere, you can do pretty much everything. The only problem is speed, as Streetwalrus said (that's why we don't have Assassin's Creed on calcs).

But it depends on what you want to do. You can do some simple things with lines without it being that slow. But it you want to zoom on an arbitrary image, yeah, you might run in speed issues whatever your language is.
Title: Re: Zooming Graphics In Axe
Post by: MGOS on May 20, 2014, 09:22:22 am
Zooming in steps of 8 (the width will be a multiple of 8 ) and with a relatively low speed can be achieved by pxl-Testing the sprite (directly from the program or from the backbuffer) and drawing a black square in the corresponding size at scaled coordinates.
Example:
Code: [Select]
Pic1 ... sprite you want to zoom in
F ... zooming factor (1 or greater)

Pt-Off(0,0,Pic1)r //draw it on the backbuffer
For(Y,0,7)
  For(X,0,7)
    If (pxl-Test(X,Y)r)  //read a pixel from backbuffer
      Rect(X*F,Y*F,F,)  //draw a square on frontbuffer
    End
  End
End

Title: Re: Zooming Graphics In Axe
Post by: DJ Omnimaga on May 20, 2014, 12:36:34 pm
What I did was just taking 8x8, 7x7, 6x6, 5x5, 4x4, 3x3 and 2x2 plain  black square sprites then displaying my sprite data using those. 8x8 also worked, but the bottom and right sides of the sprites were weird unless you manually erased it. However, back then, there was no Rect() command in Axe. Is Rect() faster?


This is what I had for sprite scaling, by the way. The Axe routine dates from almost 4 years ago. I don't remember if the screenshot ran at 6 MHz, though:
(http://www.omnimaga.org/index.php?action=dlattach;topic=6016.0;attach=1499;image)
http://www.omnimaga.org/axe-language/enlarging-sprites/msg93657/#msg93657


Runer also made a fullscreen zoom routine if you search through that topic.


All zooming routines are slow, though. For sprites, I recommend allocating a large data buffer to store multiple copies of your sprites at different zoom levels, to display them pre-rendered later and avoid having to zoom in real time.