当前位置: 首页>>代码示例>>C#>>正文


C# Graphics.Draw方法代码示例

本文整理汇总了C#中Graphics.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.Draw方法的具体用法?C# Graphics.Draw怎么用?C# Graphics.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Graphics的用法示例。


在下文中一共展示了Graphics.Draw方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawStreched

        void DrawStreched(Graphics g, Rectangle dest)
        {
            g.Draw(texture, new Rectangle(dest.X, dest.Y, paddingLeft, paddingTop),
                            new Rectangle(0, 0, paddingLeft, paddingTop), border);

            g.Draw(texture, new Rectangle(dest.X + paddingLeft, dest.Y, dest.Width - paddingLeft - paddingRight, paddingTop),
                            new Rectangle(paddingLeft, 0, texture.Width - paddingLeft - paddingRight, paddingTop), border);

            g.Draw(texture, new Rectangle(dest.X + dest.Width - paddingRight, dest.Y, paddingLeft, paddingTop),
                            new Rectangle(texture.Width - paddingRight, 0, paddingLeft, paddingTop), border);

            g.Draw(texture, new Rectangle(dest.X, dest.Y + paddingTop, paddingLeft, dest.Height - paddingTop - paddingBottom),
                            new Rectangle(0, paddingTop, paddingLeft, texture.Height - paddingTop - paddingBottom), border);

            g.Draw(texture, new Rectangle(dest.X + paddingLeft, dest.Y + paddingTop, dest.Width - paddingLeft - paddingRight, dest.Height - paddingTop - paddingBottom),
                            new Rectangle(paddingLeft, paddingTop, texture.Width - paddingLeft - paddingRight, texture.Height - paddingLeft - paddingRight), color);

            g.Draw(texture, new Rectangle(dest.X + dest.Width - paddingRight, dest.Y + paddingTop, paddingRight, dest.Height - paddingTop - paddingBottom),
                            new Rectangle(texture.Width - paddingRight, paddingTop, paddingRight, texture.Height - paddingTop - paddingBottom), border);

            g.Draw(texture, new Rectangle(dest.X, dest.Y + dest.Height - paddingBottom, paddingLeft, paddingBottom),
                            new Rectangle(0, texture.Height - paddingBottom, paddingLeft, paddingBottom), border);

            g.Draw(texture, new Rectangle(dest.X + paddingLeft, dest.Y + dest.Height - paddingBottom, dest.Width - paddingLeft - paddingRight, paddingBottom),
                            new Rectangle(paddingLeft, texture.Height - paddingBottom, texture.Width - paddingLeft - paddingRight, paddingBottom), border);

            g.Draw(texture, new Rectangle(dest.X + dest.Width - paddingRight, dest.Y + dest.Height - paddingBottom, paddingLeft, paddingBottom),
                            new Rectangle(texture.Width - paddingRight, texture.Height - paddingBottom, paddingLeft, paddingBottom), border);
        }
开发者ID:olofn,项目名称:db_public,代码行数:29,代码来源:BorderBox.cs

示例2: AlgorithmDrawable

 /// <summary>
 /// Алгоритм отрисовки кисти
 /// </summary>
 /// <param name="graphics"></param>
 /// <param name="gameTime"></param>
 /// <param name="rectangle"></param>
 public override void AlgorithmDrawable(Graphics graphics, GameTime gameTime, Rectangle rectangle)
 {
     if (Texture != null)
         graphics.Draw(Texture, rectangle, Color);
 }
开发者ID:gavrilyuc,项目名称:xnaControl,代码行数:11,代码来源:SolidTextureBrush.cs

示例3: Draw

        public override void Draw(Graphics.TGPASpriteBatch spriteBatch)
        {
            Color c = Color.White;

            if (IsHit)
            {
                c = (Color.Red * 0.75f);
                IsHit = false;
            }

            Rectangle eyesDstRect = new Rectangle(
                (int)(this.location.X + eyesLoc.X),
                (int)(this.location.Y + eyesLoc.Y),
                eyesSRect.Width,
                eyesSRect.Height
                );

            Rectangle appendiceDstRect = new Rectangle(
                    (int)(this.location.X + eyesLoc.X),
                    (int)(this.location.Y + eyesLoc.Y),
                    appendiceSRect.Width,
                    appendiceSRect.Height
                    );

            spriteBatch.Begin();

            //Appendice
            spriteBatch.Draw(this.Sprite, appendiceDstRect, appendiceSRect, c, 0.0f, Vector2.Zero, Flip, 1.0f);

            //Body
            spriteBatch.Draw(this.Sprite, dRect, sRect, c, 0.0f, Vector2.Zero, Flip, 1.0f);

            //Eyes
            spriteBatch.Draw(this.Sprite, eyesDstRect, eyesSRect, c, 0.0f, Vector2.Zero, Flip, 1.0f);

            spriteBatch.End();
        }
开发者ID:Azzhag,项目名称:The-Great-Paper-Adventure,代码行数:37,代码来源:KingPoulpi.cs

示例4: Render

 public virtual void Render(float time, Graphics.GraphicsDevice dev)
 {
     if (model != null && mat != null)
     {
         if (mat != null)
             dev.SetActiveMaterial(mat);
         dev.SetVertexBuffer(model.VertexBuffer);
         foreach (var part in model.Parts)
         {
             dev.SetIndexBuffer(part.IndexBuffer);
             dev.Draw(Graphics.DrawMode.Triangles);
         }
         dev.SetIndexBuffer(null);
         dev.SetVertexBuffer(null);
         dev.SetActiveMaterial(null);
     }
 }
开发者ID:r-bel,项目名称:glorg2,代码行数:17,代码来源:DynamicMesh.cs

示例5: MergeTexturesGradient

 public static void MergeTexturesGradient(RenderTarget2D textureBack, RenderTarget2D textureFront, ref RenderTarget2D output, 
     int state, Graphics.Renderer renderer)
 {
     var fbo = renderer.CurFBO;
     renderer.EnableFBO(output);
     renderer.BeginUnscaled();
     renderer.Draw(textureBack, new Rectangle(0, 0, output.Width, output.Height), Color.White);
     renderer.End();
     renderer.MaskClear();
     renderer.MaskBeginDrawOnUnScaled();
     int h = output.Height;
     if (state > 0)
     {
         renderer.Draw(Graphics.GraphicsEngine.FadeTriangle,
             new Rectangle(0, 0, state, h), new Rectangle(0, 0, 1, 1), Color.White);
     }
     renderer.Draw(Graphics.GraphicsEngine.FadeTriangle,
         new Rectangle(state, 0, h, h),
         new Rectangle(0, 0, 256, 256),
         Color.White);
     if (state < output.Width - h)
     {
         //renderer.Draw(Graphics.GraphicsEngine.pixel,
         //    new Rectangle(state + h, 0,
         //        output.Width - state - h, h), Color.Black);
     }
     renderer.MaskUse();
     renderer.Draw(textureFront, new Rectangle(0, 0, output.Width, output.Height), Color.White);
     renderer.End();
     renderer.EnableFBO(fbo);
 }
开发者ID:XZelnar,项目名称:MicroWorld,代码行数:31,代码来源:Graphical.cs

示例6: AlgorithmDrawable

 /// <summary/>
 public override void AlgorithmDrawable(Graphics graphics, GameTime gameTime, IDrawablingTransformation region)
 {
     graphics.Draw(Texture, region.ClientRectangle, Region, Color);
 }
开发者ID:gavrilyuc,项目名称:xnaControl,代码行数:5,代码来源:SolidRegionedTextureBrush.cs

示例7: Render

 public void Render(float time, Graphics.GraphicsDevice dev)
 {
     dev.SetActiveMaterial(mat);
     dev.SetVertexBuffer(vb);
     dev.SetIndexBuffer(ib);
     dev.Draw(DrawMode.Lines);
     dev.SetActiveMaterial(null);
     dev.SetVertexBuffer(null);
     dev.SetIndexBuffer(null);
 }
开发者ID:r-bel,项目名称:glorg2,代码行数:10,代码来源:Camera.cs


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