PenDraw™
|
|
Home More On PenDraw SVG?? PenDraw Features The Road Ahead |
PenDraw Features
PrinciplesCoherent LanguagePenDraw is a coherent graphics language. It is based on strong principles. And all of its facilities derive from those principles: PenDraw does not need 'kludges' to make things work. Where other graphics packages work at the physical level of matrix math, PenDraw operates at the conceptual level. PenDraw operates in terms of intuitive attributes. Draw {At (50,150),Turn 30, Scale 0.5} Table(600,2000) is an example of PenDraw code. The table is positioned AT a point whose coordinates are (50,150), at an angle of 30 degrees, and a scale of 0.5. Smooth Change of Axis SystemsStrictly, what happens in a Draw instruction is called a change of axis system: it starts with one axis system, then whenever it gets a Draw instruction it changes the axis system to what you tell it. The great thing is, though, that after Drawing something, it puts the axis system back to exactly what it was before the Draw instruction. That eliminates many side-effects and bugs that you get from other graphics systems. Strength Through StructureWhen other graphics systems offer you an 'upstack/downstack' mechanism, they provide it through procedure calls or method invocation: that means that if you make a mistake, eg leave out a downstack, the whole picture goes wildly wrong. Yet the ordinary language compiler can not tell you of your mistake. That kind of error is impossible with PenDraw because the PenDraw compiler would give you an error message. And errors eliminated at compile time save you time and money. Why try to find one missing line in a few thousand, when the compiler can point it out for you? How do Attributes Combine?Attributes combine just as you would imagine. If the Table, above, has a line: Draw {At (200,50)} Placemat( ) : then PenDraw will calculate the position of the Placemat taking account of the position and angle of the table, automatically. It will change the axis system again (and restore it afterwards, again). Whatever you do, PenDraw works out the detail. You just tell it what you want it to do. Attributes Can be ControlledYou can instruct PenDraw not to allow a particular attibute to affect something. You just include a simple instruction and leave it to PenDraw. If you say Use Drawing Scale, for example, PenDraw will not allow any scaling to affect the item. Likewise for At, Turn, etc. How might this be useful? Well you might be drawing something using dotted lines, and then want to add something that must be drawn using solid lines. Attribute Control lets you do what you want to do. Actually there are lots of cases when you want attribute control. Test is usually a 'kludge' in other graphics systems. Because it has to be readable - for example it must not be mirored (left-to-right), nor must it be scaled too small or too big. Other systems just handle this behind the scenes. With PenDraw, it is part of the language. You can say Use Drawing Scale, Mirror, and then specify characters that are 3mm high. PenDraw will draw them 3mm high - no matter what the scale factor is currently - and will not allow them to be mirrored, whether or not your current view involves mirroring. Correct Graphics Parameter HandlingPenDraw keeps parameter values the same, even across different axis systems. If you pass a point on the table to the placemat, that point will have different coodinates in the placemat, to those it had on the table, because they have different axis systems. PenDraw automatically changes the coordinates, so the point stays in the same place. In non-graphical languages, this simply can not be achieved, because they always pass parameters with the numeric values unchanged, not with the geometric values unchanged. This is truly valuable. In other systems, if you want to use points (or lines, circles etc) in different axis systems, you have to do the matrix math, and calculate geometry for yourself. In PenDraw, you can have the data as you need it. Again, this saves time and money: time because you do not have to write the code to mimic the matrix math, time because you do not have to debug it either, and money because time is money! Programmer ProductivityPenDraw was designed out of frustration with all the 'procedure packages' that are offered as facilities to programmers. Procedure packages have many weaknesses.
If you have programmed graphics before, that will all sound familiar. Well, PenDraw was designed to get round all that (and more), so that it is productive for you. And we have found PenDraw very productive. PenDraw can be over ten times faster than other ways of programming graphics. Main Language FeaturesLike Basic Syntax, but
TypesStrict type checking Graphics Types
Non-Graphics Types
Functions / OperatorsThere is a rich set of Graphics Functions and Operators for calculating intersections, tangents etc. Input/Output
Major Code Structures
If Instructions
AttributesNormal
Client-side Events: for graphic entities
Client-side Events: for picture
Skewing? No.You may notice that we don't do skewing of axes (eg the Y-axis at 70 degrees to the x-axis. This is deliberate. It is a mistake to put it into the graphics capability. Skewing is about transforming data, and should be applied to data as a separate stage before you start drawing. Old 2-D graphics facilities added skewing because it was really easy to add it to the matrix algebra. To those old hands it seemed a neat trick. It was a mistake. Just because we can, does not mean we should. You won't miss it. No-one ever used it except to draw italic/oblique characters, and we now know that they are much better provided through proper fonts. |
Copyright © 2004 PenDraw Limited. All rights reserved.