Calculator Community > Axe

Quick Grayscale Tutorial

(1/2) > >>

squidgetx:
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: ---Exch(L3,L6,768): Text(X,Y,"Text") : Exch(L3,L6,768)
--- End code ---

4 level gray
With four level gray, the front buffer becomes somewhat transparent. Use the following table to figure out the pixel colors:
--- Code: ---Front:Back:Color
0    :1   :Light Gray
0    :0   :White
1    :0   :Dark Gray
1    :1   :Black
--- End code ---

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: ---:Pt-On(X,Y,Pic1)
:DispGraph
:Repeat getKey
:End
--- End code ---
But with grayscale, you'll have to write the code like this:
--- Code: (displays Pic1 in dark gray) ---:Pt-On(X,Y,Pic1)
:Repeat getKey
:DispGraph[sup]r[/sup][sup]r[/sup]
:End
--- End code ---

edit: 1000 posts :D

nabako:
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

Runer112:
@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.

nabako:
Ah okay  ;D
Still learning...
Now i do understand how it works.
Really appreciate your help.

Nabako

ClainBill:
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

Navigation

[0] Message Index

[#] Next page

Go to full version