Sunday, May 23, 2010

Work Progress - May 21 - May 28

Default script idea:
Have a look of the constructor of GG/DrawerEngine.java. Currently we have a few default ActionScripts (formerly named drawing modules) already defined (moduleR, moduleP, moduleI). When you start the application GG/GGGui.java, you'll see they show up as a square blocks R, P and I in the right panel. Click on each of them, and then click on the "Event" tab on the left panel. Drag the OnCall event "codelet" to the middle window. Then you'll see the series of default instructions associated with the OnCall event codelet. Your task is to produce something similar with the "ToDraw" event codelet of another object of class SprayCan (which appears as a square with "*" in the right render window). That is to say, when I select the SprayCan object on the right render window, and then drag the "ToDraw" event codelet to the middle window, I can see a series of default instructions. Indeed these instructions will be executed once I click on the RUN button. You may perhaps try to reproduce a default script similar to what is shown at https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHQLKP_lbg_e8c0hUaSPXzH4msjxoybWPj0eJ63PehCnAeP2LKR2U1L6N0Ojvm5KFiU7vSE_yrCbulogAE91A_HfNo4osSVNh5R1Vzw-H_VFxP8JR0W_MizJQXfPUoE7IiYgJ8yEVcSvzr/s1600/shape.bmp as a starter. I think the goal is to produce a simple example script that can demonstrate the possibility of the program.

GG Border idea:
The border issue involves coding a method codelet to draw a flood-filled region defined by a series of points. Examples of method codelets can be found in GG/SprayCan.java and GG/ActionScript.java. Each of them is started with something like @AutomatableMethod and then a typical method definition. Inputs should be
* The coordinates of a few points (perhaps 4 points) which define the boundary of the graffiti shape
* For each border line, the width (starting from 0 to some finite value) and the color of the border
* The flood-fill color
I expect the method, when called, can produce a progressive animation of flood-filling the region defined by the boundary. An example of progressive animation can be found in the SprayCan's method MoveBy(), whose effect is shown at http://csdt-laut.blogspot.com/2010/04/work-progress-apr-7-apr-14.html
To animate the flood-filling sequence, I suggest scanline conversion (http://www.siggraph.org/education/materials/HyperGraph/scanline/outprims/polygon2.htm).

Some minor updates on graffiti grapher
  • Rename TimeStepAction to SprayCan, DrawingModule to ActionScript
  • The drawing action now stops properly.

Links to the skateboarder and graffiti grapher pCSDT apps (using Java Web Start)
http://www.rpi.edu/~laut/SB/app.jnlp
http://www.rpi.edu/~laut/GG/app.jnlp

Wednesday, May 12, 2010

Work Progress - May 13 - May 20

Send code to Ping and Bill
* Code
* Instruction to set it up in Netbeans

To do for the summer
* GUI drag-and-drop bug fixing
* IF/While conditional
* Enable drag into codelet

Wednesday, May 5, 2010

Work Progress - May 5 - May 12

Looks like JNLP is a better option than applet in hosting pCSDT applications.
Example JNLP: http://www.rpi.edu/~laut/GG/app.jnlp

Monday, May 3, 2010

Work Progress - Apr 30 - May 3

Drawing borders for the Graffiti shapes

It looks like there are two ways to produce the borders we need for the graffiti shapes. See the following hand drawing for an example.


* The first shape can be reproduced in the program by drawing the background shadow (of a bit larger scale - example and/or a bit displacement - example) first, before drawing the foreground shape. The screenshot below shows the existing code manages to work for both cases.




Align Center

TODO: In long term, I would like to extend the DrawingModule code, and provide an interface InvokeDrawingModule(ModuleName, Scalew, Scalex, Scaley, Offsetx, Offsety) to allow arbitrary offset, scaling and rotation before using the drawing module.

* The second shape can be drawn by incorporating border to line drawing, which starts from the bottom, and then goes up, takes a circular track and finally runs past the previously-drawn vertical stroke. However, I don't prefer this approach as it does not mimic the way graffiti shapes are drawn. If the purpose of the program is to teach how graffiti is drawn, this may not be a good way to go.