Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: squidgetx on February 17, 2011, 12:02:11 pm

Title: Quick Grayscale Tutorial
Post by: squidgetx on February 17, 2011, 12:02:11 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
Title: Re: Quick Grayscale Tutorial
Post by: nabako on March 08, 2016, 12:48:05 pm
I do have a question about the code You showed there.
What exactly is ""?
Is it a command? I only found "sub(" as a command.

The topic may be old, but I hope You anwser.

Nabako
Title: Re: Quick Grayscale Tutorial
Post by: Runer112 on March 08, 2016, 01:39:44 pm
@nabako As you may be able to tell by your post's weird formatting, "[sub]" is the forum's opening tag for subscript text. However, I believe you may have misread what actually said "[sup]", which is the forum's opening tag for superscript text.

Neither of these tags work in code boxes, though, which the author of the original post didn't seem to realize. So I'm guessing you're really wondering about "[sup]r[/sup]", which is supposed to represent a superscript "r". On the calculator, this is the radians token, found in the angle (2nd + apps) menu.
Title: Re: Quick Grayscale Tutorial
Post by: nabako on March 09, 2016, 06:41:45 am
Ah okay  ;D
Still learning...
Now i do understand how it works.
Really appreciate your help.

Nabako
Title: Re: Quick Grayscale Tutorial
Post by: ClainBill on January 24, 2019, 06:49:32 am
I'm new to this so don't judge me, but could you explain 4 level grayscale in more detail?
i've pretty much nailed 2 level and got the hang of 3 but 4 just confuses me

Thanks
Title: Re: Quick Grayscale Tutorial
Post by: Yeong on January 24, 2019, 08:02:10 am
As in the concept? Think of buffers as two sheets of semi-transparent papers stacked together. If something is located on the both sheets, it will look the darkest (black). If there is nothing on both sheets, well, then there won't be anything (white). For greys, things drawn only on the back sheet will look lighter than the things only drawn on the front sheet because the paper is semi-transparent, right?

Therefore
* drawn on both front and back - black
* drawn on neither - white
* drawn on front only - darker gray
* drawn on back only - lighter gray
Title: Re: Quick Grayscale Tutorial
Post by: TIfanx1999 on January 24, 2019, 06:20:32 pm
O_o Yeong actually reappeared and posted? Wow!