What Is Inside a Sketch File? - presleralles1971
Every bit part of the exploitation of Insaneness — a clear standalone .survey file viewer for Windows – I had to learn how to analyse a .sketch file.
Ready to accomplish this I needed to answer 3 things:
- Reveal the structure behind .sketch files
- Transfer this "structure" to the Windows environment
- Visualize this structure on Windows
Structure
Lashkar-e-Taiba's start from the very beginning. Here's a .sketch file gaping on a Mac:
Every graphic element you see on the figure preceding – an icon, a block of text – is a separate object. Or in terms of Sketch – a layer.
Sketch file is deceiptively simple on the wrong. If you were to open .Sketch in any file director, say, Far Manager, you'd see something like this:
Non much, but that's just the tip of the iceberg. We learn something very important from this 1 string – that a .survey file is an .SQLite database.
And so, how does that database look connected the inside? By opening it in any SQLite viewing tool, this is what we get:
Interestingly enough, nearly completely the place is filled by a single cell in a single table. Get's extract this cell's contents:
After the initial feeling of being in the Matrix, you may notice that everything starts with a bplist string. What is this bplist thing? Information technology clad to be a standard Mac Bone data formatting for storing structured data, and it's titled PList.
Systematic to bring some clearness to this symbol hydrophobia I converted this PList matter into an XML, exploitation some built-in Macintosh utility (that's life-and-death)
It took me a few days to sort out what was going on here, simply I was eventually able to understand the structure behind the file. Forthwith there was still a tiny problem… I was doing completely that on Mackintosh, as you think of, using Mac utilities.
Given the fact that I was developing a Windows .sketch witness, I had to repeat whol this happening Windows, i.e. assailable this Plist file on Windows, break information technology structure then properly analyse the answer.
So I did just that.
I found only one library that could open the PList format on Windows. Only it needed a huge update and rafts of improvement. In the end I was able to get this:
It was something, though I still had to write my own handler, because in the structure you see supra information technology's non objects that we see, it's their addresses. So the handler's job was to find these objects using their addresses then, using a special method, make all the received data decipherable:
From that we see that the afoot targe has a name "Sketch viewer for Wi", and in the form block we can see its size and coordinates. Now I could visually compare this same .sketch file opened along Mac and its social organization, plagiaristic along Windows.
Visualization
Forthwith that I had the anatomical structure, I was able to submit all object/element of the register sequentially.
For that interpretation I utilised the cross-platform depository library Skia from Google. To be more precise, it's a Xamarin SkiaSharp. With the help of OpenGl the library is able to draw in graphic primitives, text, and rasterized images. Besides that, it gives you the ability to figure the file's objects closest to the original because it supports gradients, tiles, layer overlays, shadows, blur etc.
You can see how it all works in this video:
1 by one all parts of the data file are rendered, eventually creating something we'Ra referencing as a mock-up or a .sketch data file.
Source: https://blog.icons8.com/articles/what-is-inside-of-a-sketch-file/
Posted by: presleralles1971.blogspot.com
0 Response to "What Is Inside a Sketch File? - presleralles1971"
Post a Comment