Re: [NTLK] How to add pictures to NTK project?

From: Matt Howe <matthowe_at_comcast.net>
Date: Sun Dec 21 2008 - 09:39:50 EST

I've not used NTK on a Mac but I have used pictures in a Win NTK project.
Before I drop that code on you though, I copied this out of the
documentation for GPSMapping Lite on how to import bitmapped images into a
mapping project. This should be the same process you would use to bring an
image into any Mac NTK project.

For importing images there are two functions within the Newton Toolkit,
called
GetPictAsBits and MakePixFamily.
GetPictAsBits is available since version 1.0 of NTK. It supports only b/w
PICT
resources with one bit per pixel.
MakePixFamily is a new function introduced with version 1.6.4 of NTK. It
supports
PICT resources with either 1, 2, 4 or 8 bits per pixel.
First the PICT resource file must be opened by calling:
rf := OpenResFileX (HOME & "myFile.res");
Then the PICT resource can be read in by either calling:
BMAP_1 := GetPictAsBits ("Resource-Name", NIL);
or:
BMAP_1 := MakePixFamily ("BW_Resource", NIL, "Gray_Resource");
In addition to the grayscale image Gray_Resource you may also specify the
b/w
image BW_Resource for MakePixFamily which will be used for displaying the
map on
a MP100,110,120 or 130 (be aware of the additional memory requirements). If
you
don't specify a b/w image you must replace "BW_Resource" with NIL.
The last step is closing the PICT resource file by calling:
CloseResFileX (rf);

I hope this helps.
Matt (Ducky) Howe
Owner of a MP2000U and an Emate
SantaMatt@Gmail.com (Nokia N770)
matthowe@comcast.net (Desktop)
http://home.comcast.net/~mhowe41/

Steffen Bendix wrote:
<snip>
I've just started to program for the Newton with the Newton Toolkit
1.6.3b (NTK) for Macintosh. I work with the book "Programming for the
Newton". In one chapter I have to add two picture files to my project
but my files are not recognized by NTK. What format do I have to use?
I took PICT but other formats don't work, too. I tried it with running
NTK in SheepShaver and native in MacOS 9. Any suggestions?
<snip>

====================================================================
The NewtonTalk Mailing List - http://www.newtontalk.net/
The Official Newton FAQ - http://www.splorp.com/newton/faq/
The Newton Glossary - http://www.splorp.com/newton/glossary/
WikiWikiNewt - http://tools.unna.org/wikiwikinewt/
====================================================================
Received on Sun Dec 21 09:39:58 2008

This archive was generated by hypermail 2.1.8 : Sun Dec 21 2008 - 10:30:00 EST