public override void paint(PaintingContext context, Offset offset) { if (this._overflow <= 0.0f) { this.defaultPaint(context, offset); return; } if (this.size.isEmpty) { return; } context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, this.defaultPaint); D.assert(() => { string debugOverflowHints = $"The overflowing {this.GetType()} has an orientation of {this._direction}.\n" + $"The edge of the {this.GetType()} that is overflowing has been marked " + "in the rendering with a yellow and black striped pattern. This is " + $"usually caused by the contents being too big for the {this.GetType()}. " + "Consider applying a flex factor (e.g. using an Expanded widget) to " + $"force the children of the {this.GetType()} to fit within the available " + "space instead of being sized to their natural size.\n" + "This is considered an error condition because it indicates that there " + "is content that cannot be seen. If the content is legitimately bigger " + "than the available space, consider clipping it with a ClipRect widget " + "before putting it in the flex, or using a scrollable container rather " + "than a Flex, like a ListView."; Rect overflowChildRect; switch (this._direction) { case Axis.horizontal: overflowChildRect = Rect.fromLTWH(0.0f, 0.0f, this.size.width + this._overflow, 0.0f); break; case Axis.vertical: overflowChildRect = Rect.fromLTWH(0.0f, 0.0f, 0.0f, this.size.height + this._overflow); break; default: throw new Exception("Unknown direction: " + this._direction); } DebugOverflowIndicatorMixin.paintOverflowIndicator(this, context, offset, Offset.zero & this.size, overflowChildRect, overflowHints: debugOverflowHints); return(true); }); }
public override void paint(PaintingContext context, Offset offset) { if (this._hoverAnnotation != null) { AnnotatedRegionLayer <MouseTrackerAnnotation> layer = new AnnotatedRegionLayer <MouseTrackerAnnotation>( this._hoverAnnotation, size: this.size, offset: offset); context.pushLayer(layer, this.paintParagraph, offset); } else { this.paintParagraph(context, offset); } }
public override void paint(PaintingContext context, Offset offset) { float visualPosition = 0.0f; Color leftColor = null; Color rightColor = null; switch (textDirection) { case TextDirection.rtl: visualPosition = 1.0f - _position.value; leftColor = _activeColor; rightColor = trackColor; break; case TextDirection.ltr: visualPosition = _position.value; leftColor = trackColor; rightColor = _activeColor; break; } float trackCenter = offset.dy + size.height / 2.0f; float trackLeft = offset.dx + _trackLeft; float trackTop = trackCenter - 1.0f; float trackBottom = trackCenter + 1.0f; float trackRight = offset.dx + _trackRight; float trackActive = offset.dx + _thumbCenter; Canvas canvas = context.canvas; if (visualPosition > 0.0f) { Paint paint = new Paint(); paint.color = rightColor; canvas.drawRRect(RRect.fromLTRBXY(trackLeft, trackTop, trackActive, trackBottom, 1.0f, 1.0f), paint); } if (visualPosition < 1.0f) { Paint paint = new Paint(); paint.color = leftColor; canvas.drawRRect(RRect.fromLTRBXY(trackActive, trackTop, trackRight, trackBottom, 1.0f, 1.0f), paint); } Offset thumbCenter = new Offset(trackActive, trackCenter); new CupertinoThumbPainter(color: thumbColor).paint(canvas, Rect.fromCircle(center: thumbCenter, radius: CupertinoThumbPainter.radius)); }
public override void paint(PaintingContext context, Offset offset) { if (this.child == null || this.size.isEmpty) { return; } if (!this._isOverflowing) { base.paint(context, offset); return; } context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, base.paint); }
public override void paint(PaintingContext context, Offset offset) { if (this._overflow <= 0.0) { this.defaultPaint(context, offset); return; } if (this.size.isEmpty) { return; } context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, this.defaultPaint); }
public override void paint(PaintingContext context, Offset offset) { if (_painter != null) { _paintWithPainter(context.canvas, offset, _painter); _setRasterCacheHints(context); } base.paint(context, offset); if (_foregroundPainter != null) { _paintWithPainter(context.canvas, offset, _foregroundPainter); _setRasterCacheHints(context); } }
public override void paint(PaintingContext context, Offset offset) { D.assert(imageFilter != null); if (layer == null) { layer = new ImageFilterLayer(imageFilter: imageFilter); } else { ImageFilterLayer filterLayer = layer as ImageFilterLayer; filterLayer.imageFilter = imageFilter; } context.pushLayer(layer, base.paint, offset); D.assert(layer != null); }
void _paintTransformedChild(RenderBox child, PaintingContext context, Offset offset, Offset layoutOffset) { Offset untransformedPaintingCoordinates = offset + new Offset( layoutOffset.dx, this._getUntransformedPaintingCoordinateY(layoutOffset.dy) ); float fractionalY = (untransformedPaintingCoordinates.dy + this._itemExtent / 2.0f) / this.size.height; float angle = -(fractionalY - 0.5f) * 2.0f * this._maxVisibleRadian; if (angle > Mathf.PI / 2.0f || angle < -Mathf.PI / 2.0f) { return; } var radius = this.size.height * this._diameterRatio / 2.0f; var deltaY = radius * Mathf.Sin(angle); Matrix3 transform = Matrix3.I(); // Matrix4x4 transform2 = MatrixUtils.createCylindricalProjectionTransform( // radius: this.size.height * this._diameterRatio / 2.0f, // angle: angle, // perspective: this._perspective // ); // Offset offsetToCenter = new Offset(untransformedPaintingCoordinates.dx, -this._topScrollMarginExtent); Offset offsetToCenter = new Offset(untransformedPaintingCoordinates.dx, -deltaY - this._topScrollMarginExtent); if (!this.useMagnifier) { this._paintChildCylindrically(context, offset, child, transform, offsetToCenter); } else { this._paintChildWithMagnifier( context, offset, child, transform, offsetToCenter, untransformedPaintingCoordinates ); } }
public override void paint(PaintingContext context, Offset offset) { void doPaint(RenderBox child) { if (child != null) { BoxParentData parentData = (BoxParentData)child.parentData; context.paintChild(child, parentData.offset + offset); } } doPaint(this.leading); doPaint(this.title); doPaint(this.subtitle); doPaint(this.trailing); }
public override void paint(PaintingContext context, Offset offset) { if (child == null) { return; } _ToolbarParentData childParentData = child.parentData as _ToolbarParentData; context.pushClipPath( needsCompositing, offset + childParentData.offset, Offset.zero & child.size, _clipPath(), (PaintingContext innerContext, Offset innerOffset) => innerContext.paintChild(child, innerOffset) ); }
public override void paint( PaintingContext context, Offset center, Animation <float> activationAnimation = null, Animation <float> enableAnimation = null, bool isDiscrete = false, TextPainter labelPainter = null, RenderBox parentBox = null, SliderThemeData sliderTheme = null, TextDirection?textDirection = null, float?value = null) { Canvas canvas = context.canvas; ColorTween enableColor = new ColorTween( begin: sliderTheme.disabledThumbColor, end: sliderTheme.valueIndicatorColor ); Tween <float> slideUpTween = new FloatTween( begin: 0.0f, end: _slideUpHeight ); float size = _indicatorSize * sizeTween.evaluate(enableAnimation); Offset slideUpOffset = new Offset(0.0f, -slideUpTween.evaluate(activationAnimation)); Path thumbPath = SliderDemoUtils._upTriangle(size, center + slideUpOffset); Color paintColor = enableColor.evaluate(enableAnimation) .withAlpha((255.0f * activationAnimation.value).round()); canvas.drawPath( thumbPath, new Paint { color = paintColor } ); canvas.drawLine( center, center + slideUpOffset, new Paint { color = paintColor, style = PaintingStyle.stroke, strokeWidth = 2.0f }); labelPainter.paint(canvas, center + slideUpOffset + new Offset(-labelPainter.width / 2.0f, -labelPainter.height - 4.0f)); }
public override void paint(PaintingContext context, Offset offset) { MultiChildLayoutParentData contentParentData = contentSection.parentData as MultiChildLayoutParentData; contentSection.paint(context, offset + contentParentData.offset); bool hasDivider = contentSection.size.height > 0.0f && actionsSection.size.height > 0.0f; if (hasDivider) { _paintDividerBetweenContentAndActions(context.canvas, offset); } MultiChildLayoutParentData actionsParentData = actionsSection.parentData as MultiChildLayoutParentData; actionsSection.paint(context, offset + actionsParentData.offset); }
void _paintChildCylindrically( PaintingContext context, Offset offset, RenderBox child, // Matrix4x4 cylindricalTransform, Matrix3 cylindricalTransform, Offset offsetToCenter ) { context.pushTransform( false, offset, cylindricalTransform, // this._centerOriginTransform(cylindricalTransform), (PaintingContext _context, Offset _offset) => { _context.paintChild(child, _offset + offsetToCenter); } ); }
public override void paint(PaintingContext context, Offset offset) { this._layoutTextWithConstraints(this.constraints); var canvas = context.canvas; if (this._hasVisualOverflow) { var bounds = offset & this.size; canvas.save(); canvas.clipRect(bounds); } this._textPainter.paint(canvas, offset); if (this._hasVisualOverflow) { canvas.restore(); } }
public override void paint(PaintingContext context, Offset offset) { if (this.childCount > 0) { if (this._clipToSize && this._shouldClipAtCurrentOffset()) { context.pushClipRect( this.needsCompositing, offset, Offset.zero & this.size, this._paintVisibleChildren ); } else { this._paintVisibleChildren(context, offset); } } }
public override void paint(PaintingContext context, Offset offset) { if (this._inkFeatures != null && this._inkFeatures.isNotEmpty()) { Canvas canvas = context.canvas; canvas.save(); canvas.translate(offset.dx, offset.dy); canvas.clipRect(Offset.zero & this.size); foreach (InkFeature inkFeature in this._inkFeatures) { inkFeature._paint(canvas); } canvas.restore(); } base.paint(context, offset); }
void _paintTransformedChild(RenderBox child, PaintingContext context, Offset offset, Offset layoutOffset) { Offset untransformedPaintingCoordinates = offset + new Offset( layoutOffset.dx, _getUntransformedPaintingCoordinateY(layoutOffset.dy) ); float fractionalY = (untransformedPaintingCoordinates.dy + _itemExtent / 2.0f) / size.height; float angle = -(fractionalY - 0.5f) * 2.0f * _maxVisibleRadian / squeeze; if (angle > Mathf.PI / 2.0f || angle < -Mathf.PI / 2.0f) { return; } var radius = size.height * _diameterRatio / 2.0f; var deltaY = radius * Mathf.Sin(angle); Matrix4 transform = MatrixUtils.createCylindricalProjectionTransform( radius: size.height * _diameterRatio / 2.0f, angle: angle, perspective: _perspective ); // Offset that helps painting everything in the center (e.g. angle = 0). Offset offsetToCenter = new Offset( untransformedPaintingCoordinates.dx, -_topScrollMarginExtent ); bool shouldApplyOffCenterDim = overAndUnderCenterOpacity < 1; if (useMagnifier || shouldApplyOffCenterDim) { _paintChildWithMagnifier(context, offset, child, transform, offsetToCenter, untransformedPaintingCoordinates); } else { _paintChildCylindrically(context, offset, child, transform, offsetToCenter); } }
public override void paint(PaintingContext context, Offset offset) { if (this.child == null || this.size.isEmpty) { return; } if (!this._isOverflowing) { base.paint(context, offset); return; } context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, base.paint); D.assert(() => { DebugOverflowIndicatorMixin.paintOverflowIndicator(this, context, offset, this._overflowContainerRect, this._overflowChildRect); return(true); }); }
public override void paint(PaintingContext context, Offset offset) { if (child != null) { if (_alpha == 0) { layer = null; return; } if (_alpha == 255) { layer = null; context.paintChild(child, offset); return; } D.assert(needsCompositing); layer = context.pushOpacity(offset, _alpha, base.paint, oldLayer: layer as OpacityLayer); } }
private static void InsertPainting() { var painting = new Painting { Title = "A Walk in the Woods", Season = 1, Episode = 1, Description = "The very first episode of 'The Joy of Painting' with Bob Ross.", ThumbnailFile = "~/Images/Thumbnails/S01E01.png", VideoURL = "https://www.youtube.com/embed/oh5p5f5_-7A", }; using (var context = new PaintingContext()) { Console.WriteLine(context.Database.CurrentTransaction); context.Paintings.Add(painting); context.SaveChanges(); } }
public override void paint(PaintingContext context, Offset offset) { RenderBox child = this.firstChild; int i = 0; while (child != null) { ListBodyParentData childParentData = (ListBodyParentData)child.parentData; Rect rect = (childParentData.offset + offset) & child.size; if (i % 2 == 0) { this._paintShadows(context.canvas, rect); } child = childParentData.nextSibling; i++; } this.defaultPaint(context, offset); }
public override void paint(PaintingContext context, Offset offset) { if (this.child != null) { Offset paintOffset = this._paintOffset; void paintContents(PaintingContext subContext, Offset SubOffset) { subContext.paintChild(this.child, SubOffset + paintOffset); } if (this._shouldClipAtPaintOffset(paintOffset)) { context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, paintContents); } else { paintContents(context, offset); } } }
void _paintContents(PaintingContext context, Offset offset) { D.assert(this._textLayoutLastWidth == this.constraints.maxWidth); var effectiveOffset = offset + this._paintOffset; if (this._selection != null && this._selection.isValid) { if (this._selection.isCollapsed && this._showCursor.value && this.cursorColor != null) { this._paintCaret(context.canvas, effectiveOffset); } else if (!this._selection.isCollapsed && this._selectionColor != null) { this._selectionRects = this._selectionRects ?? this._textPainter.getBoxesForSelection(this._selection); this._paintSelection(context.canvas, effectiveOffset); } } this._textPainter.paint(context.canvas, effectiveOffset); }
public override void paint(PaintingContext context, Offset offset) { if (this._image == null) { return; } ImageUtils.paintImage( canvas: context.canvas, rect: offset & this.size, image: this._image, scale: this._scale, colorFilter: this._colorFilter, fit: this._fit, alignment: this._alignment, centerSlice: this._centerSlice, repeat: this._repeat, invertColors: this._invertColors, filterMode: this._filterMode ); }
public override void paint(PaintingContext context, Offset offset) { Canvas canvas = context.canvas; this.paintRadialReaction(canvas, offset, this.size.center(Offset.zero)); Offset center = (offset & this.size).center; Color radioColor = this.onChanged != null ? this.activeColor : this.inactiveColor; Paint paint = new Paint(); paint.color = Color.lerp(this.inactiveColor, radioColor, this.position.value); paint.style = PaintingStyle.stroke; paint.strokeWidth = 2.0f; canvas.drawCircle(center, RadioUtils._kOuterRadius, paint); if (!this.position.isDismissed) { paint.style = PaintingStyle.fill; canvas.drawCircle(center, RadioUtils._kInnerRadius * this.position.value, paint); } }
void _paintThumb(PaintingContext context, Offset offset, Rect thumbRect) { List <BoxShadow> thumbShadow = new List <BoxShadow> { new BoxShadow( color: new Color(0x1F000000), offset: new Offset(0, 3), blurRadius: 8 ), new BoxShadow( color: new Color(0x0A000000), offset: new Offset(0, 3), blurRadius: 1 ) }; RRect thumbRRect = RRect.fromRectAndRadius(thumbRect.shift(offset), CupertinoSlidingSegmentedControlsUtils._kThumbRadius); foreach (BoxShadow shadow in thumbShadow) { context.canvas.drawRRect(thumbRRect.shift(shadow.offset), shadow.toPaint()); } context.canvas.drawRRect( thumbRRect.inflate(0.5f), new Paint() { color = new Color(0x0A000000) } ); context.canvas.drawRRect( thumbRRect, new Paint() { color = thumbColor } ); }
void paint(PaintingContext context, Offset offset) { float visualPosition; Color leftColor; Color rightColor; visualPosition = this._position.value; leftColor = SliderUtils._kTrackColor; rightColor = this._activeColor; float trackCenter = offset.dy + this.size.height / 2.0f; float trackLeft = offset.dx + this._trackLeft; float trackTop = trackCenter - 1.0f; float trackBottom = trackCenter + 1.0f; float trackRight = offset.dx + this._trackRight; float trackActive = offset.dx + this._thumbCenter; Canvas canvas = context.canvas; if (visualPosition > 0.0f) { Paint paint = new Paint(); paint.color = rightColor; canvas.drawRRect(RRect.fromLTRBXY(trackLeft, trackTop, trackActive, trackBottom, 1.0f, 1.0f), paint); } if (visualPosition < 1.0f) { Paint paint = new Paint(); paint.color = leftColor; canvas.drawRRect(RRect.fromLTRBXY(trackActive, trackTop, trackRight, trackBottom, 1.0f, 1.0f), paint); } Offset thumbCenter = new Offset(trackActive, trackCenter); this._thumbPainter.paint(canvas, Rect.fromCircle(center: thumbCenter, radius: CupertinoThumbPainter.radius)); }
public override void paint(PaintingContext context, Offset offset) { if (_image == null) { return; } _resolve(); D.assert(_resolvedAlignment != null); painting_.paintImage( canvas: context.canvas, rect: offset & size, image: _image, scale: _scale, colorFilter: _colorFilter, fit: _fit, alignment: _resolvedAlignment, centerSlice: _centerSlice, repeat: _repeat, flipHorizontally: _flipHorizontally, invertColors: invertColors, filterQuality: _filterQuality ); }
public override void paint( PaintingContext context, Offset center, Animation <float> activationAnimation = null, Animation <float> enableAnimation = null, bool isDiscrete = false, TextPainter labelPainter = null, RenderBox parentBox = null, SliderThemeData sliderTheme = null, TextDirection?textDirection = null, float?value = null) { Canvas canvas = context.canvas; ColorTween colorTween = new ColorTween( begin: sliderTheme.disabledThumbColor, end: sliderTheme.thumbColor ); float size = _thumbSize * sizeTween.evaluate(enableAnimation); Path thumbPath = SliderDemoUtils._downTriangle(size, center); canvas.drawPath(thumbPath, new Paint { color = colorTween.evaluate(enableAnimation) }); }
public override void paint(PaintingContext context, Offset offset) { RaycastManager.UpdateSizeOffset(widgetHashCode, windowHashCode, size, offset); base.paint(context, offset); }