OBD:PSpc: Difference between revisions

m
wording
m (link fix)
m (wording)
Line 17: Line 17:




:''For more info on nine-grid rendering, see [https://docs.microsoft.com/en-us/previous-versions/windows/desktop/windows-media-center-sdk/bb189722(v=msdn.10) HERE]
:''For a visualization of nine-slice rendering, see [https://docs.microsoft.com/en-us/previous-versions/windows/desktop/windows-media-center-sdk/bb189722(v=msdn.10) HERE] or [[XML:PSpc]].


;What is stored
;What is stored
:There are 9 rectangles stored in PSpc: 4 corners, 4 sides and one interior rectangle. Typically all 9 are used (to draw buttons for example) or only one is used (the top left corner, to draw checkboxes for example). There are cases where the top left corner and the interior rectangle are present which indicates that the code can choose what part to draw.
:There are 9 rectangles defined in PSpc: 4 corners, 4 sides and one interior rectangle. Typically all 9 are used (to draw buttons for example) or only one is used (the top left corner, to draw checkboxes for example). There are cases where the top left corner and the interior rectangle are both present, which indicates that the code can choose which part to draw.
:The reason for using 9 rectangles is to allow drawing of buttons (and anything else that has a border) in various sizes without distorting the image.
:The reason for using 9 rectangles is to allow drawing of buttons (and anything else that has defined corners) in various sizes without distorting the corners.
:*the corners are never rescaled
:*the corners are never rescaled
:*horizontal sides can be stretched horizontally
:*horizontal sides can be stretched horizontally
:*vertical sides can be stretched vertically
:*vertical sides can be stretched vertically
:*the interior can be stretched both ways
:*the interior can be stretched both ways
:Of course that means that the sides and the interior must be "special" images that can be stretched without visible distortion.
:Of course that means that the sides and the interior must be specially designed to be stretchable without visible distortion.


;How it is stored
;How it is stored
:Every 2 int16 fields make a texture coordinate. The former 9 texture coordinates (18 bytes) are the top left corners of the 9 rectangles. The latter 9 coordinates are the bottom right corners of the 9 rectangles. When both coordinates are 0 then the rectangle is not used. The order of the coordinates is top to bottom and left to right. The order of the 9 rectangles is: top left, top, top right, left, center, right, bottom left, bottom, bottom right.
:A pair of int16 fields make a texture coordinate. The first 9 texture coordinates in the file (18 bytes) are the top-left corners of the 9 rectangles. The latter 9 coordinates are the bottom-right corners of the 9 rectangles. When both coordinates are 0 then the rectangle is not used. The order of the coordinates is top to bottom, left to right. Thus the order of the 9 rectangles is: top left, top center, top right, middle left, middle center, middle right, bottom left, bottom center, bottom right.