news |
info |
people |
software |
stuff |
Pollocks XCMD. Version 3.2d3, by Sam Deane. Copyright ©1994 ULTRALAB. Compiled 15:53:43, 06/12/94. Debugging code included.
What resulted was an XCMD called DrawPICTs, which allowed you to paint PICT resources directly on to the card window. It worked, but looking back at the code I'm not sure how or why, since it was complete gibberish which broke every rule in Inside Mac!
Now that Hypercard 2's picture command exists, along with a whole load of clever stuff like Colourize Hypercard, HyperTint, and Ken Doyle's QTPict XCMD, there are rather more options available.
Nevertheless, DrawPICTs (now called Pollocks) has hung around, been improved now and then, and proven to be useful enough to get included in a number of our products.
In addition to displaying PICT resources, it now allows you to do basic PICT animations, to paint coloured shapes all over the place, and to fudge around with the clip region of hypercard's window.
A partial solution to this problem is to tell hypercard not to draw into the areas of the window that contain pictures. This can be done by modifying the window's clipping region.
The clipping region determines the area of the window into which hypercard can draw. Normally the clipping region covers the whole card. With the add, subtract and reset commands it is possible to modify the clipping region of the current card window, so that rectangular areas of the window are removed from it.
The remove command removes rectangles from the clip region, effectively masking out areas of the window. The add command puts areas back in.
The reset command can be used at any time to reset the clip region to its normal value, covering the whole of the window.
Æ NB: Removing an area from the clip region only prevents Hypercard from drawing into that area, it does not prevent the area from being obscured by another window (for example a palette window). When an obscuring window is removed, a white space will be left in it's wake. Hypercard will not be able to redraw your picture (since it doesn't know about it), and it won't even be able redraw the card graphics that it does know about (since you have prevented it from drawing into that area of it's window!).
To avoid this problem, it is best to clip out any pictures just before doing something that is likely to obliterate them (going from card to card for example) and to restore the clip region as soon as possible afterwards.
The syntax is:
Pollocks draw,<name>,<left>,<top>
The <name> parameter should contain the name or id of a PICT resource somewhere in the current inheritance path.
The <left> and <top> parameters should contain the coordinates of the top left corner of the PICT. The picture will be displayed at this location in the window of the current stack. It will be clipped by the current clip-region of the card window.
on mouseDown Pollocks draw,"test",140,0 ClearWhenClicked end mouseDown
It has the following syntax:
Pollocks list,<picture> { ,<picture> {,...etc }}
where <picture> is a single item in the form "<name>,<left>,<top>".
The <name> parameter should contain the name or id of a PICT resource somewhere in the current inheritance path.
The <left> and <top> parameters should contain the coordinates of the top left corner of the PICT. The picture will be displayed at this location in the window of the current stack. It will be clipped by the current clip-region of the card window.
on mouseDown Pollocks list,"test,140,0,test,140,100" ClearWhenClicked end mouseDown
The syntax of the command is:
Pollocks sequence,<name>,<left>,<top>,<frames>
This is the same syntax as the draw command, but with one extra parameter. The <frames> parameter should be a number saying how many frames there are in the PICT sequence.
The command will display the pictures "<name>1", "<name>2" ... "<name><frames>" in turn, producing a basic animation. Note that the speed of this animation is totally dependant on the hardware, which is not a good thing. For more sophisticated animation, it would be best to get into Quicktime.
It has the following syntax:
Pollocks into,<name>,<rectangle>
The <name> parameter should contain the name or id of a PICT resource somewhere in the current inheritance path.
The <rectangle> parameter specifies the exact rectangle into which the picture should be drawn. The picture will be scaled as necessary to accomplish this.
on mouseDown Pollocks into,"test",the rect of bg fld "text" ClearWhenClicked end mouseDown
The syntax of this commands is:
Pollocks add,<rectangle>
where <rectangle> is the rectangle to add/remove from the clip region.
The syntax of this commands is:
Pollocks subtract,<rectangle>
where <rectangle> is the rectangle to add/remove from the clip region.
The syntax of this commands is:
Pollocks reset
The syntax is:
Pollocks foreground,<colour>
where <colour> is one of: black,white,red,green,blue, cyan,magenta,or yellow.
on mouseDown put "black,white,red,green,blue,cyan,magenta,yellow" into cols get Poppet(items,cols,0,the topLeft of the target,comma) if it 0 then Pollocks foreground,item 3 of it end if end mouseDown
The syntax for this command is not fixed yet, but is currently:
Pollocks rect,<rectangle>,<colour>,<size>,<mode>
The <colour> parameter is a three item RGB colour in the format "<red>,<green>,<blue>".
The <size> parameter is a number determines the thickness of the lines used to draw the rectangle. If "fill" is specified, instead of a number, the rectangle is filled.
The <mode> parameter is a number which specifies the Quickdraw pen mode to use when painting the rectangle. If "hilite" is passed, the special hilite mode will be used, which will result in a rectangle painted in the current hilite colour.
on mouseDown -- outline the section field Pollocks rect,the rect of bg fld "section","20000,20000,20000",5,srccopy -- hilite the text field rectangle Pollocks rect,the rect of bg fld "text","10000,0,0",fill,hilite ClearWhenClicked end mouseDown
The syntax for the command is:
Pollocks update,<rectangle>
on mouseDown Pollocks depth answer "Max depth is: " & the result end mouseDown
The syntax is:
Pollocks devices
A list is returned in the result, with one line for each screen.
The first item of each line is the depth of the screen. Items 2 to 5 give the localtion of the screen, in global coordinates.
on mouseDown Pollocks devices answer "Number of screens: " & the number of lines in the result end mouseDown
The syntax is:
Pollocks background,<colour>
where <colour> is one of: black,white,red,green,blue, cyan,magenta,or yellow.
on mouseDown put "black,white,red,green,blue,cyan,magenta,yellow" into cols get Poppet(items,cols,0,the topLeft of the target,comma) if it 0 then Pollocks background,item 3 of it end if end mouseDown
The syntax for this command is not fixed yet, but is currently:
Pollocks "line",<start>,<path>,<colour>,<size>,<mode>
The <start> parameter gives the start point of the line. The <path> parameter gives the path of the line as a series of coordinates in the form x1,y1,x2,y2,x3,y3, etc..
The <colour> parameter is a three item RGB colour in the format "<red>,<green>,<blue>".
The <size> parameter is a number determines the thickness of the line.
The <mode> parameter is a number which specifies the Quickdraw pen mode to use when painting the line. If "hilite" is passed, the special hilite mode will be used, which will result in a line painted in the current hilite colour.
on mouseDown put the topLeft of bg field "text" into tl put the botRight of bg field "text" into br repeat with n = 1 to 50 Pollocks line,tl,br,"30000,5000,5000",1,srccopy subtract 5 from item 2 of br end repeat repeat with n = 1 to 50 Pollocks line,tl,br,"5000,30000,5000",1,srccopy add 4 to item 2 of tl end repeat repeat with n = 1 to 50 Pollocks line,tl,br,"5000,5000,30000",1,srccopy subtract 4 from item 1 of br end repeat ClearWhenClicked end mouseDown
on mouseDown -- outline the section field Pollocks globalRect,the rect of bg fld "section","20000,20000,20000",5,srccopy -- hilite the text field rectangle Pollocks globalRect,the rect of bg fld "text","10000,0,0",fill,hilite ClearWhenClicked end mouseDown
The syntax for this command is not fixed yet, but is currently:
Pollocks "line",<start>,<end>,<colour>,<size>,<mode>
The <start> and <end> parameters give the start and end points of the line.
The <colour> parameter is a three item RGB colour in the format "<red>,<green>,<blue>".
The <size> parameter is a number determines the thickness of the line.
The <mode> parameter is a number which specifies the Quickdraw pen mode to use when painting the line. If "hilite" is passed, the special hilite mode will be used, which will result in a line painted in the current hilite colour.
on mouseDown put the topLeft of bg field "text" into tl put the botRight of bg field "text" into br repeat with n = 1 to 50 Pollocks globalLine,tl,br,"30000,5000,5000",1,srccopy subtract 5 from item 2 of br end repeat repeat with n = 1 to 50 Pollocks globalLine,tl,br,"5000,30000,5000",1,srccopy add 4 to item 2 of tl end repeat repeat with n = 1 to 50 Pollocks globalLine,tl,br,"5000,5000,30000",1,srccopy subtract 4 from item 1 of br end repeat ClearWhenClicked end mouseDown