Class | MRPlot::GraphicContext |
In: |
mrplot.rb
|
Parent: | Object |
GraphicContext is the base class for all backends. If you use it as context your plots will be printed to the console as commands. If you want to write your own backend you need to overwrite at least all functions starting with atom_. For optimisation it is recommend to overwrite the other draw methods too. With mrplot comes the RMagickContext which is a binding to the rmagick/imagemagick library.
Which styles are supported by a backend varies but you should support the following styles (and accept the classes as written here):
color (Color): | The stroke color of an object (the fill color if there is no stroke) |
fill_color (Color): | The fill color of an object |
line_width (Numeric) : | The line/stroke width of an object |
These styles are only used in atom_ methods which are handling with text
font (String): | The font of a text |
font_size (Numeric): | The font size of a text |
font_style (String): | The font style of a text |
The following styles are only used within the marker/arrowhead atoms
marker (Symbol): | The marker type which will be used |
marker_image (String) : | Path to a marker image |
arrow_head (Symbol) : | The style of the arrowhead used |
Which arrowheads/markers are supported is depending on the context you use.
clip | [RW] | |
windowspace | [RW] |
Draw a string at a given point. The style parameter depends on the context. Not every style parameter is supported by every context.
rel and rel_v are used to specify how the string is aligned to the given point
rel can be :left, :center, :right rel_v can be :top, :center, :bottom
The rotation parameter is a MRPHelpers::Rotation object which specifies a rotation around a point.
Get the core context. This depends on the choosen graphics context. The MagickContext for example returns a draw object.
Used to draw multiple connected lines with one command
Can be overwritten for speed reasons. The standard implementation just loops over an array of points and calls atom_drawline(points[i-1], points[i], style)