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


C# Image.RenderSolid方法代碼示例

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


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

示例1: RenderDivider

        /// <summary>
        /// Renders a divider within the given rectangle. Uses the longer dimension as "with the grain".
        /// </summary>
        /// <param name="image">The image to render to.</param>
        /// <param name="boundary">The boundary to render in.</param>
        /// <param name="minColor">The minimum color.</param>
        /// <param name="midColor">The middle color.</param>
        /// <param name="maxColor">The maximum color.</param>
        /// <param name="interp">The interpolation function.</param>
        public static void RenderDivider(Image image, Rectangle boundary, ARGB minColor, ARGB midColor, ARGB maxColor, InterpFunction interp)
        {
            Rectangle area;
            if(boundary.Width >= boundary.Height)
            {
                area = boundary;
                int mid = (boundary.Min.Y + boundary.Max.Y) / 2;
                area.Max.Y = mid - 1;
                RenderXSide(image, false, boundary, minColor, midColor, interp);

                image.RenderSolid(new Rectangle{Min = new Point2D(mid, boundary.Min.Y), Max = new Point2D(mid, boundary.Max.Y)}, midColor);

                area = boundary;
                area.Min.Y = mid + 1;
                RenderXSide(image, true, boundary, maxColor, minColor, interp);
            }else
            {
                area = boundary;
                int mid = (boundary.Min.X + boundary.Max.X) / 2;
                area.Max.X = mid - 1;
                RenderYSide(image, false, boundary, minColor, midColor, interp);

                image.RenderSolid(new Rectangle{Min = new Point2D(boundary.Min.X, mid), Max = new Point2D(boundary.Max.X, mid)}, midColor);

                area = boundary;
                area.Min.X = mid + 1;
                RenderYSide(image, true, boundary, maxColor, minColor, interp);
            }
        }
開發者ID:jonhartnett,項目名稱:IROM-UI,代碼行數:38,代碼來源:RenderUtil.cs

示例2: RenderBorder

 /// <summary>
 /// Renders a border between the given inner and outer rectangles.
 /// </summary>
 /// <param name="image">The render target.</param>
 /// <param name="outBoundary">The outer rectangle.</param>
 /// <param name="inBoundary">The inner rectangle.</param>
 /// <param name="outColor">The outer color.</param>
 /// <param name="inColor">The inner color.</param>
 /// <param name="roundEdges">True if the edges should be rounded.</param>
 /// <param name="interp">The interpolation function to use.</param>
 /// <param name="disableCenter">If true, disables filling of the center.</param>
 public static void RenderBorder(Image image, Rectangle outBoundary, Rectangle inBoundary, ARGB outColor, ARGB inColor, bool roundEdges, InterpFunction interp, bool disableCenter = false)
 {
     //render north west
     RenderCorner(image, false, false, new Rectangle{Min = outBoundary.Min, Max = inBoundary.Min - 1}, outColor, inColor, roundEdges, interp);
     //render north east
     RenderCorner(image, true, false, new Rectangle{Min = new Point2D(inBoundary.Max.X + 1, outBoundary.Min.Y), Max = new Point2D(outBoundary.Max.X, inBoundary.Min.Y - 1)}, outColor, inColor, roundEdges, interp);
     //render south west
     RenderCorner(image, false, true, new Rectangle{Min = new Point2D(outBoundary.Min.X, inBoundary.Max.Y + 1), Max = new Point2D(inBoundary.Min.X - 1, outBoundary.Max.Y)}, outColor, inColor, roundEdges, interp);
     //render south east
     RenderCorner(image, true, true, new Rectangle{Min = inBoundary.Max + 1, Max = outBoundary.Max}, outColor, inColor, roundEdges, interp);
     //render north
     RenderYSide(image, false, new Rectangle{X = inBoundary.X, Y = outBoundary.Min.Y   , Width = inBoundary.Width, Height = inBoundary.Min.Y - outBoundary.Min.Y}, outColor, inColor, interp);
     //render south
     RenderYSide(image, true, new Rectangle{X = inBoundary.X, Y = inBoundary.Max.Y + 1, Width = inBoundary.Width, Height = outBoundary.Max.Y - inBoundary.Max.Y}, outColor, inColor, interp);
     //render west
     RenderXSide(image, false, new Rectangle{X = outBoundary.Min.X,    Y = inBoundary.Y, Width = inBoundary.Min.X - outBoundary.Min.X, Height = inBoundary.Height}, outColor, inColor, interp);
     //render east
     RenderXSide(image, true, new Rectangle{X = inBoundary.Max.X + 1, Y = inBoundary.Y, Width = outBoundary.Max.X - inBoundary.Max.X, Height = inBoundary.Height}, outColor, inColor, interp);
     //render center
     if(!disableCenter) image.RenderSolid(inBoundary, inColor);
 }
開發者ID:jonhartnett,項目名稱:IROM-UI,代碼行數:32,代碼來源:RenderUtil.cs

示例3: Render

        protected override void Render(Image image)
        {
            int titleHeight = (int)TitleHeight.Value;
            Rectangle outBounds = (Rectangle)Size.Value;
            Rectangle inBounds = outBounds;
            if(!DisableNorthEdge.Value) inBounds.Min.Y += Border.Value.Y / 2;
            if(!DisableSouthEdge.Value) inBounds.Max.Y -= Border.Value.Y / 2;
            if(!DisableWestEdge.Value) inBounds.Min.X += Border.Value.X / 2;
            if(!DisableEastEdge.Value) inBounds.Max.X -= Border.Value.X / 2;

            //render outside edges
            RenderUtil.RenderBorder(image, outBounds, inBounds, BackColor.Value, BorderColor.Value, RoundEdges.Value, EdgeInterpolation.Value, true);

            if(!DisableTitle.Value)
            {
                //render title bar
                image.RenderSolid(new Rectangle{Position = inBounds.Position, Width = inBounds.Width, Height = titleHeight}, BorderColor.Value);

                inBounds.Y += titleHeight;
                inBounds.Height -= titleHeight;
            }

            outBounds = inBounds;
            if(!DisableNorthEdge.Value || !DisableTitle.Value) inBounds.Min.Y += Border.Value.Y / 2;
            if(!DisableSouthEdge.Value) inBounds.Max.Y -= Border.Value.Y / 2;
            if(!DisableWestEdge.Value) inBounds.Min.X += Border.Value.X / 2;
            if(!DisableEastEdge.Value) inBounds.Max.X -= Border.Value.X / 2;

            //render inside edges
            RenderUtil.RenderBorder(image, outBounds, inBounds, BorderColor.Value, ForeColor.Value, RoundEdges.Value, EdgeInterpolation.Value, true);

            //render inside
            image.RenderSolid(inBounds, ForeColor.Value);
        }
開發者ID:jonhartnett,項目名稱:IROM-UI,代碼行數:34,代碼來源:Frame.cs

示例4: RenderYSide

 /// <summary>
 /// Renders a y-oriented gradient between the given colors. Includes outColor in the gradient but not inColor.
 /// </summary>
 /// <param name="image">The image to render to.</param>
 /// <param name="reverse">True to reverse the gradient.</param>
 /// <param name="area">The area to fill.</param>
 /// <param name="outColor">The "outer" color.</param>
 /// <param name="inColor">The "inner" color.</param>
 /// <param name="interp">The interpolation function to use.</param>
 private static void RenderYSide(Image image, bool reverse, Rectangle area, ARGB outColor, ARGB inColor, InterpFunction interp)
 {
     Rectangle clip = ShapeUtil.Overlap((Rectangle)image.Size, image.GetClip(), area);
     if(clip.IsValid())
     {
         for(int j = clip.Min.Y; j <= clip.Max.Y; j++)
         {
             double mu;
             if(reverse) mu = j - area.Min.Y;
             else 		mu = area.Max.Y - j;
             mu++;
             mu /= area.Height;
             mu = Util.Clip(mu, 0, 1);
             image.RenderSolid(new Rectangle{Min = new Point2D(clip.Min.X, j), Max = new Point2D(clip.Max.X, j)}, ColorUtil.Interpolate(inColor, outColor, mu, interp));
         }
     }
 }
開發者ID:jonhartnett,項目名稱:IROM-UI,代碼行數:26,代碼來源:RenderUtil.cs

示例5: Render

        protected override void Render(Image image)
        {
            Rectangle outBounds = Bounds;
            Rectangle inBounds = outBounds.Contract(Border.Value);

            //render edges
            RenderUtil.RenderBorder(image, outBounds, inBounds, BackColor.Value, Content.Color.Value, RoundEdges, EdgeInterpolation.Value);

            //render center
            image.RenderSolid(inBounds, Content.Color.Value);
        }
開發者ID:jonhartnett,項目名稱:IROM-UI,代碼行數:11,代碼來源:Button.cs


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