本文整理汇总了C#中Android.Graphics.Paint.SetARGB方法的典型用法代码示例。如果您正苦于以下问题:C# Paint.SetARGB方法的具体用法?C# Paint.SetARGB怎么用?C# Paint.SetARGB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Graphics.Paint
的用法示例。
在下文中一共展示了Paint.SetARGB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(Android.Graphics.Canvas canvas)
{
base.Draw (canvas);
Paint mBgPaints = new Paint ();
mBgPaints.AntiAlias = true;
mBgPaints.SetStyle (Paint.Style.Fill);
mBgPaints.Color = Color.Blue;
mBgPaints.StrokeWidth = 0.5f;
Paint tPaint = new Paint ();
tPaint.Alpha = 0;
canvas.DrawColor (tPaint.Color);
RectF mOvals = new RectF (40, 40, layout.MeasuredWidth - 40, layout.MeasuredHeight - 40);
decimal total = 0;
foreach (SecuritiesViewModel.PieChartValue value in securitiesViewModel.DataForPieChart ()) {
total += value.amount;
}
if (total == 0) {
return;
}
decimal degressPerAmount = 360 / total;
decimal currentAngle = 0;
foreach (SecuritiesViewModel.PieChartValue value in securitiesViewModel.DataForPieChart ()) {
canvas.DrawArc (mOvals, (float)currentAngle, (float)(degressPerAmount * value.amount), true, mBgPaints);
currentAngle += (degressPerAmount * value.amount);
mBgPaints.SetARGB (255, new Random ().Next (256), new Random ().Next (256), new Random ().Next (256));
}
}
示例2: ApplyCustomTypeFace
private static void ApplyCustomTypeFace(Paint paint, Typeface tf, Android.Graphics.Color color)
{
int oldStyle;
Typeface old = paint.Typeface;
if (old == null)
{
oldStyle = 0;
}
else
{
oldStyle = (int)old.Style;
}
int fake = oldStyle & ~(int)tf.Style;
if ((fake & (int)TypefaceStyle.Bold) != 0)
{
paint.FakeBoldText = true;
}
if ((fake & (int)TypefaceStyle.Italic) != 0)
{
paint.TextSkewX = -0.25f;
}
paint.SetARGB(color.A, color.R, color.G, color.B);
paint.SetTypeface(tf);
}
示例3: InitStepCountPaint
void InitStepCountPaint()
{
stepcountPaint = new Paint();
//stepcountPaint.Color = Color.White;
stepcountPaint.SetARGB(255, 50, 151, 218);
stepcountPaint.SetTypeface(Typeface.Create(Typeface.SansSerif, TypefaceStyle.Normal));
stepcountPaint.AntiAlias = true;
stepcountPaint.TextSize = owner.Resources.GetDimension(Resource.Dimension.StepCountTextSize);
}
示例4: OnDraw
protected override void OnDraw(Canvas canvas)
{
var paint = new Paint();
paint.SetARGB(255, 200, 255, 0);
paint.SetStyle(Paint.Style.Stroke);
paint.StrokeWidth = 4;
canvas.DrawCircle (200, 200, 180, paint);
}
示例5: CreateRectangle
private ShapeDrawable CreateRectangle(Color color)
{
ShapeDrawable rect = new ShapeDrawable(new RectShape());
var paint = new Paint();
paint.SetARGB(255,color.R,color.G,color.B);
paint.SetStyle(Paint.Style.Fill);
paint.StrokeWidth = 4;
rect.Paint.Set(paint);
return rect;
}
示例6: MyOvalShape
public MyOvalShape(Context context)
: base(context)
{
var paint = new Paint();
paint.SetARGB(255, 200, 255, 0);
paint.SetStyle(Paint.Style.Stroke);
paint.StrokeWidth = 4;
_shape = new ShapeDrawable(new OvalShape());
_shape.Paint.Set(paint);
_shape.SetBounds(20, 20, 300, 200);
}
示例7: CreateAnimationDrawer
public CreateAnimationDrawer(Context c, BrushItem brush, Canvas canvas, Bitmap myBmp, bool tooAdd = false, int cell = 1, string DrawerState = "brush_selection", Path pathToUse = null)
: base(c)
{
myBitmap = myBmp;
myCanvas = canvas;
DrawerStateInternal = DrawerState;
addOnly = tooAdd;
status = 0;
myPath = new Path();
myPaint = new Paint(PaintFlags.Dither);
myPaint.AntiAlias = true;
myPaint.Dither = true;
myPaint.SetStyle(Paint.Style.Stroke);
myPaint.StrokeJoin = Paint.Join.Round;
myPaint.StrokeWidth = brush.Thickness;
myPaint.StrokeCap = Paint.Cap.Round;
myPaint.SetARGB(colorUtil.a, colorUtil.r, colorUtil.g, colorUtil.b);
if (brush.BrushType == AnimationTypesBrushType.Spray)
myPaint.SetShadowLayer(brush.Thickness, 0, 0, ImageHelper.convWZColorToColor(brush.BrushColor));
if (DrawerState == "brush_selection")
{
if (pathToUse != null)
{
myBoundsPaint = new Paint();
myBoundsPaint = new Paint(PaintFlags.Dither);
myBoundsPaint.AntiAlias = true;
myBoundsPaint.Dither = true;
myBoundsPaint.SetStyle(Paint.Style.Stroke);
myBoundsPaint.StrokeJoin = Paint.Join.Round;
myBoundsPaint.StrokeWidth = 10f;
myBoundsPaint.StrokeCap = Paint.Cap.Round;
myBoundsPaint.SetARGB(255, 0, 0, 0);
myBoundsPaint.SetPathEffect(new DashPathEffect(new float[]
{
10f,
20f
}, 0));
myPath = pathToUse;
AnimationUtil.theCanvas.DrawPath(myPath, myPaint);
AnimationUtil.theCanvas.DrawPath(myPath, myPaint);
myBoundsRect = new RectF();
myPath.ComputeBounds(myBoundsRect, true);
AnimationUtil.theCanvas.DrawRect(myBoundsRect, myBoundsPaint);
}
}
}
示例8: Draw
public override void Draw(Canvas canvas)
{
var box = Element as CustomRoundedBox;
var rect = new Rect();
var paint = new Paint
{
AntiAlias = true,
};
paint.SetARGB((int)box.BackgroundColor.A, (int)box.BackgroundColor.R, (int)box.BackgroundColor.G, (int)box.BackgroundColor.B);
GetDrawingRect(rect);
var radius = (float)(rect.Width() / box.Width * box.CornerRadius);
canvas.DrawRoundRect(new RectF(rect), radius, radius, paint);
}
示例9: OverallView
public OverallView(Context context)
: base(context)
{
SetOnTouchListener(this);
SetBackgroundColor(Color.White);
var paint = new Paint();
paint.SetARGB(255, 200, 255, 0);
paint.SetStyle(Paint.Style.Stroke);
paint.StrokeWidth = 4;
_shape = new ShapeDrawable(new OvalShape());
_shape.Paint.Set(paint);
//_shape.SetBounds(20, 20, 300, 200);
}
示例10: Draw
public override void Draw(Canvas canvas)
{
var box = Element as RoundedBox;
var rect = new Rect();
var androidColor = box.BackgroundColor.ToAndroid();
var paint = new Paint()
{
AntiAlias = true,
};
paint.SetARGB(Convert.ToInt32(box.Opacity * 255), (int)androidColor.R, (int)androidColor.G, (int)androidColor.B);
GetDrawingRect(rect);
var radius = (float)(rect.Width() / box.Width * box.CornerRadius);
canvas.DrawRoundRect(new RectF(rect), radius, radius, paint);
}
示例11: InitDrawShape
void InitDrawShape()
{
_shape = null;
var paint = new Paint ();
paint.SetARGB (
_shapeViewModel.Shape.FilledColor.A,
_shapeViewModel.Shape.FilledColor.R,
_shapeViewModel.Shape.FilledColor.G,
_shapeViewModel.Shape.FilledColor.B);
paint.SetStyle (Paint.Style.FillAndStroke);
paint.StrokeWidth = 4;
_shape = new ShapeDrawable (new OvalShape ());
_shape.Paint.Set (paint);
_shape.SetBounds (
0,
0,
_shapeViewModel.Shape.Radius * 2,
_shapeViewModel.Shape.Radius * 2);
}
示例12: SetColorShapes
private static Paint[] SetColorShapes()
{
//Enemy Color
Paint red = new Paint();
red.SetARGB(255, 255, 0, 0);
red.SetStyle(Paint.Style.FillAndStroke);
red.StrokeWidth = 1;
//Player Color
Paint green = new Paint();
green.SetARGB(255, 0, 255, 0);
green.SetStyle(Paint.Style.FillAndStroke);
green.StrokeWidth = 1;
//Background Color
Paint white = new Paint();
white.SetARGB(255, 255, 255, 255);
white.SetStyle(Paint.Style.FillAndStroke);
white.StrokeWidth = 1;
return new Paint[] { red, green, white };
}
示例13: OnCreate
public override void OnCreate(ISurfaceHolder surfaceHolder)
{
SetWatchFaceStyle(new WatchFaceStyle.Builder(owner)
.SetCardPeekMode(WatchFaceStyle.PeekModeShort)
.SetBackgroundVisibility(WatchFaceStyle.BackgroundVisibilityInterruptive)
.SetShowSystemUiTime(true) // TODO: hide digital time display
.Build()
);
base.OnCreate(surfaceHolder);
var backgroundDrawable = ContextCompat.GetDrawable(owner, Resource.Drawable.XamarinWatchFaceBackground);
backgroundBitmap = (backgroundDrawable as BitmapDrawable).Bitmap;
hourPaint = new Paint();
hourPaint.SetARGB(255, 200, 200, 200);
hourPaint.StrokeWidth = 5.0f;
hourPaint.AntiAlias = true;
hourPaint.StrokeCap = Paint.Cap.Round;
minutePaint = new Paint();
minutePaint.SetARGB(255, 200, 200, 200);
minutePaint.StrokeWidth = 3.0f;
minutePaint.AntiAlias = true;
minutePaint.StrokeCap = Paint.Cap.Round;
secondPaint = new Paint();
secondPaint.SetARGB(255, 50, 151, 218);
//secondPaint.SetARGB(255, 255, 0, 0);
secondPaint.StrokeWidth = 2.0f;
secondPaint.AntiAlias = true;
secondPaint.StrokeCap = Paint.Cap.Round;
tickPaint = new Paint();
tickPaint.SetARGB(100, 200, 200, 200);
tickPaint.StrokeWidth = 2.0f;
tickPaint.AntiAlias = true;
calendar = new GregorianCalendar();
}
示例14: AddBrushPaint
private void AddBrushPaint(Paint paint, BaseBrush brush, Rect frame)
{
paint.SetStyle(Paint.Style.Fill);
var sb = brush as SolidBrush;
if (sb != null)
{
paint.SetARGB(sb.Color.A, sb.Color.R, sb.Color.G, sb.Color.B);
return;
}
var lgb = brush as LinearGradientBrush;
if (lgb != null)
{
var n = lgb.Stops.Count;
if (n >= 2)
{
var locs = new float[n];
var comps = new int[n];
for (var i = 0; i < n; i++)
{
var s = lgb.Stops[i];
locs[i] = (float) s.Offset;
comps[i] = s.Color.Argb;
}
var p1 = lgb.Absolute ? lgb.Start : frame.Position + lgb.Start*frame.Size;
var p2 = lgb.Absolute ? lgb.End : frame.Position + lgb.End*frame.Size;
var lg = new LinearGradient(
(float) p1.X, (float) p1.Y,
(float) p2.X, (float) p2.Y,
comps,
locs,
Shader.TileMode.Clamp);
paint.SetShader(lg);
}
return;
}
var rgb = brush as RadialGradientBrush;
if (rgb != null)
{
var n = rgb.Stops.Count;
if (n >= 2)
{
var locs = new float[n];
var comps = new int[n];
for (var i = 0; i < n; i++)
{
var s = rgb.Stops[i];
locs[i] = (float) s.Offset;
comps[i] = s.Color.Argb;
}
var p1 = rgb.GetAbsoluteCenter(frame);
var r = rgb.GetAbsoluteRadius(frame);
var rg = new RadialGradient(
(float) p1.X, (float) p1.Y,
(float) r.Max,
comps,
locs,
Shader.TileMode.Clamp);
paint.SetShader(rg);
}
return;
}
throw new NotSupportedException("Brush " + brush);
}
示例15: OnDraw
protected override void OnDraw(Canvas canvas)
{
base.OnDraw(canvas);
if (!this.IsInEditMode)
{
//if (((View)this.GetParent()).getVisibility() == VISIBLE && ((View)this.getParent()).getId() != id.bigSlider)
if (this.Visibility == ViewStates.Visible)
{
//draw the dragable slider(s)
//canvas.DrawBitmap(BitmapFactory.DecodeResource(Resource.Drawable.slidersmall, _touchingPoint.X, _touchingPoint.Y));
canvas.DrawBitmap(BitmapFactory.DecodeResource(Resources, Resource.Drawable.slidersmall), _touchingPoint.X, _touchingPoint.Y, null);
}
//else
//{
// //draw the dragable slider
// canvas.DrawBitmap(BitmapFactory.DecodeResource(Resource.Drawable.sliderbig, _touchingPoint.X, _touchingPoint.Y));
//}
//for debugging in edit mode
}
else
{
Paint innerCirclePaint = new Paint();
innerCirclePaint.SetARGB(255, 255, 255, 255);
innerCirclePaint.AntiAlias = true;
innerCirclePaint.SetStyle(Paint.Style.Fill);
canvas.DrawLine(21, 0, 21, 205, innerCirclePaint);
}
}