Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Xeda112358 on November 03, 2011, 11:12:59 pm

Title: GrayDraw (Grammer)
Post by: Xeda112358 on November 03, 2011, 11:12:59 pm
GrayDraw is currently a very simple grayscale drawing program. You just input the name of the file to open and if it doesn't exist, it is created, otherwise, it is used. Note that this version does not check if the var is archived or not and it won't check if it is the right size (in case the var already existed).

You can do some simple drawing in 4-level gray that works best on models with 15MHz.

I might end up adding the ability to draw other shapes such as lines, rectangles, and circles, in the future.
I should also add in error checking XD

In any event, it looks better on a real calc than it does in the screenie, but I have this one anyway :D

EDIT: Uploaded correct version XD
Title: Re: GrayDraw (Grammer)
Post by: Builderboy on November 03, 2011, 11:28:36 pm
Does it create greyscale by alternating on and off for all the grey pixels?  It might look better if you choose to dither them such that every other grey pixel is on half the time, and the other pixels are on the other half time. 
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on November 03, 2011, 11:30:21 pm
I have no clue how to do that O.O
Title: Re: GrayDraw (Grammer)
Post by: aeTIos on November 04, 2011, 07:42:27 am
Ask quigibo ^^
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on November 04, 2011, 08:20:41 am
XD Runer just said to steal it from Axe O.O
The only problem is that I am using Grammer code to display the grayscale (not pure assembly). Though I could add actual grayscale support in the future...
Title: Re: GrayDraw (Grammer)
Post by: Sorunome on November 04, 2011, 08:23:21 am
That is cool, the program! O.o
Title: Re: GrayDraw (Grammer)
Post by: Keoni29 on November 04, 2011, 08:59:27 am
I have no clue how to do that O.O
A "checkerboard algorithm" aint that hard to make :P
Title: Re: GrayDraw (Grammer)
Post by: LincolnB on November 04, 2011, 10:23:33 am
Keoni, you realize that doesn't answer his question at all, that just makes him feel bad?
Title: Re: GrayDraw (Grammer)
Post by: aeTIos on November 04, 2011, 12:07:31 pm
* her question
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on November 04, 2011, 01:43:27 pm
:) Thanks buttsfredkin and aeTIos :)
And I do have a command to draw a checkerboard pattern (both checkerboards) so what do I have to do with them? Do I perform AND logic with that and the buffer I want to display?
Title: Re: GrayDraw (Grammer)
Post by: LincolnB on November 04, 2011, 10:12:54 pm
* her question

Oh yeah. Oops. I knew that.
Title: Re: GrayDraw (Grammer)
Post by: parserp on November 04, 2011, 11:49:48 pm
wait, Xeda is a girl?
Title: Re: GrayDraw (Grammer)
Post by: aeTIos on November 05, 2011, 09:42:16 am
Yep.
Title: Re: GrayDraw (Grammer)
Post by: parserp on November 05, 2011, 02:12:56 pm
hmmm, I didn't know that... :P
Title: Re: GrayDraw (Grammer)
Post by: aeTIos on November 05, 2011, 02:16:23 pm
I at first didnt too. Most members are boys, and I also assume that with a new member.
Title: Re: GrayDraw (Grammer)
Post by: annoyingcalc on November 05, 2011, 02:28:53 pm
wait, Xeda is a girl?
Really? O.O wow I thought that she was a boy wow, (still girls can be good programers like for instance Xeda)
Title: Re: GrayDraw (Grammer)
Post by: Yeong on November 07, 2011, 07:35:42 am
There was a few more girl member but they're inactive now D:
Title: Re: GrayDraw (Grammer)
Post by: aeTIos on November 09, 2011, 03:11:16 am
All right, maybe this pseudocode will help you for the grayscale:
(use a gray buff ofcourse)
Code: (pseudocode) [Select]
if frame=even {
    if row=even{
      turn even pixels on;
   }
    if row=odd{
      turn odd pixels on;
   }
}
invert for odd frames.
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on November 09, 2011, 07:04:26 am
Using some available features, is this what you mean? I could store this to a buffer and use XOR logic (or I could add a command to XOR these patterns to a buffer).
Title: Re: GrayDraw (Grammer)
Post by: Yeong on November 09, 2011, 07:51:24 am
What is the use of checkerboard fill? :3
I'm just curious.
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on November 09, 2011, 08:33:28 am
well, people were telling me how to use grayscale and I was wondering if the idea they were presenting needed that... Otherwise, I just added the Fill( command for miscellaneous effects :)

Also, we need a :3 smiley >_>
Title: Re: GrayDraw (Grammer)
Post by: aeTIos on November 09, 2011, 09:28:01 am
yeah, that's what I mean. but it needs to be inverted when the frame is odd.
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on November 09, 2011, 09:28:52 am
What do you mean, the checkerboard pattern? If that is what you mean, that is what I was trying to show in the screenie XD (I invert it)
Title: Re: GrayDraw (Grammer)
Post by: aeTIos on November 09, 2011, 09:30:20 am
Oh lol. yep, then its okay. but it should be some faster. XD
Title: Re: GrayDraw (Grammer)
Post by: DJ Omnimaga on December 30, 2011, 03:04:06 pm
Ask quigibo ^^
Not me?  :'( ???

j/k

I did that grayscale dithering thing too in Reuben series, though. It's better than just flashing every pixel at once, else it flickered too much. And yeah that's the checkered pattern I mean.

What is the use of checkerboard fill? :3
I'm just curious.
It creates an optical illusion that makes the grayscale look less flickery than if you flash every pixel at once the same color.

By the way here are examples of what Reuben looks like (checkerboard) and how it would look like if it wasn't checkered. Less annoying with checkerboard, eh? :P
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on December 30, 2011, 07:03:45 pm
Wow, really cool DJ! I should really get on this grayscale coding. I am currently working on freeing up both saveSScreen and AppBackUpScreen (two areas in non-user RAM that can contain what Axers call a backbuffer). Currently AppBackUpScreen is only used as the default particle buffer and the first two bytes are modified. SaveSScreen, however, is used for converting token strings to ASCII, holding rectangle patterns, converting numbers to strings, and other behind the scenes things. I think I can get away with putting all that in the OP1 and OP2 areas of RAM, though, and I will need to rewrite the text display code.
Title: Re: GrayDraw (Grammer)
Post by: DJ Omnimaga on December 31, 2011, 03:31:22 am
Thanks. That's some old stuff up there (2004) :P. Maybe you could port Reuben Quest series to grammer? ;D

J/k it would be quite big as project, especially that you are busy with school and lots of other projects. :P
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on February 29, 2012, 10:11:42 am
So, update time :D Now that Grammer actually uses grayscale as default, I made a much nicer version that uses grayscale properly :) Also, I figured out why the checker pattern wasn't looking fast enough... I had Wabbit's color up to 2 shades. On a real calc, it shows it as perfectly gray with no flicker. It gets about 86FPS at 15MHz.

The new version features 3 shades-- black, white, and gray. You now draw with a resizable cursor and it runs at 6MHz.

Controls:


I am wondering if I should add a save file or not so that people can load and save their pictures... Naturally, it would require 1536 bytes per image, though :/ I could even make it so that it uses OS pictures, too. I have resized them before, so I know it is doable. I think I could even get it so that the OS would read it normally, but you could use it as a grayscale pic for Grammer.

To be clear, this is actually good grayscale, not the flickery stuff I did before :)
Title: Re: GrayDraw (Grammer)
Post by: GB on February 29, 2012, 01:15:44 pm
Ask quigibo ^^
Not me?  :'( ???

j/k

I did that grayscale dithering thing too in Reuben series, though. It's better than just flashing every pixel at once, else it flickered too much. And yeah that's the checkered pattern I mean.

What is the use of checkerboard fill? :3
I'm just curious.
It creates an optical illusion that makes the grayscale look less flickery than if you flash every pixel at once the same color.

By the way here are examples of what Reuben looks like (checkerboard) and how it would look like if it wasn't checkered. Less annoying with checkerboard, eh? :P

I know this may be a little off-topic, but is it just me or does Reuben look sort of like a telephone? That's what I always thought when I played the game.
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on February 29, 2012, 01:27:15 pm
I can see that :D I always saw a person because that is what I expected, but that could actually be a really nice telephone sprite o.o
Title: Re: GrayDraw (Grammer)
Post by: DJ Omnimaga on February 29, 2012, 02:12:50 pm
Yeah now that you mention it it seems like it lol. I guess it can't be helped due to the conversion of the battle sprite from 16x16 to 8x8. XD
Title: Re: GrayDraw (Grammer)
Post by: Xeda112358 on February 29, 2012, 03:10:30 pm
I can still tell that it isn't a phone, though :3 There are only so many ways to make an 8x8 sprite, anyways. (well, 2^64 ways, but not that many that look good XD)