Recent Changes - Search:

Home Pages Pidgin   Azarennya (S|N) Mac Thesaurus Reference ToDo Colino Food Local

Blogs: BadIdea Rachel RIAA Cult: Clambake Infidels Fi: Arda StarTrek Trek/Wars Film: IMDB D Harry Jabootu Kyle Fun: Agony ICanHas? ObSkills Snopes Lang: ZBB Vreleksá AwkWords Omniglot Scriptorium More... Local: Maps Map MyWeb Metro (map) FC Weather GoWhere? GGWash DC Arlington Reston Beyond Bacon Pix: Deviant Places Renderosity Blender Artists Pol: Anchoress Lizards Lucianne Strata WAwakes Sci: SmallThings Darwin AntiEvo Skeptics EvC BAUT Physics /.Sci Junk Panda Pharyngula Mags AmSci NatG Space X86: OSX86 ArsTech OSNews TUAW Dev PowWeb PHP Webmaster Coding Walkers Prog: PHP JS Toolbox Unobt Compress RegExp (test) Lint SQL Cocoa Builder Dev Apple BBS Userland Faqin

Science/Tech: Engadget Thunderbolts Icecap Centauri NewSci Gizmodo co2sci ClimateDebate SciDaily Nrich NatGeog Math CreatClaims GoodBadMath

CurrentEvents: OrigSig Flamingo FlopAces ImmigProf ~J~ MyVRWC NewsGroper Pal2Pal Sanity Simon TCS Toldjah Blogs...

Tools: Calculator AsciiArt XMLVal

FunStuff: Pictures: Photobucket (eg Dubai) Videos: YouTube Subtitler

InterestingThings: LibraryThing FlashCards GoogleDocs Wowio Bubbl.us Colemak Audible PodioBooks WonderfulInfo BooksOnline AboutUs.org

Logo

Projects: Calligrabot

I've just downloaded Logo from Softronix. It will do everything that Gliffer would have done. Making the glyphs in Logo will be more work than they would be in Glyphmaker or Gliffer, but then (1) I'm no longer subject to Glyphmaker's limitations, and (2) I won't have to write and debug Gliffer before I start creating glyphs. I just have to get accustomed to using Logo.

MswLogo (as the application is called) lets me issue commands to move the turtle (pen) around on the screen, change its angle, change the color and thickness of the pen's strokes — and then save the resulting bitmap to disk as a file. (I just confirmed this by opening the bitmap in Paint.) NOTE: The size of the canvas is apparently limited to 1000 x 1000 pixels.

To do

  • Experiment with curves, e.g., repeat 180 [fd 1 rt 1], then adjust the numbers.
  • Experiment with complex lines, i.e., those requiring more than one loop to finish.
  • Work on different brush shapes: smaller ellipsis, ellipses at different angles, circles and more circular ellipses, rectangles of differing widths and angles, etc.
    • The following ellipse settings work: n 1 (if n > 1 and n < 8), n 2 (if n > 1 and n < 13), various n up to 20. The following settings don't work: 1 1 (the fill misses and fills up the whole screen), n 1 (if n >= 8, the wide strokes are "spotty" and not completely black).
    • Work on procedures for each kind of brush: elliptical_brush [angle maxwidth minwidth] and rectangular_brush.
  • Experiment with anti-aliasing, i.e., draw lines slightly wider and partway between the foreground and background color, then switch to the foreground color and draw the "real" lines.
  • Work on procedures for drawing shapes of different sizes.
  • Work on standards for where the baseline is, where the ascender and descender lines are, how big brushes should be, how big glyphs should be, etc.

Code

to demonstrate_brushstrokes

	make_elliptical_brush 1 30 15 4

	; Paste the brush repeatedly to create brushstrokes.
	for [i 30 360 30] [home rt :i repeat 300 [bitpaste fd 1]]
end

to get_brush_start :maxwidth
	output (-2 - :maxwidth)
end

to make_elliptical_brush :buffernumber :angle :width :thickness

	; Create the brush.
	cs pendown setpensize [1 1] setfloodcolor pencolor
	lt :angle ellipse :width :thickness fill

	; Move the brush into the buffer.
	setbitindex :buffernumber
	setbitmode 3
	localmake "coord get_brush_start :width
	localmake "size :coord * -2
	penup setxy :coord :coord bitcut :size :size cs
end

Techniques

Anti-aliasing

MswLogo draws jaggy lines, but that's OK. Maybe I can figure out how to make anti-aliased lines by drawing with a thick light-gray pen, then with a thinner but darker pen, and so on, until I finish with a thin black pen. Even better: An anti-alias function to which you pass the name of another function, the foreground (pen) color, the background color, and the desired pen thickness, and it will figure out what in-between colors and thicknesses to use for the pen, and will call the function several times in order to draw the line perfectly.

Painting with a bitmap

You can use Logo to create a "brush" (black shape on a white background), then use BITCOPY to copy the brush, clear the screen (CS), and specify transparent-background for pastes (SETBITMODE 3). In a loop, move the turtle to where you want the bitmap's lower-left corner to be pasted, and BITPASTE. Keep moving and re-pasting the "brush" until you have the shape you want. (Now I just need to try this to see how fast or how slow this technique is.)

Commands that seem to work well in creating brushes:

  • cs pendown setpensize [1 1] lt 30 ellipse 15 4 setfloodcolor [0 0 0] fill penup fd 20

Update: The following command clears the screen, creates a brush, copies it to a buffer, and pastes it repeatedly to create twelve strokes in a star arrangement.

; Create the brush.
cs pendown setpensize [1 1] setfloodcolor [0 0 0]
lt 30 ellipse 15 4 fill
;
; Move the brush into the buffer.
setbitindex 1 setbitmode 3
penup setxy -16 -9 bitcut 32 18 cs
;
; Paste the brush repeatedly to create brushstrokes.
for [i 30 360 30] [home rt :i repeat 300 [bitpaste fd 1]]

Logo specifics

Commands are shown here in all caps, but Logo is case-insensitive.

  • To assign a value to a variable: MAKE "variablename [some string] — means that "SHOW :variablename" outputs [some string]. (Note: MAKE creates global variables. Mark local variables as LOCAL or use LOCALMAKE.)
  • Flow-control statements: FOR [var startvalue endvalue increment] [list-of-instructions], IF :x = :y [run-if-true] [run-if-false]. There is DO.WHILE, DO.UNTIL, and FOREACH.
  • Use LABEL to put text onto the screen (but use RT to ensure the text is horizontal, and SETLABELFONT
  • Use BITSAVE to save the screen to disk as a bitmap. Use SETACTIVEAREA to determine how much of the screen is saved.
  • Use SETBITINDEX to copy and paste using any buffer between 0 and 1023 (buffer #0 is the Windows clipboard).
  • When writing a function with TO, use OUTPUT to return both control and a value to the caller. (The value can be either a word or a list.)

Calligraphy???

I just read that calligraphy should not be too even, that each letter should be slightly different from all other instances of the same letter. I think that's actually doable (well, simulatable) in Logo — add a small but random variation to each of the parameters of each stroke: its length, its angle, maybe even the brush shape. (Logo offers 1023 bitmap buffers. I might use some of those to have very slight variations of the basic brush shape, and randomly switch the BITINDEX, maybe even in mid-stroke.)

Edit - History - Print - Recent Changes - Search
Page last modified on December 06, 2006, at 09:49 AM