### Author Topic: Zooming Graphics In Axe  (Read 2786 times)

0 Members and 1 Guest are viewing this topic.

#### Axe Programmer

• LV2 Member (Next: 40)
• Posts: 32
• Rating: +0/-0
##### Zooming Graphics In Axe
« 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.

Axe Programmer

#### TheCoder1998

• LV6 Super Member (Next: 500)
• Posts: 434
• Rating: +20/-2
• my art is written in code, not in graphite
##### Re: Zooming Graphics In Axe
« Reply #1 on: May 20, 2014, 02:45:18 am »
is this even possible in axe?
my ticalc acc:

http://www.ticalc.org/archives/files/authors/113/11365.html

Spoiler For The Best Song Ever:

www.rickdepizza.tumblr.com

check out my anilist
http://anilist.co/animelist/29701/Rickdepizza

#### Streetwalrus

• LV12 Extreme Poster (Next: 5000)
• Posts: 3821
• Rating: +80/-8
##### Re: Zooming Graphics In Axe
« Reply #2 on: May 20, 2014, 02:47:11 am »
Yes but it is complicated bitmath. ASM is going to be easier and faster for this.

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: Zooming Graphics In Axe
« Reply #3 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.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### MGOS

• LV6 Super Member (Next: 500)
• Posts: 336
• Rating: +95/-0
##### Re: Zooming Graphics In Axe
« Reply #4 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 inF ... zooming factor (1 or greater)Pt-Off(0,0,Pic1)r //draw it on the backbufferFor(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  EndEnd

#### DJ Omnimaga

• Clacualters are teh gr33t
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55931
• Rating: +3153/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: Zooming Graphics In Axe
« Reply #5 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/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.