Esempio n. 1
0
 public override void paint(PaintingContext context, Offset offset)
 {
     if (this.child != null)
     {
         context.pushTransform(this.needsCompositing, offset, this._paintTransform, this._paintChild);
     }
 }
Esempio n. 2
0
        void _paintChildCylindrically(
            PaintingContext context,
            Offset offset,
            RenderBox child,
            Matrix4 cylindricalTransform,
            Offset offsetToCenter
            )
        {
            PaintingContextCallback painter = (PaintingContext _context, Offset _offset) => {
                _context.paintChild(
                    child,
                    _offset + offsetToCenter
                    );
            };
            PaintingContextCallback opacityPainter = (PaintingContext context2, Offset offset2) => {
                context2.pushOpacity(offset2, (overAndUnderCenterOpacity * 255).round(), painter);
            };

            context.pushTransform(
                needsCompositing,
                offset,
                _centerOriginTransform(cylindricalTransform),
                // Pre-transform painting function.
                overAndUnderCenterOpacity == 1 ? painter : opacityPainter
                );
        }
 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); }
         );
 }
Esempio n. 4
0
        public override void paint(PaintingContext context, Offset offset)
        {
            _layoutTextWithConstraints(constraints);

            D.assert(() => {
                if (RenderingDebugUtils.debugRepaintTextRainbowEnabled)
                {
                    Paint paint = new Paint();
                    paint.color = RenderingDebugUtils.debugCurrentRepaintColor.toColor();
                    context.canvas.drawRect(offset & size, paint);
                }
                return(true);
            });

            if (_needsClipping)
            {
                Rect bounds = offset & size;
                if (_overflowShader != null)
                {
                    context.canvas.saveLayer(bounds, new Paint());
                }
                else
                {
                    context.canvas.save();
                }
                context.canvas.clipRect(bounds);
            }
            _textPainter.paint(context.canvas, offset);

            RenderBox child      = firstChild;
            int       childIndex = 0;

            while (child != null && childIndex < _textPainter.inlinePlaceholderBoxes.Count)
            {
                TextParentData textParentData = child.parentData as TextParentData;

                float scale = textParentData.scale;
                context.pushTransform(
                    needsCompositing,
                    offset + textParentData.offset,
                    Matrix4.diagonal3Values(scale, scale, scale),
                    (PaintingContext context2, Offset offset2) => {
                    context2.paintChild(
                        child,
                        offset2
                        );
                });
                child       = childAfter(child);
                childIndex += 1;
            }
            if (_needsClipping)
            {
                if (_overflowShader != null)
                {
                    context.canvas.translate(offset.dx, offset.dy);
                    Paint paint = new Paint();
                    paint.blendMode = BlendMode.modulate;
                    paint.shader    = _overflowShader;
                    context.canvas.drawRect(Offset.zero & size, paint);
                }
                context.canvas.restore();
            }
        }