當前位置: 首頁>>代碼示例>>C#>>正文


C# CairoContextEx.FillGradient方法代碼示例

本文整理匯總了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 ();
                }
            }
        }
開發者ID:syoubin,項目名稱:gbrainy_android,代碼行數:17,代碼來源:PuzzleLargerShape.cs

示例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 ();
            }
        }
開發者ID:syoubin,項目名稱:gbrainy_android,代碼行數:20,代碼來源:PuzzleLargerShape.cs

示例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 ();
        }
開發者ID:GNOME,項目名稱:gbrainy,代碼行數:18,代碼來源:FinishView.cs

示例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 ();
            }
        }
開發者ID:syoubin,項目名稱:gbrainy_android,代碼行數:23,代碼來源:PuzzleLargerShape.cs

示例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);
 }
開發者ID:GNOME,項目名稱:gbrainy,代碼行數:5,代碼來源:PuzzleCoverPercentage.cs

示例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 ();
                }
            }
        }
開發者ID:syoubin,項目名稱:gbrainy_android,代碼行數:28,代碼來源:PuzzleGridCircles.cs

示例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 ();
        }
開發者ID:syoubin,項目名稱:gbrainy_android,代碼行數:26,代碼來源:PuzzleExtraCircle.cs

示例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++;
            }
        }
開發者ID:syoubin,項目名稱:gbrainy_android,代碼行數:48,代碼來源:MemoryCountDots.cs

示例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 ();
                }
            }
        }
開發者ID:GNOME,項目名稱:gbrainy,代碼行數:20,代碼來源:MemoryColouredFigures.cs


注:本文中的gbrainy.Core.Main.CairoContextEx.FillGradient方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。