Re: [NTLK] Clip art?

From: Michael J. Hu▀mann <>
Date: Sun Apr 19 2009 - 21:01:54 EDT

Andy Hill ( wrote:

> When you say it is also fairly easy to make your own using NTK, how easy
> would that be for a complete novice?

You don't really have to write any code, merely adapt a template. For
example, once you have created a resource file containing the clip art
as named PICT resources (using Rezilla, for example), you write a script
such as this:

OpenResFile(Home & "MyStamps.rsrc");

DefineGlobalConstant('kStampArray, [
        MakePixFamily (nil, nil, {rsrcSpec: "My first stamp", bitdepth: 4}),
        MakePixFamily (nil, nil, {rsrcSpec: "My second stamp", bitdepth: 4}),
        MakePixFamily (nil, nil, {rsrcSpec: "My third stamp", bitdepth: 4})


InstallScript := func(partFrame, removeFrame)
        local viewDef := GetViewDefs('drawPaper).default;
        local sym := EnsureInternal(kAppSymbol);
        if viewDef then viewDef:?RegStamps(sym, kStampArray);

RemoveScript := func(removeFrame)
        local sym := EnsureInternal(kAppSymbol);
        local viewDef := GetViewDefs('drawPaper).default;
        if viewDef then
                        local registry := GetViewDefs('drawPaper).StampListRegistry;
                        if registry AND HasSlot(registry, sym) then RemoveSlot(registry, sym);

You can ignore most of this; just copy the code into a text file and
edit the first few lines: insert the name of the resource file
("MyStamps.rsrc" in this case) in the first line and the names of the
stamps ("My first stamp", "My second stamp", and "My third stamp") in
the following lines -- these are the names of the PICT resources in the
resource file. You can define as many (or as few) stamps as you wish
here. The rest of the code will be the same for any set of stamps and
can thus be left as is. The bit depth here is 4 (for 16 shades of grey),
but it could also be 1 (b&w). Now open NTK, create a new project, add
the resource file and the script file to the project, and compile it
into a package of type "auto part". That's all there is to it, basically.

- Michael

Michael J. Hu▀mann

WWW (personal):
WWW (professional):

The NewtonTalk Mailing List -
The Official Newton FAQ -
The Newton Glossary -
WikiWikiNewt -
Received on Sun Apr 19 21:02:06 2009

This archive was generated by hypermail 2.1.8 : Mon Apr 20 2009 - 18:30:00 EDT