• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IGraphics类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IGraphics的典型用法代码示例。如果您正苦于以下问题:C# IGraphics类的具体用法?C# IGraphics怎么用?C# IGraphics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IGraphics类属于命名空间,在下文中一共展示了IGraphics类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Draw

 public override void Draw(IGraphics graphics)
 {
     int drawX = (int)Math.Round(X);
     int drawY = (int)Math.Round(Y);
     graphics.SetColor(255, r, g, b);
     graphics.DrawObject(Image.BigExplosion, drawX, drawY, 64, 64, animation / 4, animation % 4, angle);
 }
开发者ID:sinshu,项目名称:dtf,代码行数:7,代码来源:BigExplosionEffect.cs


示例2: Draw

 public override void Draw(int size, int x, int y, IGraphics g, Pen pen, Brush brush)
 {
     int s2 = size/2;
     Point[] points = new[]{new Point(x - s2, y), new Point(x, y - s2), new Point(x + s2, y), new Point(x, y + s2)};
     g.FillPolygon(brush, points);
     g.DrawPolygon(pen, points);
 }
开发者ID:neuhauser,项目名称:compbio-base,代码行数:7,代码来源:SymbolTypeFilledDiamond.cs


示例3: Draw

        /// <summary>
        /// Advances the time position and draws the current frame of the animation.
        /// </summary>
        /// <param name="gameTime">A game time</param>
        /// <param name="spriteBatch">A graphics</param>
        /// <param name="position">A position</param>
        /// <param name="spriteEffects">To flip an image</param> NOT USED
        public void Draw(GameTime gameTime, IGraphics spriteBatch, PointF position, bool spriteEffects)
        {
            if (AnimTexture == null)
               {
               throw new NotSupportedException("No animation is currently playing.");
               }

            // Process passing time.
            this.time += (float)gameTime.ElapsedTime.TotalSeconds;

            while (this.time > AnimTexture.FrameTime)
            {
                this.time -= AnimTexture.FrameTime;

                // Advance the frame index; looping or clamping as appropriate.
                if (AnimTexture.IsLooping)
                {
                    this.FrameIndex = (this.FrameIndex + 1) % AnimTexture.FrameCount;
                }
                else
                {
                    this.FrameIndex = Math.Min(this.FrameIndex + 1, AnimTexture.FrameCount - 1);
                }
            }

            // Draw the current frame.
            this.DrawFrame(spriteBatch, position, this.FrameIndex);
        }
开发者ID:jrusev,项目名称:Games,代码行数:35,代码来源:Animation.cs


示例4: Draw

		protected virtual void Draw (IGraphics g, int startIndex, int length, float thickness)
		{
			g.BeginEntity (this);
			
			if (length == 0) {
				
			}
			else if (length == 1) {
				var p = _points [startIndex];
				var r = thickness / 2;
				g.FillOval (p.X - r, p.Y - r, thickness, thickness);
			}
			else {			
				g.BeginLines (true);
				
				var end = startIndex + length;
				for (var i = startIndex; i < end - 1; i++) {
					g.DrawLine (
						_points [i].X,
						_points [i].Y,
						_points [i + 1].X,
						_points [i + 1].Y,
						thickness);
				}
				
				g.EndLines ();
			}
		}
开发者ID:praeclarum,项目名称:Praeclarum,代码行数:28,代码来源:Stroke.cs


示例5: Draw

 public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush)
 {
     int s2 = size/2;
     Point2[] points = {new Point2(x - s2, y), new Point2(x, y - s2), new Point2(x + s2, y), new Point2(x, y + s2)};
     g.FillPolygon(brush, points);
     g.DrawPolygon(pen, points);
 }
开发者ID:JurgenCox,项目名称:compbio-base,代码行数:7,代码来源:SymbolTypeFilledDiamond.cs


示例6: PaintImp

        /// <summary>
        /// Paints the fragment
        /// </summary>
        /// <param name="g">the device to draw to</param>
        protected override void PaintImp(IGraphics g)
        {
            var offset = HtmlContainer != null ? HtmlContainer.ScrollOffset : PointF.Empty;
            var rect = new RectangleF(Bounds.X + offset.X, Bounds.Y + offset.Y, Bounds.Width, Bounds.Height);

            if (rect.Height > 2 && RenderUtils.IsColorVisible(ActualBackgroundColor))
            {
                g.FillRectangle(RenderUtils.GetSolidBrush(ActualBackgroundColor), rect.X, rect.Y, rect.Width, rect.Height);
            }

            var b1 = RenderUtils.GetSolidBrush(ActualBorderTopColor);
            BordersDrawHandler.DrawBorder(Border.Top, g, this, b1, rect);

            if (rect.Height > 1)
            {
                var b2 = RenderUtils.GetSolidBrush(ActualBorderLeftColor);
                BordersDrawHandler.DrawBorder(Border.Left, g, this, b2, rect);

                var b3 = RenderUtils.GetSolidBrush(ActualBorderRightColor);
                BordersDrawHandler.DrawBorder(Border.Right, g, this, b3, rect);

                var b4 = RenderUtils.GetSolidBrush(ActualBorderBottomColor);
                BordersDrawHandler.DrawBorder(Border.Bottom, g, this, b4, rect);
            }
        }
开发者ID:havlenapetr,项目名称:HTMLRenderer,代码行数:29,代码来源:CssBoxHr.cs


示例7: Draw

 public override void Draw(IGraphics graphics)
 {
     int drawX = (int)Math.Round(X);
     int drawY = (int)Math.Round(Y);
     graphics.SetColor(255, 255, 255, 255);
     graphics.DrawObject(Image.Mushi, drawX, drawY, 32, 64, type, animation % 3 == 1 ? 1 : 0, angle);
 }
开发者ID:sinshu,项目名称:dtf,代码行数:7,代码来源:Mushi.cs


示例8: ClipGraphicsByOverflow

 /// <summary>
 /// Clip the region the graphics will draw on by the overflow style of the containing block.<br/>
 /// Recursively travel up the tree to find containing block that has overflow style set to hidden. if not
 /// block found there will be no clipping and null will be returned.
 /// </summary>
 /// <param name="g">the graphics to clip</param>
 /// <param name="box">the box that is rendered to get containing blocks</param>
 /// <returns>the prev region if clipped, otherwise null</returns>
 public static RectangleF ClipGraphicsByOverflow(IGraphics g, CssBox box)
 {
     var containingBlock = box.ContainingBlock;
     while (true)
     {
         if (containingBlock.Overflow == CssConstants.Hidden)
         {
             var prevClip = g.GetClip();
             var rect = box.ContainingBlock.ClientRectangle;
             rect.X -= 2; // atodo: find better way to fix it
             rect.Width += 2;
             rect.Offset(box.HtmlContainer.ScrollOffset);
             rect.Intersect(prevClip);
             g.SetClip(rect);
             return prevClip;
         }
         else
         {
             var cBlock = containingBlock.ContainingBlock;
             if (cBlock == containingBlock)
                 return RectangleF.Empty;
             containingBlock = cBlock;
         }
     }
 }
开发者ID:havlenapetr,项目名称:HTMLRenderer,代码行数:33,代码来源:RenderUtils.cs


示例9: OnRender

        /// <summary>
        /// Function to render the actual map decoration
        /// </summary>
        /// <param name="g"></param>
        /// <param name="map"></param>
        protected override void OnRender(IGraphics g, Map map)
        {
            // Render the rosetta
            base.OnRender(g, map);
            
            var clip = g.ClipBounds;
            var oldTransform = g.Transform;
            var newTransform = new Matrix(1f, 0f, 0f, 1f, clip.Left + Size.Width*0.5f, clip.Top + Size.Height*0.5f);

            g.Transform = newTransform;

            var width = Size.Width;
            var height = Size.Height;
            var pts = new[]
                          {
                              new PointF(0f, -0.35f*height),
                              new PointF(0.125f*width, 0.35f*height),
                              new PointF(0f, 0.275f*height),
                              new PointF(-0.125f*width, 0.35f*height),
                              new PointF(0f, -0.35f*height),
                          };

            // need to outline the needle
            if (NeedleOutlineWidth>0)
            {
                g.DrawPolygon(new Pen(OpacityColor(NeedleOutlineColor), NeedleOutlineWidth), pts);
            }

            // need to outline the needle
            g.FillPolygon(new SolidBrush(OpacityColor(NeedleFillColor)), pts );

            g.Transform = oldTransform;

        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:39,代码来源:EyeOfSight.cs


示例10: IndexBuffer

        public IndexBuffer(IGraphics graphics)
        {
            _graphics = graphics as Graphics;

            _graphics.MakeCurrent();
            GL.GenBuffers(1, out id);
        }
开发者ID:gamemaster101gr,项目名称:open3deditor,代码行数:7,代码来源:IndexBuffer.cs


示例11: DrawSmoothFilledCurve

        public override void DrawSmoothFilledCurve(IGraphics g, GraphPane pane, CurveItem curve, float scaleFactor)
        {
            base.DrawSmoothFilledCurve(g, pane, curve, scaleFactor);

            // Draw the curve at the bottom of the graph.
            DrawCurve(g, pane, curve, scaleFactor, GetPointsForLowPointsArray(curve));
        }
开发者ID:konrad-zielinski,项目名称:ZedGraph,代码行数:7,代码来源:FilledLine.cs


示例12: Draw

 /// <summary>
 /// Do all rendering associated with this <see cref="CurveItem"/> to the specified
 /// <see cref="Graphics"/> device.  This method is normally only
 /// called by the Draw method of the parent <see cref="ZedGraph.CurveList"/>
 /// collection object.
 /// </summary>
 /// <param name="g">
 /// A graphic device object to be drawn into.  This is normally e.Graphics from the
 /// PaintEventArgs argument to the Paint() method.
 /// </param>
 /// <param name="pane">
 /// A reference to the <see cref="ZedGraph.GraphPane"/> object that is the parent or
 /// owner of this object.
 /// </param>
 /// <param name="pos">The ordinal position of the current <see cref="Bar"/>
 /// curve.</param>
 /// <param name="scaleFactor">
 /// The scaling factor to be used for rendering objects.  This is calculated and
 /// passed down by the parent <see cref="ZedGraph.GraphPane"/> object using the
 /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
 /// font sizes, etc. according to the actual size of the graph.
 /// </param>
 public override void Draw(IGraphics g, GraphPane pane, int pos, float scaleFactor)
 {
     if (IsXAxisMarker)
         DrawXMarker(pane, g);
     else
         DrawYMarker(pane, g);
 }
开发者ID:konrad-zielinski,项目名称:ZedGraph,代码行数:29,代码来源:AxisMarkerObj.cs


示例13: Run

 /// <summary>
 /// Run game logic here such as updating the world,
 /// checking for collisions, handling input and drawing the game.
 /// This method will be called as frequently as possible,
 /// when the Windows message queue is empty.
 /// Check GameTime to get the elapsed time since the last update.
 /// </summary>
 /// <param name="gameTime">Game time</param>
 /// <param name="renderer">A Renderer</param>
 /// <param name="keyboardState">A keyboard state</param>
 public void Run(GameTime gameTime, IGraphics renderer, IControllerState keyboardState)
 {
     if (this.levelStat == LevelChangeStatus.NoChange)
     {
         if (Collisions.GetPlayerTile(this.level.Player) == TileType.Next)
         {
             this.level.LevelIndex++;
             this.levelStat = LevelChangeStatus.Change;
         }
         else if (Collisions.GetPlayerTile(this.level.Player) == TileType.Back)
         {
             this.level.LevelIndex--;
             this.levelStat = LevelChangeStatus.Change;
         }
         else
         {
             this.level.Update(gameTime, keyboardState);
             this.level.Draw(gameTime, renderer);
         }
     }
     else
     {
         this.level.UpdateLevel();
         this.levelStat = LevelChangeStatus.NoChange;
     }
 }
开发者ID:jrusev,项目名称:Games,代码行数:36,代码来源:Game.cs


示例14: Draw

 public override void Draw(IGraphics graphics)
 {
     int drawX = (int)Math.Round(X);
     int drawY = (int)Math.Round(Y);
     graphics.SetColor(255, type == 0 ? 255 : 0, type == 1 ? 255 : 0, type == 2 ? 255 : 0);
     graphics.DrawObject(Image.Teki, drawX, drawY, 32, 32, 0, 0, angle);
 }
开发者ID:sinshu,项目名称:dtf,代码行数:7,代码来源:Teki.cs


示例15: OnRenderInternal

 protected override void OnRenderInternal(Map map, IPolygon polygon, IGraphics g)
 {
     IPoint pt = polygon.Centroid;
     Point renderingOrigin = Point.Truncate(Transform.WorldtoMap(pt.Coordinate, map));
     g.RenderingOrigin = new PointStruct(renderingOrigin.X, renderingOrigin.Y);
     base.OnRenderInternal(map, polygon, g);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:PolygonSymbolizerTest.cs


示例16: draw

 public override void draw(IGraphics graphics)
 {
     // DEBUG: should use shapes instead of drawString and handle cut time, etc.
       FinalPoint hotspot = getScreenHotspot();
       graphics.DrawString("" + _topNumber, hotspot.x, hotspot.y + 10);
       graphics.DrawString("" + _bottomNumber, hotspot.x, hotspot.y + 20);
 }
开发者ID:svejdo1,项目名称:niffty,代码行数:7,代码来源:TimeSignature.cs


示例17: BotForecast

        public static void BotForecast(IGraphics graphics, double X, double Y, double Heading, double Velocity, int Turns)
        {
            BotPosition bot = new BotPosition(X, Y, Heading, Velocity);
            BotPosition[][] moves = BotPosition.AllMoves(bot, Turns);

            foreach (BotPosition[] path in moves)
            {
                int i = 0;
                //float LastX = (float)X;
                //float LastY = (float)Y;
                foreach (BotPosition b in path)
                {
                    if (i++ % 4 == Turns % 4)
                    //if (i++ % 5 == Turns % 5 && Turns/i < 2)
                    {
                        BotDot(graphics, b.Location.X, b.Location.Y);
                        //BotBox(graphics, new Pen(Color.FromArgb(100, 255, 255, 0)), b.Location.X, b.Location.Y, b.Heading);
                        //graphics.DrawRectangle(new Pen(Color.FromArgb(100, 255, 255, 0)), b.Location.X - 18, b.Location.Y - 18, 36, 36);
                        //graphics.DrawLine(new Pen(Color.FromArgb(100, 255, 255, 0)), LastX, LastY, (float)b.Location.X, (float)b.Location.Y);
                        //LastX = (float)b.Location.X;
                        //LastY = (float)b.Location.Y;
                    }
                }
            }
        }
开发者ID:KingLebron,项目名称:robocode,代码行数:25,代码来源:Paint.cs


示例18: Draw

 public override void Draw(IGraphics graphics)
 {
     int drawX = (int)Math.Round(X);
     int drawY = (int)Math.Round(Y);
     graphics.SetColor(255, 255, 255, 255);
     graphics.DrawObject(Image.RedEnemy, drawX, drawY, 32, 32, 0, 0, angle);
 }
开发者ID:sinshu,项目名称:dtf,代码行数:7,代码来源:RedEnemy.cs


示例19: Draw

        public void Draw(IGraphics g)
        {
            if (Font != null) {
                g.SetFont (Font);
            }
            g.SetColor (Colors.Gray);
            var border = Frame;
            border.Y += PaddingTop;
            border.Height -= PaddingTop + PaddingBottom;

            border.Inflate (-1, -1);
            g.DrawRoundedRect (border, 5, 1);

            var inner = border;
            inner.Inflate (-2, -2);

            if (Checked) {
                g.FillRoundedRect (inner, 3);
                g.SetColor (Colors.Black);
            }

            if (!string.IsNullOrEmpty (Title)) {
                var fm = g.GetFontMetrics ();
                var sw = fm.StringWidth (Title);

                g.DrawString (Title, inner.X + (inner.Width - sw)/2, inner.Y + (inner.Height - fm.Height)/2);
            }
        }
开发者ID:Clancey,项目名称:CrossGraphics,代码行数:28,代码来源:Canvas.cs


示例20: DrawString

        public void DrawString(IGraphics g, string text, Font font, Brush brush, PointF location)
        {
            int oldCount = _glyphCoords.Count;
            AddString(text, font, brush, g.TextRenderingHint);
            if (g is GLGraphics)
                UpdateTextureIfNeeded();

            List<RectangleF> glyphDst = new List<RectangleF>();
            List<Rectangle> glyphSrc = new List<Rectangle>();

            location.X += 2.0f; // magic ... really don't know how to get this offset from MeasureString

            foreach (var c in text)
            {
                var glyphCoord = _glyphCoords[c];

                var glyphSize = glyphCoord.RealSize;
                glyphSize.Width = (float)Math.Ceiling(glyphSize.Width);
                glyphSize.Height = (float)Math.Ceiling(glyphSize.Height);

                glyphDst.Add(new RectangleF(location, glyphSize));
                glyphSrc.Add(glyphCoord.GlyphRect);

                if (g is GDIGraphics)
                    g.DrawImage(_bitmap, location.X, location.Y, glyphCoord.GlyphRect.ToRectangleF(), GraphicsUnit.Pixel);

                location.X += (float)Math.Round(glyphCoord.RealSize.Width + 0.2f); // another magic
            }

            if (g is GLGraphics)
                _texture.DrawGlyphs(glyphDst, glyphSrc);
        }
开发者ID:filipkunc,项目名称:GLGraphics,代码行数:32,代码来源:GlyphTextureCache.cs



注:本文中的IGraphics类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IGraphicsContext类代码示例发布时间:2022-05-24
下一篇:
C# IGraphic类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap