Пример #1
0
        void _drawImageNine(Image image, uiRect?src, uiRect center, uiRect dst, uiPaint paint)
        {
            D.assert(image != null);

            var scaleX = 1f / image.width;
            var scaleY = 1f / image.height;

            if (src == null)
            {
                src = uiRectHelper.one;
            }
            else
            {
                src = uiRectHelper.scale(src.Value, scaleX, scaleY);
            }

            center = uiRectHelper.scale(center, scaleX, scaleY);

            var layer = this._currentLayer;
            var state = layer.currentState;

            var mesh = ImageMeshGenerator.imageNineMesh(state.matrix, src.Value, center, image.width, image.height,
                                                        dst);

            if (!this._applyClip(mesh.bounds))
            {
                ObjectPool <uiMeshMesh> .release(mesh);

                return;
            }

            layer.draws.Add(CanvasShader.tex(layer, paint, mesh, image));
        }
Пример #2
0
        void _drawImageNine(Image image, Rect src, Rect center, Rect dst, Paint paint)
        {
            D.assert(image != null);
            D.assert(center != null);
            D.assert(dst != null);
            D.assert(paint != null);

            var scaleX = 1f / image.width;
            var scaleY = 1f / image.height;

            if (src == null)
            {
                src = Rect.one;
            }
            else
            {
                src = src.scale(scaleX, scaleY);
            }

            center = center.scale(scaleX, scaleY);

            var layer = this._currentLayer;
            var state = layer.currentState;

            var mesh = ImageMeshGenerator.imageNineMesh(state.matrix, src, center, image.width, image.height, dst);

            if (!this._applyClip(mesh.bounds))
            {
                return;
            }

            layer.draws.Add(CanvasShader.tex(layer, paint, mesh, image));
        }