The PenDraw™ Manual  .   PREV  .   Chapter-TOC  .   Manual-TOC  .   NEXT  .   PenDraw-Home



3.19  SPECIALTY

This is a really important aspect of PenDraw. Yes, this chapter is long, but please read on. Not much further to go!

There are only two Specialties: Box and Default.

Think of it like this.Specialties are permanent properties of a Pic. Whereas attributes are temporary things that are applied to each different instance of a Pic.

3.19.1  BOX

You can define a Box as a frame of reference for a Pic.


Private Pic House( )
Box 25,10
...              'You can use constants as Box values
End Pic

Private Pic Cottage(Wide As Double,Long As Double)
Box Wide,Long
...              'You can use parameters as Box values
End Pic
  

Then, when drawing it you can place any corner of the box at the At attribute point. Thus you can draw things so that their right hand side lines up with the At point. or their left side but top edge, or their right side and top edge. Similarly you can specify the mid-points of the sides. This is the Box that you use with the Pp attribute. As said in Chapter 1 they are laid out like a computer numeric keypad

         7       8      9
         4       5      6
         1       2      3

Hence you can draw the cottage...


  Draw {Pp 5, At(100,100)}Cottage(60,12)
  

And its centre will be at (100,100). The origin of the axes for the cottage will be at (70,94). 100-30 = 70, and 100-6 = 94.

3.19.2  DEFAULT - GENERAL

Default attribute-list

attribute-list defines what is not to happen

ATTRIBUTEEFFECT
AtMovement around the Drawing: the Pic is positioned at Drawing Origin
ScaleScaling: the Pic has a scale of 1.0 with respect to the Drawing
TurnAny rotation at all: the Pic aligns exactly with the Drawing axes
OverturnRotation beyond +135 degrees and below -45 degrees: the Pic will be allowed to rotate up to 135 degrees and down to -45; if it is rotated beyond that it will be 'flipped' 180 degrees (this is mostly used to keep text 'readable')
MirrorMirroring: the Pic is not mirrored with respect to the Drawing, if it would be mirrored, it is reversed to make it un-mirrored
PenChange of line-style (e.g. to dashed lines): lines will be drawn in the default style for the Drawing, usually solid
FillAny fill colour, or rule: the Pic will have the default fill and rule for the Drawing has, usually no fill
FontAny change of font from Drawing default: the Pic will have the default Font that the Drawing
MouseAny use of any Pointer: the Pic or its Pen lines will have the same ability to be picked out as the Drawing (typically none)

For example


Default Scale,Mirror,Turn
  

forbids PenDraw, when drawing the Pic to which this pertains, to take any notice of the attributes that prescribe SCALEing MIRRORing or TURNing. So you can define graphical entities that are protected against user accidents. You might use the above combination for notes that you put onto a drawing. You wouldn't want them to be scaled, even if the thing that they are part of was scaled. Likewise you may not want them to be drawn mirrored or rotated.

Accidental MIRRORing can at best make nonsense of some Pics and at worst give a meaning that was not intended. With Default you can ensure that the Pic always has the meaning you want and looks the way you want it to look.

Default properties have to apply to an attribute-type, not to attributes themselves. For there is often more than one way of achieving the same result. Xmirror and Ymirror both result in mirroring. But Default Mirror prevents both.

All Default properties stop something from happening to a Pic. They stop an attribute from affecting the Pic. It is not a mistake to try: for example, it is not a mistake to try to rotate a Pic that has the Default Turn property : Default is a safeguard, not a trap. It causes no errors. It merely stops the effects of attributes.

3.19.3  DEFAULT - LEVELS & DRAWINGS

Default stops certain attribute-types from having their normal effect. The context of a Default is its Drawing. If PenDraw is not allowed to rotate a Pic, then it keeps that Pic's x-axis parallel to the x-axis of the Drawing in which it occurs.

Default restricts freedom: of the 'outside world' of lower Levels, not of the Pic which it makes special. Default Pen, which prevents pen-changes, does not prevent you from changing pen within its Pic; however it does stop an attribute from a lower Level deciding which pen will be used. (It stops accidents and prevents mysterious and hard-to-debug side-effects.)

Or take Scale and characters. If you want your characters to be drawn at a particular height whatever the scale of the rest of your picture, you can define the Pic-that-draws-the-characters to be unscaleable (Default Scale). Any setting of Scale within the Pics that use it will have no effect on the size of character that it produces. But within the Pic itself you are perfectly entitled to Scale it all you want.

3.19.4  DEFAULT & BOX

Default for geometric use (Mirror/Turn/OverTurn) is strongly linked to Box, to be meaningful and useful. PenDraw tries to keep the Box in the 'right' place, and then makes sure that the contents obey the Default. This has a different meaning for Default Mirror/OverTurn than for Default Turn.

For Mirror/OverTurn, what PenDraw does is to 'transform' (i.e. Mirror or OverTurn) the Box exactly according to the attributes, which gets the BOX into the right position (the same position as if there were no Default). Then it will switch the contents of the BOX around to conform to the Default specification, so that they look right. Strictly speaking it switches the PPs around to conform to the Default specification.

For Turn, PenDraw is not allowed to rotate the BOX at all. So it positions the Pic with the right PP at the right place, and then draws it at angle zero to the axes of the Reference Level.

3.19.5  DEFAULT & BOX & PP

Default At Turn and Scale

Now all these three have been introduced, we can discuss them together. There are five relevant Defaults to consider, but three are very straightforward and are dealt with first.

If you Default SCALE then PenDraw omits the scaling step. So your Pic is not scaled.

If you Default Turn, then PenDraw omits rotating step. So your Pic appears with its axes parallel to those of the Drawing.

If you Default At, then PenDraw omits the positioning step, So your Pic is positioned At the origin of the Drawing.

Default Xmirror Ymirror and OverTurn

The first thing to realise about these attributes is that they do not cause the Box position to change, but they do affect the contents: so your Pic occupies the same space, but may be turned round, 'de-mirrored', or whatever is appropriate.

The position of the BOX is exactly the same as if you had not ascribed the attribute, and you can therefore predict its position exactly.

The rationale for complying with your Default is actually quite simple, and is of course logical. It follows a precise sequence. PenDraw deals FIRST with Default Mirror, and SECOND with Default OverTurn. And to see what PenDraw does, you simply have to imagine that it switches the PPs around, and possibly changes the orientation by 180 degrees ,before actually drawing the Pic.

If your Pic is being x-mirrored and you have Default Mirror, Pp 1 becomes Pp 7 as we now explain...

The x-mirror causes the Pic to be mirrored about the x-axis so its y-coordinates are reversed: its top becomes its bottom and vice versa. Now if PenDraw prevents the mirroring, it will flip the Pic back round the right way, but to keep the Pps in the right place it has to swap the Pps top to bottom, so Pp 1 becomes Pp 7 (and vice versa), Pp 2 swaps with Pp 8, Pp 3 swaps with Pp 9. Similarly, if there had been a y-mirror, PenDraw would swap the Pps around the other way, so that Pp 1 swaps with Pp 3, Pp 4 with Pp 6, Pp 7 with Pp 9.

There is yet another swapping pattern for 'overturning'. We give the swapping 'maps' below.
To de-YmirrorTo de-XmirrorTo de-OverTurn
1     31     71     9
2     22     82     8
3     13     93     7
4     64     44     6
5     55     55     5
6     46     66     4
7     97     17     3
8     88     28     2
9     79     39     1

Please note that an Xmirror does not necessarily lead to the left-hand column 'de-mirror-x'. If you think about it, these two attribute combinations are the same


Xmirror, Turn 180
Ymirror
  

It all rather depends upon the final angle of the Pic, to the Drawing axes. The point is that PenDraw gets it right -- so your picture ends up as you would think it would.

The mapping for Default OverTurn depends upon the final angle of the Pic to the Drawing axes. OverTurn and Mirror effects are now covered by example in the following figures. We show 4 different Pics with different Default combinations, and put them through six different attribute combinations (two different angles, with and without Xmirror and Ymirror).

These are the Pics used to show the effects:-


Public Pic Note(S As String) 'In SYS Album

Private Pic Ordinary()
Box 20,10
  Pen To X 20,To Y 10,To X 0,To Y 0
  Draw {} Chars("Ordinary") 
End Pic

Private Pic NonMirror()
Box 20,10
Default Mirror
  Pen To X 20,To Y 10,To X 0,To Y 0
  Draw {} Chars("NonMirror")
End Pic

Private Pic NonOverturn()
Box 20,10
Default OverTurn
  Pen To X 20,To Y 10,To X 0,To Y 0
  Draw {} Chars("NonOverturn") 
End Pic

Private Pic NonOverturnNonMirror
Box 20,10
Default Mirror,OverTurn
  Pen To X 20,To Y 10,To X 0,To Y 0
  Draw {} Chars("NonOverturnNonMirror")
End Pic
  
Draw {Turn 30}
Ordinary() &
NonMirror() &
NonOverturn() &
NonOverturnMirror()


FIGURE 3-48
___________________


Draw {Turn 150}
Ordinary() &
NonMirror() &
NonOverturn() &
NonOverturnMirror()


FIGURE 3-49
___________________


Draw {Turn
30,Xmirror}
Ordinary() &
NonMirror() &
NonOverturn() &
NonOverturnMirror()


FIGURE 3-50
___________________


Draw {Turn
150,Xmirror}
Ordinary() &
NonMirror() &
NonOverturn() &
NonOverturnMirror()


FIGURE 3-51
___________________


Draw {Turn
30,Ymirror}
Ordinary() &
NonMirror() &
NonOverturn() &
NonOverturnMirror()


FIGURE 3-52
___________________


Draw {Turn
150,Ymirror}
Ordinary() &
NonMirror() &
NonOverturn() &
NonOverturnMirror()


FIGURE 3-53
___________________


End of chapter


PREV  .   Chapter-TOC  .   Manual-TOC  .   NEXT  .   PenDraw-Home



Level Triple-A conformance icon, 
          W3C-WAI Web Content Accessibility Guidelines 1.0