DMM Varkon® Tutorial
A Beginner's Guide to the Varkon Parametric Modeling and CAD Application Development System
By David M. MacMillan


12.2 Show Pen Colors

The following MBS module shows a vertical stack of thick lines through a range of pen colors. Lines are displayed with the pen number on the left.

The calling syntax is:

showcolors (firstcolor, numcolors, colorspacing, colorlength);

All parameters are integers.

On my system, pens that draw on the screen seem to be circular in shape, resulting in a radius at each end of the line. However, the pens that plot seem to be lines, and there is no radius on these lines as plotted.

! showcolors.MBS   
! 
! Draw examples of all line widths
!

global drawing module showcolors(
   int firstcolor; 
   int numcolors; 
   int colorspacing;
   int colorlength
   );

   vector start, stop;
   float  x1,  y1;
   float  x2,  y2;
   float  dx,  dy;
   int    ix;
   vector textpos;

beginmodule

  dx := colorlength;
  dy := colorspacing;

  x1 := 0;
  y1 := 0;
  x2 := x1 + dx;
  y2 := 0;

  for ix := firstcolor to (firstcolor + numcolors - 1) do
     y1 := y1 + dy;
     y2 := y2 + dy;

     start := vec (x1, y1);
     stop  := vec (x2, y2);
     textpos := vec (x1 - 20, y1);
     text (#3, textpos, 0, str(ix, 2, 0));

     lin_free (#4, start, stop: width=10, pen=ix);

  endfor;

endmodule

To invoke this module to display the lines from 0 to 14 (15 lines total), use, for instance, an active module containing:

GLOBAL DRAWING MODULE test2d();
BEGINMODULE
  part(#1,showcolors(0, 15, 20, 200));
ENDMODULE

showcolors

Pens greater than the highest pen defined in the Varkon X Window System resource file default to black. In this example, pen 11 is the highest numbered pen defined.


Legal Matters

With the exception of any material noted as being in the public domain, the text, images, and encoding of this document are copyright © 1998 by David M. MacMillan.

The author has no relationship with Microform AB, and this Tutorial is neither a product of nor endorsed by Microform AB.

"Varkon" is a registered trademark of Microform AB, Sweden.

This document is licensed for private, noncommercial, nonprofit viewing by individuals on the World Wide Web. Any other use or copying, including but not limited to republication in printed or electronic media, modification or the creation of derivative works, and any use for profit, is prohibited.

This writing is distributed in the hope that it will be useful, but "as-is," without any warranty of any kind, expressed or implied; without even the implied warranty of merchantability or fitness for a particular purpose.

In no event will the author(s) or editor(s) of this document be liable to you or to any other party for damages, including any general, special, incidental or consequential damages arising out of your use of or inability to use this document or the information contained in it, even if you have been advised of the possibility of such damages.

In no event will the author(s) or editor(s) of this document be liable to you or to any other party for any injury, death, disfigurement, or other personal damage arising out of your use of or inability to use this document or the information contained in it, even if you have been advised of the possibility of such injury, death, disfigurement, or other personal damage.

All trademarks or registered trademarks used in this document are the properties of their respective owners and (with the possible exception of any marks owned by the author(s) or editor(s) of this document) are used here for purposes of identification only. A trademark catalog page lists the marks known to be used on these web pages. Please e-mail dmm@lemur.com if you believe that the recognition of a trademark has been overlooked.


Version 1.3, 1998/06/17. Feedback to dmm@lemur.com
http://www.database.com/~lemur/vk-pencolors.html


Go to the: