本文整理汇总了C#中Brush类的典型用法代码示例。如果您正苦于以下问题:C# Brush类的具体用法?C# Brush怎么用?C# Brush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Brush类属于命名空间,在下文中一共展示了Brush类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Brush
public Brush(Brush brush)
{
Color = brush.Color;
Background = brush.Background;
BitmapId = brush.BitmapId;
FillStyle = brush.FillStyle;
}
示例2: PieChart
public PieChart(float fltCount, float fltTotal, Color c)
{
this.fltCount = fltCount;
this.fltTotal = fltTotal;
this.colorSlice = c;
this.brushSlice = new SolidBrush(c);
}
示例3: Button
public Button(string pText, float pX, float pY, float pWidth, float pHeight, bool pSmall)
{
width = pWidth;
height = pHeight;
x = pX;
y = pY;
// Text properties
var brushProp = new LinearGradientBrushProperties();
brushProp.StartPoint = new Vector2(x, y);
brushProp.EndPoint = new Vector2(x, y + height);
var stops = new GradientStop[2];
stops[0] = new GradientStop() { Color = new Color4(1, 1, 1, 0.5f), Position = 0 };
stops[1] = new GradientStop() { Color = new Color4(1, 1, 1, 1.0f), Position = 1 };
textBrush = new LinearGradientBrush(GraphicsWindow.Instance.RenderTarget2D, brushProp, new GradientStopCollection(GraphicsWindow.Instance.RenderTarget2D, stops));
textLayout = new TextLayout(Factories.FactoryWrite, pText, pSmall? Constants.SmallFont : Constants.RegularFont, width, height);
// Frame properties
borderBrush = new SolidColorBrush(GraphicsWindow.Instance.RenderTarget2D, new Color4(0, 0, 0, 0.3f));
backBrush = new SolidColorBrush(GraphicsWindow.Instance.RenderTarget2D, new Color4(0.1f, 0.3f, 0.4f, 0.5f));
highlightBrush = new SolidColorBrush(GraphicsWindow.Instance.RenderTarget2D, new Color4(0.2f, 0.6f, 0.8f, 0.5f));
highlight = false;
}
示例4: CreateRectangle
public static Rectangle CreateRectangle(Brush brush)
{
Rectangle rt = new Rectangle();
rt.Fill = brush;
return rt;
}
示例5: Initialize
public virtual void Initialize(DeviceManager deviceManager)
{
sceneColorBrush = new SolidColorBrush(deviceManager.ContextDirect2D, Color.Blue);
textFormat = new TextFormat(deviceManager.FactoryDirectWrite, "Calibri", 20) { TextAlignment = TextAlignment.Leading, ParagraphAlignment = ParagraphAlignment.Center };
clock = Stopwatch.StartNew();
deviceManager.ContextDirect2D.TextAntialiasMode = TextAntialiasMode.Grayscale;
}
示例6: Awake
override protected void Awake() {
base.Awake();
wizard = GameObject.Find("Wizard").GetComponent<Wizard>();
candy = GameObject.Find("Candy").GetComponent<Candy>();
eraserBrush = GameObject.Find("EraserBrush").GetComponent<Brush>();
}
示例7: Initialize
public virtual void Initialize(DeviceManager deviceManager)
{
sceneColorBrush = new SolidColorBrush(deviceManager.ContextDirect2D, Colors.White);
clock = Stopwatch.StartNew();
}
示例8: BrushToNativeBrush
private System.Drawing.Brush BrushToNativeBrush(Brush brush)
{
if (brush is SolidBrush)
{
return new System.Drawing.SolidBrush(ColorToNativeColor((brush as SolidBrush).Color));
}
else if (brush is LinearGradientBrush)
{
LinearGradientBrush b = (brush as LinearGradientBrush);
System.Drawing.Drawing2D.LinearGradientBrush lgb = new System.Drawing.Drawing2D.LinearGradientBrush(RectangleToNativeRectangleF(b.Bounds), ColorToNativeColor(b.ColorStops[0].Color), ColorToNativeColor(b.ColorStops[b.ColorStops.Count - 1].Color), LinearGradientBrushOrientationToLinearGradientMode(b.Orientation));
if (b.ColorStops.Count > 2)
{
List<System.Drawing.Color> colorList = new List<System.Drawing.Color>();
List<float> positionList = new List<float>();
for (int i = 0; i < b.ColorStops.Count; i++)
{
colorList.Add(ColorToNativeColor(b.ColorStops[i].Color));
positionList.Add((float)(b.ColorStops[i].Position.ConvertTo(MeasurementUnit.Decimal).Value));
}
System.Drawing.Drawing2D.ColorBlend blend = new System.Drawing.Drawing2D.ColorBlend(b.ColorStops.Count);
blend.Colors = colorList.ToArray();
blend.Positions = positionList.ToArray();
lgb.InterpolationColors = blend;
}
return lgb;
}
return null;
}
示例9: DrawRectangle
private void DrawRectangle(Brush brush, float width, float height, float lineWidth) {
surfaceGraphics.FillRectangle(brush,
-width / 2f - lineWidth,
-height / 2f - lineWidth,
width + 2f * lineWidth,
height + 2f * lineWidth);
}
示例10: Set
public Brush Set(Brush brush)
{
Sprite = brush.Sprite;
Angle = brush.Angle;
Scale = brush.Scale;
return this;
}
示例11: GenerateImage
private void GenerateImage(
HttpResponse response,
string textToInsert,
int width,
int height,
Color backgroundColor,
FontFamily fontFamily,
float emSize,
Brush brush,
float x,
float y,
string contentType,
ImageFormat imageFormat)
{
using (Bitmap bitmap = new Bitmap(width, height))
{
using (Graphics graphics = Graphics.FromImage(bitmap))
{
graphics.Clear(backgroundColor);
graphics.DrawString(textToInsert, new Font(fontFamily, emSize), brush, x, y);
response.ContentType = contentType;
bitmap.Save(response.OutputStream, imageFormat);
}
}
}
示例12: PerspexTextRenderer
public PerspexTextRenderer(
RenderTarget target,
Brush foreground)
{
this.renderTarget = target;
this.foreground = foreground;
}
示例13: Element
protected Element (Pen pen, Brush brush)
{
Id = "";
Pen = pen;
Brush = brush;
Transform = NGraphics.Transform.Identity;
}
示例14: RectangleRenderUnit
/// <summary>
/// Initializes a new instance of the <see cref="RectangleRenderUnit" /> class.
/// </summary>
/// <param name="rectangle">The rectangle.</param>
/// <param name="stroke">The stroke.</param>
/// <param name="fill">The fill.</param>
/// <param name="thickness">The thickness.</param>
public RectangleRenderUnit(RectangleF rectangle, Brush stroke, Brush fill, float thickness)
{
this.rectangle = rectangle;
this.stroke = stroke;
this.fill = fill;
this.thickness = thickness;
}
示例15: Element
public Element(Pen pen, Brush brush)
{
Id = Guid.NewGuid ().ToString ();
Pen = pen;
Brush = brush;
Transform = NGraphics.Transform.Identity;
}