protected override void OnDraw(Canvas canvas) { if (!_drawRectangle) { return; } var scale = _screenPixelsWidth / Element.Width; var points = new Path(); points.MoveTo((float)(_holeLayerView.TopLeftCorner.X * scale), (float)(_holeLayerView.TopLeftCorner.Y * scale)); points.LineTo((float)(_holeLayerView.TopRightCorner.X * scale), (float)(_holeLayerView.TopRightCorner.Y * scale)); points.LineTo((float)(_holeLayerView.BottomRightCorner.X * scale), (float)(_holeLayerView.BottomRightCorner.Y * scale)); points.LineTo((float)(_holeLayerView.BottomLeftCorner.X * scale), (float)(_holeLayerView.BottomLeftCorner.Y * scale)); points.LineTo((float)(_holeLayerView.TopLeftCorner.X * scale), (float)(_holeLayerView.TopLeftCorner.Y * scale)); points.Close(); var transparentPaint = new Paint { Color = Color.Transparent }; transparentPaint.SetXfermode(new PorterDuffXfermode(PorterDuff.Mode.Clear)); var borderPaint = new Paint { Color = Color.Black, StrokeWidth = 4 }; borderPaint.SetStyle(Paint.Style.Stroke); canvas.DrawColor(Color.Argb(150, 0, 0, 0)); canvas.DrawPath(points, transparentPaint); canvas.DrawPath(points, borderPaint); }
void CreateColor() { _color = AColor.Argb( (int)Element.ShadowOpacity * 255, (int)Element.ShadowColor.R * 255, (int)Element.ShadowColor.G * 255, (int)Element.ShadowColor.B * 255); }
private void Initialize() { _showVehicleNumber = this.Services().Settings.ShowAssignedVehicleNumberOnPin; _isClusterMarkerDisabled = this.Services().Settings.ShowIndividualTaxiMarkerOnly; var useCompanyColor = this.Services().Settings.UseThemeColorForMapIcons; var companyColor = Resources.GetColor(Resource.Color.company_color); var red = Color.Argb(255, 255, 0, 23); var green = Color.Argb(255, 30, 192, 34); _destinationIcon = BitmapDescriptorFactory.FromBitmap(DrawHelper.ApplyColorToMapIcon(Resource.Drawable.@destination_icon, useCompanyColor ? companyColor : red, true)); _hailIcon = BitmapDescriptorFactory.FromBitmap(DrawHelper.ApplyColorToMapIcon(Resource.Drawable.@hail_icon, useCompanyColor ? companyColor : green, true)); }
public static AColor ColorAtPoint(this Bitmap bitmap, int x, int y, bool includeAlpha = false) { int pixel = bitmap.GetPixel(x, y); int red = AColor.GetRedComponent(pixel); int blue = AColor.GetBlueComponent(pixel); int green = AColor.GetGreenComponent(pixel); if (includeAlpha) { int alpha = AColor.GetAlphaComponent(pixel); return(AColor.Argb(alpha, red, green, blue)); } else { return(AColor.Rgb(red, green, blue)); } }
protected override void Draw(Canvas canvas, Rect bounds) { RectF arcBounds = mTempBounds; arcBounds.Set(bounds); arcBounds.Inset(mStrokeInset, mStrokeInset); mCurrentBounds.Set(arcBounds); int saveCount = canvas.Save(); //draw circle trim float startAngle = (mStartTrim + mRotation) * 360; float endAngle = (mEndTrim + mRotation) * 360; float sweepAngle = endAngle - startAngle; if (sweepAngle != 0) { mPaint.Color = new Color(mColor); mPaint.SetStyle(Paint.Style.Stroke); canvas.DrawArc(arcBounds, startAngle, sweepAngle, false, mPaint); } //draw water wave if (mWaveProgress < 1.0f) { var nColor = new Color(mColor); mPaint.Color = Color.Argb((int)(Color.GetAlphaComponent(mColor) * (1.0f - mWaveProgress)), Color.GetRedComponent(mColor), Color.GetGreenComponent(mColor), Color.GetBlueComponent(mColor)); mPaint.SetStyle(Paint.Style.Stroke); float radius = Math.Min(arcBounds.Width(), arcBounds.Height()) / 2.0f; canvas.DrawCircle(arcBounds.CenterX(), arcBounds.CenterY(), radius * (1.0f + mWaveProgress), mPaint); } //draw ball bounce if (mPathMeasure != null) { mPaint.Color = new Color(mBallColor); mPaint.SetStyle(Paint.Style.Fill); canvas.DrawCircle(mCurrentPosition[0], mCurrentPosition[1], mSkipBallSize * mScale, mPaint); } canvas.RestoreToCount(saveCount); }