Change SKSurface height dynamically

NandithaRanasingheNandithaRanasinghe LKMember
edited November 2017 in SkiaSharp


Thank you for this awesome library. It works really well.
I have one question. We are drawing on SKSurface at runtime based on the _ImageInfos collection.
Though Height property is required at the time of 'SKSurface.Create', we have no idea how height it will be.

So when we call surface.Snapshot(), we will not get the full image, but up to initial height.

can we set the surface height based on the Y ?

        using (var surface = SKSurface.Create(width: 300, height: 700, colorType: SKImageInfo.PlatformColorType, alphaType: SKAlphaType.Premul))
            using (var canvas = surface.Canvas)
                foreach(var imageinfo in _ImageInfos)
                    canvas.DrawImage(imageinfo.Image, X, Y);
        //Get Image Height and Set new  Y Location
                    canvas.DrawText(imageinfo.Message, X, Y);
        //Get Text Height and Set new Y Location

Thank you.

Sign In or Register to comment.