These external commands deal with a special color window on top of the HyperCard window. All drawings can be performed in any screen depth resolution and in dithering mode or with use of color lookup tables. Mouse events in color window are sent to HyperCard.
Requirements:
Mac II, Centris or Quadra with system 7.0 or more recent.
HyperCard 2.0 or more recent.
For 8 bit depth pictures set memory of HyperCard to 2 Mo.
For 32 bit depth pictures set memory of HyperCard to 5 Mo.
See Technical Documentation for special inits of globals, name of
externals windows...
Special Thanks for external commands used in demo stack :
See HINTS for special inits of globals, name of special windows, script for correcting a bug in HC 2.2...
Copy required XCMD and XFCN from the Color XCMD demo stack to your stack with a resource editor or add in your OpenStack script
- start using stack <the long name of your Color XCMD copy demo stack>
Globals:
- pixmode set to "clut"(only with 8 bit depth or lower) or "dither" for the selected display mode
- textname in case of editing field for storing the text field name
Name of special windows:
- colorwin for the color window. For explicit closing use hypertalk command:
close window "colorwin"- textwin for the text field window. For explicit closing use hypertalk command:
close window "textwin"Special event:
- CloseEnterfield sent when closing the text field window. This event can be used for redrawing the field place on the color window.
By example:
- on closeEnterField
global textname
ink on,0,221,221,221,the rect of textname
text textname
end closeEnterFieldCreation of the color window:
- by InitColor which must be first called
Special handler in stack script with HC version 2.2:
--- this handler for avoiding a new bug in HC 2.2 (corrected in 2.3)
- on mousedoubleclick
send mouseup to the target
end mousedoubleclick--- this bug disappear in 2.3 version after I send a bug stack to the HC developement team
Pict longfilename,on/off,effect[,rect[,option]]
PictRes PICTresID,on/off,rect
where:
Example:
PICT "DD:diapos:photo1",on,7,the rect of card button "Photo"
Clut longfilename[,eraserect]
where:
Example:
CLUT "DD:diapos:photo1",the rect of card button "Photo"
N.B.: CLUT is only useful for screen depth equal or lower to 8 !
InvertCRect rect
Ink on/off,effect[,r,g,b[,rect[,pat]]]
DrawBorder on/off,rect[,r,g,b[,pat]]
WinDraw [rect[,effect]]
where:
InverCRect draws a rect in inverse colors
Ink fills a rect with black or the specified color with a
pattern n° pat
DrawBorder draws a black or color rectangular border with a
pattern n° pat
Windraw puts an offscreen graphics on the screen (previously
drawn off)
Text textfieldname[,on/off[,r,g,b]]
EnterField textfieldname
EnterMenuField textfieldname
where:
NB: you can close editing windows in EnterField and EnterMenuField by pressing EnterKey.
AddClut2Pict CLUTfilename,PICTfilename
SnapShot filename,rect
Depth()
RestoreCLUT
Fade in|out[,speed(0-8)[,red,green,blue(0-255)]]
where:
AddClut2Pict attachs a CLUT resource to PICTfilename by adding colors present in the CLUT of CLUTfilename to the best CLUT of PICTfilename. This XCMD allows to add few colors (16 or less) to PICT file and restricts the colors used for displaying the PICT (240 or more)
SnapShot takes a snapshot of the specified rect and stores the resulting PICT in the file named filename
Depth is a XFCN that returns the current depth of main monitor.
RestoreCLUT is useful for restoring the system color palette.
Fade for screen fading effect (don't forget to add fade out in your CloseStack handler in case of problem !)
For commercial use contact