Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: ACagliano on February 17, 2011, 10:33:04 am

Title: GreyScale Splash Screen
Post by: ACagliano on February 17, 2011, 10:33:04 am
I have failed to produce a good splash screen for Zelda. I still do not understand how to utilize the greyscale in Axe. I would like a splash screen that says "Legend of Zelda", "Ganon's Rage", and potentially has an image of the triforce. I don't care how many layers of greyscale it is. I would rather it be done by someone who has succeeded in using Axe grayscale before, but if someone teaches me how to do it, that would be cool too.
Title: Re: GreyScale Splash Screen
Post by: aeTIos on February 17, 2011, 10:41:57 am
Grayscale works by changing pixels on and off repeatly. you see this as gray.
You can do grayscale this way:
Code: [Select]
ClrDraw(radians)     >next time, i use (r)
Pause 100   (to prevent the program fron shutting down immediately)
Repeat getKey
ClrDraw(r)
Pt-On(Xpos,Ypos,[FFFFFFFFFFFFFFFF
DispGraph(r)
End
This displays a grayscale square somewhere on the screen (put an X and Y position in)
You can do this for the whole image, but also for a part of it
If you want a part not being gray, simply don't put a (r) after the Pt-On

I hope that this short tutorial is useful for you.


Title: Re: GreyScale Splash Screen
Post by: ACagliano on February 17, 2011, 10:52:21 am
Grayscale works by changing pixels on and off repeatly. you see this as gray.
You can do grayscale this way:
Code: [Select]
ClrDraw(radians)     >next time, i use (r)
Pause 100   (to prevent the program fron shutting down immediately)
Repeat getKey
ClrDraw(r)
Pt-On(Xpos,Ypos,[FFFFFFFFFFFFFFFF
DispGraph(r)
End
This displays a grayscale square somewhere on the screen (put an X and Y position in)
You can do this for the whole image, but also for a part of it
If you want a part not being gray, simply don't put a (r) after the Pt-On

I hope that this short tutorial is useful for you.




It does, but the code is only showing black.

I got it working.
Title: Re: GreyScale Splash Screen
Post by: ACagliano on February 17, 2011, 10:59:47 am
How would I make the entire back buffer black?
Title: Re: GreyScale Splash Screen
Post by: Munchor on February 17, 2011, 11:13:19 am
How would I make the entire back buffer black?

The main buffer:

Code: [Select]
Rect(0,64,96,64)
Title: Re: GreyScale Splash Screen
Post by: ACagliano on February 17, 2011, 11:15:35 am
Ok. And one last question. How would I draw the text I want to the back buffer, and have it remain black, as the rest is gray?
Title: Re: GreyScale Splash Screen
Post by: Munchor on February 17, 2011, 11:22:53 am
Ok. And one last question. How would I draw the text I want to the back buffer, and have it remain black, as the rest is gray?

Not sure what you mean, but maybe this...

Code: [Select]
Rect(0,64,96,64)r
Text(0,0,"This is some black text")
DispGraphr

Note: the r after Rect() and DispGraph is accessed by 2ND+APPS+3.

If you're using Tokens to program, just do Rect(0,64,96,64)^^r.
Title: Re: GreyScale Splash Screen
Post by: ACagliano on February 17, 2011, 11:41:37 am
It shows the text as grayscale too.
Title: Re: GreyScale Splash Screen
Post by: Munchor on February 17, 2011, 11:56:52 am
It shows the text as grayscale too.

Code: [Select]
Rect(0,64,96,64)r
Text(0,0,"This is some black text")
DispGraphr

I tried this:

Code: [Select]
.IMG
Fix 5
Repeat getKey(15)
Rect(0,0,96,64)^r
Text(0,0,"Text
DispGraph^r
End
Fix 4

And I got grey background and in black, 'Text' at coordinates (0,0).

What Axe version are you using? Show me your code please.
Title: Re: GreyScale Splash Screen
Post by: ACagliano on February 17, 2011, 12:15:58 pm
Quick Grayscale Tutorial

3 level gray:
Three level grayscale is utilized by using the command DispGraphr in place of the normal DispGraph command. Three level gray uses the backbuffer (L3) and the front buffer (L6). Everything on the back buffer will show as gray while everything on the front buffer will show as black. The front buffer is drawn over the back buffer, so if a pixel is "on" on both the front and back buffers, it will be shown as black.

You can change the common drawing operations Pt-On, Pt-Off, Pt-Change, Pxl-On, ClrDraw, Rect, Line, DrawInv, etc. to operate on the back buffer by adding the raidan r at the end of the command. For example, Pt-On(X,Y,Pic1)r will draw Pic1 to the backbuffer. If you then look at it with DispGraph, you will see it in gray.

Text, by default is drawn directly to the screen and not to the buffer. For this reason, it can appear as grayscale because it is being erased every time you call DispGraphr, and then redrawn very quickly. To make it so that text is drawn to the buffer, put a Fix 5 at the beginning of the program (and a Fix 4 at the end). To draw text to the back buffer, you will have to Exch the back and front buffers, write to the front buffer, and switch back:
Code: [Select]
Exch(L3,L6,768): Text(X,Y,"Text") : Exch(L3,L6,768)
4 level gray
With four level gray, the front buffer becomes somewhat transparent. Use the following table to figure out the pixel colors:
Code: [Select]
Front:Back:Color
0    :1   :Light Gray
0    :0   :White
1    :0   :Dark Gray
1    :1   :Black

Buffer operations remain the same. To display in four level gray, use DispGraphrr

Note: In order for the grayscale to show up, you must put the DispGraphr or DispGraphrr in a loop. In monochrome, you can get away with this:
Code: [Select]
:Pt-On(X,Y,Pic1)
:DispGraph
:Repeat getKey
:End
But with grayscale, you'll have to write the code like this:
Code: (displays Pic1 in dark gray) [Select]
:Pt-On(X,Y,Pic1)
:Repeat getKey
:DispGraph[sup]r[/sup][sup]r[/sup]
:End

edit: 1000 posts :D

It shows the text as grayscale too.

Code: [Select]
Rect(0,64,96,64)r
Text(0,0,"This is some black text")
DispGraphr

I tried this:

Code: [Select]
.IMG
Fix 5
Repeat getKey(15)
Rect(0,0,96,64)^r
Text(0,0,"Text
DispGraph^r
End
Fix 4

And I got grey background and in black, 'Text' at coordinates (0,0).

What Axe version are you using? Show me your code please.

I had it set Fix 4 at the beginning, that is why. It works now. Thanks.
Title: Re: GreyScale Splash Screen
Post by: Munchor on February 17, 2011, 01:41:33 pm
"I had it set Fix 4 at the beginning, that is why. It works now. Thanks."

Fix 5 makes it able to have text and images in the same screen.
Fix 4 disables it, ALWAYS DISABLE IT (Fix 4) BEFORE THE PROGRAM CLOSES, ALWAYS.

Your calculator can crash I think.
Title: Re: GreyScale Splash Screen
Post by: Builderboy on February 17, 2011, 03:43:41 pm
Actually the worst thing that can happen is that when you view the mode menu you don't see anything the first time :P Or similarly if you view the Y= menu or any other menu that uses the small font.  It's so stable that I still haven't bothered putting a Fix 4 at the end of PortalX because I'm too lazy and I know that it won't cause any issues.  That said, it is a good idea for a final release, because people might think you messed up their mode screen or whatever.
Title: Re: GreyScale Splash Screen
Post by: squidgetx on February 17, 2011, 03:46:13 pm
Same here, I never do it until I make a release. Also, it goes away as soon as your calc turns off.
Title: Re: GreyScale Splash Screen
Post by: Darl181 on February 17, 2011, 07:37:31 pm
It's actually kind of interesting with the lack of a fix 4 :P
I remember playing super mario 2.0 and everything was weird :P
Also, omnicalc looked interesting...
Title: Re: GreyScale Splash Screen
Post by: Deep Toaster on February 17, 2011, 09:55:06 pm
How would I make the entire back buffer black?

Fastest and easiest way:

Code: (Axe) [Select]
:0→{L3}
:Fill(L3,767)
Title: Re: GreyScale Splash Screen
Post by: Runer112 on February 17, 2011, 10:02:59 pm
Correction :P

Code: [Select]
ᴇFFFF→{L₃}ʳ
Fill(L₃+1,766)
Title: Re: GreyScale Splash Screen
Post by: Deep Toaster on February 17, 2011, 10:03:47 pm
Correction :P

Code: [Select]
ᴇFFFF→{L₃}ʳ
Fill(L₃+1,766)

Whoops. I really need sleep x.x.x
Title: Re: GreyScale Splash Screen
Post by: Builderboy on February 18, 2011, 01:29:50 am
For the smallest you can use ClrDrawr:DrawInvr methinks
Title: Re: GreyScale Splash Screen
Post by: Darl181 on February 18, 2011, 01:31:28 am
Wouldn't Rect(0,,96,64)r work?
Title: Re: GreyScale Splash Screen
Post by: Builderboy on February 18, 2011, 01:33:30 am
Rect(0,,96,)r works too methinks, its clipped right?
Title: Re: GreyScale Splash Screen
Post by: Darl181 on February 18, 2011, 01:35:34 am
Umm...define "clipped"

I think that would work, Rect( can go off screen right?


EDIT: I'm an addict now :w00t:
Title: Re: GreyScale Splash Screen
Post by: Builderboy on February 18, 2011, 01:36:10 am
if I make a rectangle 96x96 in Axe, it will still fill the screen properly and won't give me strange errors
Title: Re: GreyScale Splash Screen
Post by: Darl181 on February 18, 2011, 01:38:09 am
I don't know exactly...I think I've had rectangles go off-screen before, but I've avoided it for the most part.
What comes after L6?  Is it safe to write there, or does Axe stop at the end of the list?
Title: Re: GreyScale Splash Screen
Post by: Builderboy on February 18, 2011, 01:41:21 am
Its very very unsafe to write to places after L6, some very important things are there.  Thats why i belive Quigibo added clipping in the first place, so that people wouldn't crash their calcs when a rectangle goes off screen
Title: Re: GreyScale Splash Screen
Post by: Darl181 on February 18, 2011, 01:43:24 am
So...clipping is the inability to draw offscreen?
Title: Re: GreyScale Splash Screen
Post by: Runer112 on February 18, 2011, 01:43:36 am
For the smallest you can use ClrDrawr:DrawInvr methinks

If the DrawInv routine already exists in your program, then yes, that is the smallest solution. Here would be my priorities for the smallest way to fill the back buffer based on what routines already exist in your program:

Also, in case anyone was wondering, the smallest ways to fill the front buffer:

And the smallest ways to fill both buffers:
Title: Re: GreyScale Splash Screen
Post by: aeTIos on February 18, 2011, 02:31:07 pm
"I had it set Fix 4 at the beginning, that is why. It works now. Thanks."

Fix 5 makes it able to have text and images in the same screen.
Fix 4 disables it, ALWAYS DISABLE IT (Fix 4) BEFORE THE PROGRAM CLOSES, ALWAYS.

Your calculator can crash I think.
I never disable fix 5 and i've never had weird problems... other fixes are nice to experiment ( for example: a fix1 program makes all text white on black :) )
Title: Re: GreyScale Splash Screen
Post by: Deep Toaster on February 18, 2011, 07:45:12 pm
"I had it set Fix 4 at the beginning, that is why. It works now. Thanks."

Fix 5 makes it able to have text and images in the same screen.
Fix 4 disables it, ALWAYS DISABLE IT (Fix 4) BEFORE THE PROGRAM CLOSES, ALWAYS.

Your calculator can crash I think.
I never disable fix 5 and i've never had weird problems... other fixes are nice to experiment ( for example: a fix1 program makes all text white on black :) )


That would be Fix 3, but be warned: Fix 1 (which enables large font text) can crash your calculator if you use 2.53/55MP's ALPHA menus.