本文整理汇总了C#中gbrainy.Core.Main.CairoContextEx.FillGradient方法的典型用法代码示例。如果您正苦于以下问题:C# CairoContextEx.FillGradient方法的具体用法?C# CairoContextEx.FillGradient怎么用?C# CairoContextEx.FillGradient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbrainy.Core.Main.CairoContextEx
的用法示例。
在下文中一共展示了CairoContextEx.FillGradient方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawPossibleAnswer
private void DrawPossibleAnswer(CairoContextEx gr, double x, double y, char [] portions, int figure, int seq)
{
const int columns = 3, rows = 3;
const double rect_w = 0.05, rect_h = 0.05;
int index = figure * columns * rows;
for (int row = 0; row < rows; row++) {
for (int column = 0; column < columns; column++) {
if (portions [index + column + (3 * row)] != X) {
gr.Rectangle (x + column * rect_w, y + row * rect_h, rect_w, rect_h);
gr.FillGradient (x + column * rect_w, y + row * rect_h, rect_w, rect_h, ColorForPortion (portions [index + column + (3 * row)]));
}
gr.Rectangle (x + column * rect_w, y + row * rect_h, rect_w, rect_h);
gr.Stroke ();
}
}
}
示例2: DrawSquare
private void DrawSquare(CairoContextEx gr, double x, double y)
{
// XX
// XX
for (int i = 0; i < 2; i++) {
if (quest1 [i] != X) {
gr.Rectangle (x + i * rect_witdh, y, rect_witdh, rect_height);
gr.FillGradient (x + i * rect_witdh, y, rect_witdh, rect_height, ColorForPortion (quest1 [i]));
}
gr.Rectangle (x + i * rect_witdh, y, rect_witdh, rect_height);
gr.Stroke ();
if (quest1 [i + 2] != X) {
gr.Rectangle (x + i * rect_witdh, y + rect_height, rect_witdh, rect_height);
gr.FillGradient (x + i * rect_witdh, y + rect_height, rect_witdh, rect_height, ColorForPortion (quest1 [i + 2]));
}
gr.Rectangle (x + i * rect_witdh, y + rect_height, rect_witdh, rect_height);
gr.Stroke ();
}
}
示例3: DrawBar
static void DrawBar(CairoContextEx gr, double x, double y, double w, double h, double percentage)
{
double per = percentage / 100;
gr.Rectangle (x, y - h * per, w, h * per);
gr.FillGradient (x, y - h * per, w, h * per, new Cairo.Color (0, 0, 1));
gr.DrawTextCentered (x + w / 2, (y - 0.03) - h * per, String.Format ("{0}", percentage));
gr.Save ();
gr.Color = new Cairo.Color (0, 0, 0);
gr.MoveTo (x, y);
gr.LineTo (x, y - h * per);
gr.LineTo (x + w, y - h * per);
gr.LineTo (x + w, y);
gr.LineTo (x, y);
gr.Stroke ();
gr.Restore ();
}
示例4: DrawLShape
private void DrawLShape(CairoContextEx gr, double x, double y)
{
// XXX
// X
// X
for (int i = 0; i < 3; i++) { // XXXX
if (quest2 [i] != X) {
gr.Rectangle (x + i * rect_witdh, y, rect_witdh, rect_height);
gr.FillGradient (x + i * rect_witdh, y, rect_witdh, rect_height, ColorForPortion (quest2 [i]));
}
gr.Rectangle (x + i * rect_witdh, y, rect_witdh, rect_height);
gr.Stroke ();
}
for (int i = 0; i < 2; i++) {
if (quest2 [(i + 1) * 3] != X) {
gr.Rectangle (x, y + rect_height * (i + 1), rect_witdh, rect_height);
gr.FillGradient (x, y + rect_height * (i + 1), rect_witdh, rect_height, ColorForPortion (quest2 [(i + 1) * 3]));
}
gr.Rectangle (x, y + rect_height * (i + 1), rect_witdh, rect_height);
gr.Stroke ();
}
}
示例5: Fill
private static void Fill(CairoContextEx gr, double x, double y, double w, double h)
{
gr.Rectangle (x, y, w, h);
gr.FillGradient (x, y, w, h);
}
示例6: Draw
public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
{
double rect_w = DrawAreaWidth / rows;
double rect_h = DrawAreaHeight / columns;
base.Draw (gr, area_width, area_height, rtl);
for (int column = 0; column < columns; column++) {
for (int row = 0; row < rows; row++) {
gr.Color = DefaultDrawingColor;
gr.Rectangle (DrawAreaX + row * rect_w, DrawAreaY + column * rect_h, rect_w, rect_h);
gr.Stroke ();
gr.DrawTextCentered (DrawAreaX + (rect_w / 2) + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h,
(numbers[column + (row * 4)]).ToString() );
if (numbers[column + (row * 4)] % divisor == 0 && good_pos != column + (row * 4)) {
gr.Arc (DrawAreaX + (rect_w / 2) + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h,
0.05, 0, 2 * Math.PI);
gr.FillGradient (DrawAreaX + (rect_w / 2) + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h,
0.05, 0.05);
}
gr.Stroke ();
}
}
}
示例7: DrawSlice
static void DrawSlice(CairoContextEx gr, double x, double y, double dg, Color color)
{
double x1, y1, smallest_x, smallest_y, degrees;
smallest_x = x;
smallest_y = y;
degrees = radian * (60 + dg);
gr.MoveTo (x, y);
x1 = x + radius * Math.Cos (degrees);
y1 = y + radius * Math.Sin (degrees);
gr.LineTo (x1, y1);
if (x1 < smallest_x) smallest_x = x1;
if (y1 < smallest_y) smallest_y = y1;
degrees = dg * radian;
gr.MoveTo (x, y);
x1 = x + radius * Math.Cos (degrees);
y1 = y + radius * Math.Sin (degrees);
gr.LineTo (x1, y1);
if (x1 < smallest_x) smallest_x = x1;
if (y1 < smallest_y) smallest_y = y1;
gr.Arc (x, y, radius, dg * radian, radian * (60 + dg));
gr.FillGradient (smallest_x, smallest_y, radius, radius, color);
gr.Stroke ();
}
示例8: DrawObject
private void DrawObject(CairoContextEx gr, int area_width, int area_height)
{
palette.Alpha = alpha;
double x = DrawAreaX + 0.15, y = DrawAreaY + 0.1;
gr.Color = palette.Cairo (ColorPalette.Id.Black);
double pos_x = x, pos_y = y;
const double figure_size = 0.6;
const double square_size = figure_size / NUMCOLUMNS ;
const double center_square = square_size / 2;
double radius_square = .8 * (square_size - (LineWidth *2)) / 2;
gr.Rectangle (pos_x, pos_y, figure_size, figure_size);
gr.Stroke ();
for (int line = 0; line < NUMCOLUMNS - 1; line++) // Horizontal
{
pos_y += square_size;
gr.MoveTo (pos_x, pos_y);
gr.LineTo (pos_x + figure_size, pos_y);
gr.Stroke ();
}
pos_y = y;
for (int column = 0; column < NUMCOLUMNS - 1; column++) // Vertical
{
pos_x += square_size;
gr.MoveTo (pos_x, pos_y);
gr.LineTo (pos_x, pos_y + figure_size);
gr.Stroke ();
}
pos_y = y + center_square;
pos_x = x + center_square;
for (int i = 0,itcolor=0; i < MAXDOTS && itcolor<palette.Count; i++)
{
int dx,dy;
Color color = palette.Cairo(itcolor);
dx = (location_order[i]) % NUMCOLUMNS;
dy = (location_order[i]) / NUMCOLUMNS;
gr.Arc (pos_x+square_size*dx, pos_y+square_size*dy,radius_square,0,2*Math.PI);
gr.FillGradient (pos_x+square_size*dx, pos_y+square_size*dy, radius_square, radius_square, color);
if (i==dotsPerColor[itcolor]) itcolor++;
}
}
示例9: DrawSquare
private void DrawSquare(CairoContextEx gr, double x, double y, SquareColor []colours, int index)
{
gr.Save ();
for (int column = 0; column < columns; column++) {
for (int row = 0; row < rows; row++) {
// if you want 2 schemes (primary or secundary colors)
Color c = palette.Cairo(ColorPalette.Id.First+ color_sheme*3 + (int)colours[index+(columns * row) + column]);
gr.Rectangle (x + row * rect_w, y + column * rect_h, rect_w, rect_h);
gr.FillGradient (x + row * rect_w, y + column * rect_h, rect_w, rect_h, c);
}
}
gr.Restore ();
for (int column = 0; column < columns; column++) {
for (int row = 0; row < rows; row++) {
gr.Rectangle (x + row * rect_w, y + column * rect_h, rect_w, rect_h);
gr.Stroke ();
}
}
}