本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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);
}
}
示例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);
}
示例6: AlgorithmDrawable
/// <summary/>
public override void AlgorithmDrawable(Graphics graphics, GameTime gameTime, IDrawablingTransformation region)
{
graphics.Draw(Texture, region.ClientRectangle, Region, Color);
}
示例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);
}