Editing
Graphics development with vplot
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Low level output routines=== (only called by certain generic routines) <syntaxhighlight lang="c"> int lost = YES; dev.plot(x, y, draw) int x, y, draw; </syntaxhighlight> Move or draw to device coordinate (x,y). Draw=0 for move, 1 for draw. This routine MUST declare the global flag "lost". It is the responsibility of all the device routines to set this to YES whenever anything happens that may cause genvector's idea of the "current device pen position" to be wrong. (For example, printing an error message, doing hardware text, filling a polygon, etc.) Generic routines do not present a difficulty, since they can't output anything directly to the device. When lost is set to YES, it is guaranteed that the next call to dev.plot will by a move, and not a draw. When genvector's idea of the current position is correct again (for example when dev.plot has been called) lost should be set to NO. THIS IS IMPORTANT; genvector only looks at the value of lost, it doesn't set it. Leaving lost YES all the time will greatly slow down plotting by forcing one move for each draw! Generic routines: nulldev Link in nulldev here as a placeholder if you didn't use genvector as your vector routine. <syntaxhighlight lang="c"> dev.startpoly(npts) int npts; dev.midpoly(x,y) int x, y; dev.endpoly(last) int last; </syntaxhighlight> Polygon-drawing routines called only by genarea. Dev.startpoly is called once at the beginning of every polygon. Npts gives the number of points in the polygon. After dev.startpoly has been called, then dev.midpoly is called once for each point in the polygon. (x,y) gives the device coordinate of the vertex. Dev.endpoly is called once at the end of each polygon. Genarea may fragment one polygon into several. If this polygon just defined is the last polygon in a set of polygons that were fragmented from one, then last will be 1. If there are more fragments in this set to go, last will be 0. It is guaranteed that no other routines but these three will be called after the first dev.startpoly call and before dev.endpoly(last=YES) is called. The genarea algorithm will fail for certain very complicated crossed polygons, unless the multiple polygons fragmented from the one original one are shaded as a unit. Some devices such as the Tek4105 allow this to be done. That is why the "last" flag is provided. There is no great harm in shading each polygon as it comes. Occasionally interior voids will be filled twice instead of not filled at all, that's all. If the device can fill with an arbitrary pattern, it should do so. The pattern is available to these routines in the same way as described under dev.area. If the device cannot fill with a user-defined pattern, filling solidly with the current color is the next best thing. Generic routines: nulldev.c If you did not use genarea as your dev.area routine, then none of these routines are ever called so you just need to put in nulldev as a placeholder.
Summary:
Please note that all contributions to Madagascar are considered to be released under the GNU Free Documentation License 1.3 or later (see
My wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Getting Madagascar
download
Installation
GitHub repository
SEGTeX
Introduction
Package overview
Tutorial
Hands-on tour
Reproducible documents
Hall of Fame
User Documentation
List of programs
Common programs
Popular programs
The RSF file format
Reproducibility with SCons
Developer documentation
Adding programs
Contributing programs
API demo: clipping data
API demo: explicit finite differences
Community
Conferences
User mailing list
Developer mailing list
GitHub organization
LinkedIn group
Development blog
Twitter
Slack
Tools
What links here
Related changes
Special pages
Page information