Bob Arning arning at charm.net
Fri Jun 29 12:46:08 UTC 2001


On Fri, 29 Jun 2001 01:12:09 -0700 Ross Boylan <RossBoylan at stanfordalumni.org> wrote:
>If I want to make a little icon, what's the best way to do it?  Can it be 
>done with the internal painting tool?

There are several possible ways:

1. Use the normal painting tool (the paintbrush on the navigator or "make a new drawing" from the new morph menu). When you "keep" the painting, you will have a SketchMorph which you can inspect or explore to get to the Form that you just painted. From the explorer or inspector, write a simple bit of code to put that Form somewhere (like ScriptingSystem or elsewhere) for future use. Or you can print "self storeString" when inspecting the form to get actual code you can put in a method.

2. Use the fat bits tool as Karl suggests. Do something like
	(Form extent: 32 at 32 depth: 16) bitEdit
There are lots of useful tools in the red halo menu. When you are done, use "inspect" from this menu to get at the Form and use one of the techniques from above to save it for posterity.

3. Sometimes it seems easier (at least to geeks like me) to create it programmatically. Here is a stop button for a vcr controller widget:


	 | f aButton |

	f _ Form extent: 24 at 15 depth: 32.
	f fillColor: Color gray.
		fill: (f boundingBox center - (4 at 4) extent: (8 at 8)) 
		rule: Form over 
		fillColor: Color white.
	aButton _ IconicButton new borderWidth: 0;
			labelGraphic: f;
			color: Color gray; 
			actWhen: #buttonUp;


#1 makes for easy painting, but is sometimes difficult to do precise work in smaller sizes. Also, if an exact image size is important, this is extra work.

#2 allows for fine control at the pixel level, but it's tougher to do larger objects like circles, etc.

#3 requires some coding expertise, but can produce very precise images when they can be described in terms of lines, rectangles, etc. An additional technique to use here is to draw the thing at 2x or 4x initially and then reduce the final image using WarpBlt. This will anti-alias the edges and can produce a nice clean image in small sizes.

>I have a hazy recollection of seeing a recommendation to use an external 
>paint program and then importing the result (into one of the image or 
>button morphs?).

You can certainly do that. Squeak can read GIF, JPG, BMP, PNG and perhaps others I have forgotten. Once you have it in Squeak, techniques like those above can copy all or part of the image for use in your UI.

>While poking around I found the forms dictionary in Scripting System.  Can 
>anyone tell me if the code that populates it is in the system, or are we 
>left only with the artifact?  (I found some code for a few items, but not 

I think the general practice is to include the code that adds things to ScriptingSystem as a postscript to a changeset. That way the code does not need to be kept in the system forever (it would essentially be a duplicate in terms of space).


More information about the Squeak-dev mailing list