In progress...

This commit is contained in:
Kolan Sh 2018-01-19 20:34:08 +03:00
parent 80cc8bfade
commit 3c295b0bf8
5 changed files with 62 additions and 14 deletions

View File

@ -35,7 +35,8 @@ namespace CairoChart {
public Color (double red = 0.0,
double green = 0.0,
double blue = 0.0,
double alpha = 1.0) {
double alpha = 1.0
) {
this.red = red;
this.green = green;
this.blue = blue;

View File

@ -63,7 +63,8 @@ namespace CairoChart {
Cairo.FontSlant slant = Cairo.FontSlant.NORMAL,
Cairo.FontWeight weight = Cairo.FontWeight.NORMAL,
double size = 10,
Font.Orientation orientation = Font.Orientation.HORIZONTAL) {
Font.Orientation orientation = Font.Orientation.HORIZONTAL
) {
this.family = family;
this.slant = slant;
this.weight = weight;

View File

@ -1,22 +1,60 @@
namespace CairoChart {
/**
* ``Chart`` line.
*/
public class Line {
/**
* Line Style.
*/
public struct Style {
double width;
Cairo.LineJoin join;
Cairo.LineCap cap;
double[]? dashes;
double dash_offset;
/**
* Line color.
*/
Color color;
/**
* A line width.
*/
double width;
/**
* An array specifying alternate lengths of on and off stroke portions.
*/
double[]? dashes;
/**
* An offset into the dash pattern at which the stroke should start.
*/
double dash_offset;
/**
* A line join style.
*/
Cairo.LineJoin join;
/**
* A line cap style.
*/
Cairo.LineCap cap;
/**
* Constructs a new ``Style``.
* @param color line color.
* @param width a line width.
* @param dashes an array specifying alternate lengths of on and off stroke portions.
* @param dash_offset an offset into the dash pattern at which the stroke should start.
* @param join a line join style.
* @param cap a line cap style.
*/
public Style (Color color = Color(),
double width = 1,
double[]? dashes = null, double dash_offset = 0,
Cairo.LineJoin join = Cairo.LineJoin.MITER,
Cairo.LineCap cap = Cairo.LineCap.ROUND
) {
double width = 1,
double[]? dashes = null,
double dash_offset = 0,
Cairo.LineJoin join = Cairo.LineJoin.MITER,
Cairo.LineCap cap = Cairo.LineCap.ROUND
) {
this.width = width;
this.join = join;
this.cap = cap;
@ -25,6 +63,9 @@ namespace CairoChart {
this.color = color;
}
/**
* Applies current style to the {@link Chart} ``Context``.
*/
public void apply (Chart chart) {
chart.color = color;
chart.ctx.set_line_join(join);
@ -33,5 +74,7 @@ namespace CairoChart {
chart.ctx.set_dash(dashes, dash_offset);
}
}
private Line () { }
}
}

View File

@ -15,7 +15,9 @@ namespace CairoChart {
public Type type = Type.NONE;
public double size = 8.0;
public Marker (Type type = Type.NONE, double size = 8.0) {
public Marker (Type type = Type.NONE,
double size = 8.0
) {
this.type = type;
this.size = size;
}

View File

@ -38,7 +38,8 @@ namespace CairoChart {
return place;
}
public Place (double x_min = 0, double x_max = 1, double y_min = 0, double y_max = 1) {
public Place (double x_min = 0,
double x_max = 1, double y_min = 0, double y_max = 1) {
this.x_min = x_min;
this.x_max = x_max;
this.y_min = y_min;