void _paintSide(Canvas canvas, Size size, _GlowController controller, AxisDirection axisDirection, GrowthDirection growthDirection) { if (controller == null) { return; } switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(axisDirection, growthDirection)) { case AxisDirection.up: controller.paint(canvas, size); break; case AxisDirection.down: canvas.save(); canvas.translate(0.0f, size.height); canvas.scale(1.0f, -1.0f); controller.paint(canvas, size); canvas.restore(); break; case AxisDirection.left: canvas.save(); canvas.rotate(piOver2); canvas.scale(1.0f, -1.0f); controller.paint(canvas, new Size(size.height, size.width)); canvas.restore(); break; case AxisDirection.right: canvas.save(); canvas.translate(size.width, 0.0f); canvas.rotate(piOver2); controller.paint(canvas, new Size(size.height, size.width)); canvas.restore(); break; } }
public override void paint(Canvas canvas, Size size) { canvas.scale(scale ?? 1.0f, scale ?? 1.0f); if (shouldMirror == true) { canvas.rotate(Mathf.PI); canvas.translate(-size.width, -size.height); } float clampedProgress = progress.value.clamp(0.0f, 1.0f); foreach (_PathFrames path in paths) { path.paint(canvas, color, uiPathFactory, clampedProgress); } }
public override void paint(Canvas canvas, Size size) { if (!this._prepared) { this._prepare(); } canvas.translate(this._translationX(size.width), this._translationY(size.height)); canvas.rotate(this._rotation); canvas.drawRect(BannerConstants._kRect, this._paintShadow); canvas.drawRect(BannerConstants._kRect, this._paintBanner); const float width = BannerConstants._kOffset * 2.0f; this._textPainter.layout(minWidth: width, maxWidth: width); this._textPainter.paint(canvas, BannerConstants._kRect.topLeft + new Offset(0.0f, (BannerConstants._kRect.height - this._textPainter.height) / 2.0f)); }
public override void paint(Canvas canvas, Size size) { Paint paint = new Paint(); canvas.save(); canvas.translate(size.width / 2.0f, size.height / 2.0f); int activeTick = (CupertinoActivityIndicatorUtils._kTickCount * position.value).floor(); for (int i = 0; i < CupertinoActivityIndicatorUtils._kTickCount; ++i) { int t = ((i + activeTick) % CupertinoActivityIndicatorUtils._kTickCount); paint.color = activeColor.withAlpha(CupertinoActivityIndicatorUtils._alphaValues[t]); canvas.drawRRect(tickFundamentalRRect, paint); canvas.rotate(-CupertinoActivityIndicatorUtils._kTwoPI / CupertinoActivityIndicatorUtils._kTickCount); } canvas.restore(); }
public override void paint(Canvas canvas, Size size) { Paint paint = new Paint(); canvas.save(); canvas.translate(size.width / 2.0f, size.height / 2.0f); int activeTick = (CupertinoActivityIndicatorUtils._kTickCount * this.position.value).floor(); for (int i = 0; i < CupertinoActivityIndicatorUtils._kTickCount; ++i) { float t = (((i + activeTick) % CupertinoActivityIndicatorUtils._kTickCount) / CupertinoActivityIndicatorUtils._kHalfTickCount).clamp(0, 1); paint.color = Color.lerp(a: CupertinoActivityIndicatorUtils._kActiveTickColor, b: CupertinoActivityIndicatorUtils._kTickColor, t: t); canvas.drawRRect(rect: this.tickFundamentalRRect, paint: paint); canvas.rotate(-CupertinoActivityIndicatorUtils._kTwoPI / CupertinoActivityIndicatorUtils._kTickCount); } canvas.restore(); }
public static void paintZigZag(Canvas canvas, Paint paint, Offset start, Offset end, int zigs, float width) { D.assert(MathUtils.isFinite(zigs)); D.assert(zigs > 0); canvas.save(); canvas.translate(start.dx, start.dy); end = end - start; canvas.rotate(Mathf.Atan2(end.dy, end.dx)); float length = end.distance; float spacing = length / (zigs * 2.0f); Path path = new Path(); path.moveTo(0.0f, 0.0f); for (int index = 0; index < zigs; index += 1) { float x = (index * 2.0f + 1.0f) * spacing; float y = width * ((index % 2.0f) * 2.0f - 1.0f); path.lineTo(x, y); } path.lineTo(length, 0.0f); canvas.drawPath(path, paint); canvas.restore(); }