Here you will find great tips for programming with the Windows version of the Newton Toolkit....

If you are a Windows NTK developer and/or know of some great tips, help pass them along by sending me an e-mail....


Tip # 1

Using Bitmaps as constants

When using bitmap graphics on the mac side, they mostly use PICT format pictures and use the GetPictAsBits(file,maskfile) function... On the win side we mostly use .BMP files...If you are loading black and white maps, the most efficient use is to use the GetBMPAsBits(file,maskfile) function. You can replace the maskfile with NIL if you have none. Using GetBMPAsBits will save space and be compatible between both 2.0 and 2.1 users... If you are building for the 2x00 or the emate and have the need for higher bit depth bitmaps then you will need to use the following function:

BuildPictureViewSlot( {

imageFile1: file,
imageFile2: file,
imageFile4: file,
imageFile8: file,
maskFile: maskfile,
maskOption: 0,
}),

This function works very much like the visual interface of defining an icon in WinNTK... the # in the imageFile# is the bit depth (2,4,16,256 colors)... you may remove any of the imageFile# lines that you would have set to none in the NTK browser, and set the maskfile to NIL if you have none...the maskOption is a number 0,1,2,3 just like the choices in the NTK browser: 0 is No Mask, 1 is Use Picture, 2 is Use XOR, and 3 is Calc Mask....

It is important, if you plan on having NOS 2.0 users (mp 130 or less) use your stuff you must have the image1 and image4 slots or they will see only black!!! If its only for 2.1 users you can skip the image1 slot.


Tip # 2

Loading Sounds as constants

The first trick here is not to listen to what it says in the manuals that apple gave ya...the functions GetWAVsound(file) and GetWAVsound11 (file) never seemed to work for me....it would load the sound into a frame, and I knew it was there via the inspector, but it would never play... what did work were the following functions GetWAVAsSamples(file) and GetWAVAsSamples11(file).....this function will return a sample to use in a sound frame and a constant can be defined like this:

DefineGlobalConstant( 'kMySound, {

sndFrameType: 'simpleSound,
samples: GetWAVAsSamples(file)
} );

...that's for a 22K PCM .wav file....if you have to use 11k PCM files use the following:

DefineGlobalConstant( 'kMySound, {

sndFrameType: 'simpleSound,
samplingrate: kFloat11kRate,
samples: GetWAVAsSamples11(file)
} );


Tip # 3

Using Kagi Register program

If you need to use the reg program by Flash Sheridan, I have rewritten the sample RegTest code using WinNTK.. use these files as an example.. sorry WinNTK format only!! :) If you need the Mac version you will need to get it from Hardy Macia of Catamount Software. The public user version can now be found at his FTP site..


Tip # 4

Works Draw Stationary Example

Thanks to Tall Hill for an easy example of making a Works stamp set... you can download the WinNTK verion that I made here....


This page was last updated 6/18/98