Finger paint canvas
If you use the wrong type on the wrong OS, you will just get a null surface. Windows and some other linux use Bgra8888. Another thing is that on iOS, Android, Mac and some linux, the color type Rgba8888 is valid. One thing to be aware of is that the alpha type and color type always need to be specified - Unknown will never work properly. SKAlphaType.Premul) // Premul instead of Unknown (which can't be saved) SKImageInfo.PlatformColorType, // SKImageInfo knows what colors to use on each platform When I created the SKImageInfo, this was done automatically. In order to save properly, you usually need to specify a 32-bit color (which you did - partially) and a premultiplied alpha type. The issue with your new surface is probably due to you color type and alpha type.
Finger paint canvas code#
Is my assumption wrong and some additional code supposed to be written for getting valid png data before saving into file system or there is some special way for saving that stream for getting valid png file? I saved that stream as a file with png extension into file system but no one Windows program recognizes saved file as a valid. My understanding was that above line returns stream which contains png image data. Now I'm stuck with the last line of your example: var pngImage = snap.Encode() Thank you very much for your help with that part. The following code just returned null: var snap = surface.Snapshot() Ībove code returns snapshot if I use your suggestion for surface creation: var info = new SKImageInfo(, ) Using the following code for surface creation, I hadn't been able to get a snapshot: var surface = SKSurface.Create((int), (int), SKColorType.Rgba8888, SKAlphaType.Unknown)