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


C# CGContext.FillRect方法代碼示例

本文整理匯總了C#中MonoMac.CoreGraphics.CGContext.FillRect方法的典型用法代碼示例。如果您正苦於以下問題:C# CGContext.FillRect方法的具體用法?C# CGContext.FillRect怎麽用?C# CGContext.FillRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MonoMac.CoreGraphics.CGContext的用法示例。


在下文中一共展示了CGContext.FillRect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FillRect

 public static void FillRect(CGContext context, RectangleF rect, CGColor color)
 {
     context.SaveState();
     context.AddRect(rect);
     context.Clip();
     context.SetFillColor(color);
     context.FillRect(rect);
     context.RestoreState();
 }
開發者ID:pascalfr,項目名稱:MPfm,代碼行數:9,代碼來源:CoreGraphicsHelper.cs

示例2: RenderPixels

        void RenderPixels(CGContext context, int x, int y, Edge edge32, Edge edge13, Edge edge21, int w1, int w2, int w3)
        {
            //VertexInterpoliation = A * x + B * y + C;
            //			float alpha = (edge32.A * x + edge32.B * y + edge32.C) * edge32.VertexFactor;
            //			float beta = (edge13.A * x + edge13.B * y + edge13.C)  * edge13.VertexFactor;
            //			float gamma = (edge21.A * x + edge21.B * y + edge21.C) * edge21.VertexFactor;

            // Determine barycentric coordinates
            float alpha = (float)(w1 * edge32.VertexFactor);
            float beta = (float)(w2 * edge13.VertexFactor);
            float gamma = (float)(w3 * edge21.VertexFactor);

            GradientLerp3 (alpha, beta, gamma);
            // Set the color
            context.SetFillColor (colorOutput [0], colorOutput [1], colorOutput [2], colorOutput [3]);

            // Set our pixel location
            pixelRect.X = x;
            pixelRect.Y = y;

            // Fill the pixel
            context.FillRect (pixelRect);
        }
開發者ID:asfungithub,項目名稱:sysdrawing-coregraphics,代碼行數:23,代碼來源:PathGradientBrush.cs

示例3: HatchSphere

        /**
         * This is fill of hackish stuff.
         * Thought this was going to be easier but that just did not work out.
         **/
        protected void HatchSphere(CGContext context)
        {
            var hatchSize = getHatchWidth (hatchStyle);
            var lineWidth = getLineWidth (hatchStyle);

            initializeContext(context, hatchSize, false);

            /* draw background in fore ground color*/
            drawBackground (context, backColor, hatchSize, hatchSize);

            context.SetStrokeColor(foreColor.ToCGColor());
            context.SetFillColor(foreColor.ToCGColor());

            context.SetLineWidth(1);
            context.SetLineCap(CGLineCap.Square);

            // Initialize work rectangle
            RectangleF rect = new RectangleF(0,0,1,1);

            float quad = hatchSize / 2.0f;

            // Left lower quad
            rect.Width = quad;
            rect.Height = quad;
            rect.X = 0;
            rect.Y = 0;

            context.StrokeRect(rect);

            // right upper quad
            rect.Width = quad;
            rect.Height = quad;
            rect.X = quad;
            rect.Y = quad;

            context.StrokeRect(rect);

            // left upper quad
            rect.Width = quad;
            rect.Height = quad;
            rect.X = 0;
            rect.Y = quad + 1;

            context.FillRect(rect);

            // right lower quod
            rect.Width = quad;
            rect.Height = quad;
            rect.X = quad + 1;
            rect.Y = 0;

            context.FillRect(rect);

            // Now we fill in some corner bits with background
            // This is a bad hack but now sure what else to do
            context.SetFillColor(backColor.ToCGColor());

            rect.Height = 1;
            rect.Width = 1;

            rect.X = 0;
            rect.Y = 0;
            setPixels(context, rect);

            rect.X = 0;
            rect.Y = quad;
            setPixels(context, rect);

            rect.X = 0;
            rect.Y = quad;
            setPixels(context, rect);

            rect.X = quad;
            rect.Y = 0;
            setPixels(context, rect);

            rect.X = quad;
            rect.Y = quad;
            setPixels(context, rect);

            rect.X = quad;
            rect.Y = hatchSize;
            setPixels(context, rect);

            rect.X = hatchSize;
            rect.Y = 0;
            setPixels(context, rect);

            rect.X = hatchSize;
            rect.Y = quad;
            setPixels(context, rect);

            rect.X = hatchSize;
            rect.Y = hatchSize;
            setPixels(context, rect);

//.........這裏部分代碼省略.........
開發者ID:asfungithub,項目名稱:sysdrawing-coregraphics,代碼行數:101,代碼來源:HatchBrush.cs

示例4: drawBackground

 void drawBackground(CGContext context, Color color, float width, float height)
 {
     context.SetFillColor(color.ToCGColor());
     context.FillRect(new RectangleF(HALF_PIXEL_X, HALF_PIXEL_Y, width+HALF_PIXEL_X, height+HALF_PIXEL_Y));
     context.FillPath();
 }
開發者ID:asfungithub,項目名稱:sysdrawing-coregraphics,代碼行數:6,代碼來源:HatchBrush.cs

示例5: setPixels

 void setPixels(CGContext context, RectangleF rect)
 {
     context.FillRect(rect);
 }
開發者ID:asfungithub,項目名稱:sysdrawing-coregraphics,代碼行數:4,代碼來源:HatchBrush.cs


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