Plugin:Clist modern/en/Skin development guide: Difference between revisions
Dart Raiden (talk | contribs) No edit summary |
Dart Raiden (talk | contribs) |
||
Line 103: | Line 103: | ||
''object_name'' — object name used to point from rules | ''object_name'' — object name used to point from rules | ||
''object_type'' — one of types Image or Solid | ''object_type'' — one of types Image or Solid | ||
''parameters,…'' — parameters. | ''parameters,…'' — parameters. | ||
Line 117: | Line 119: | ||
RedValue, GreenValue, BlueValue, AlphaValue — Red,Green,Blue and alpha transparency values. | RedValue, GreenValue, BlueValue, AlphaValue — Red,Green,Blue and alpha transparency values. | ||
File_Name — glyph image file name. | File_Name — glyph image file name. | ||
Fit_Mode — transform mode: StretchBoth, TileHorz, TileVert, TileBoth. | Fit_Mode — transform mode: StretchBoth, TileHorz, TileVert, TileBoth. | ||
Left, Top, Right, Bottom — transform margins. | Left, Top, Right, Bottom — transform margins. | ||
Revision as of 23:41, 8 March 2021
Common definitions
Skin engine is based on next definitions and concepts:
- Object — component of skin. All skin objects are created during module loading. Objects describes what and how is need to paint as reply to Request.
- Glyph — some image. Now time are supported BMP, JPG and PNG (with transparancy). Size of glyph is defined by image size. Glyph picture loads to memory only at first attempt to paint it and is kept in memory till module unloading or other skin loading.
- Rule — rule which Object is correspond to Request
- Request — request from module (this or other) to paint one of corresponding objects at specific place and size.
Work algorithm
Skin engine sequence is next:
- Module generate request string as soon as it needs to paint something and give it to skin engine.
- Skin engine try to find first rule that correspond to given request and select an object that pointed by this rule.
- If selected object is Solid type: The requested area is painted by corresponding color with specified alpha.
- If selected object is a Image: such image is transformed to requested region size and paints.
Rules and Request
Rule consists of:
- Number
- Name of object to point
- Couple of parameters delimited by ","
Each parameter is a union of:
- Parameter’s name (first parameter has name "Module" and that always skipped).
- Condition (= - "is equal", ^ - "is not equal")
- Parameter value.
Request has the same part as rule except number.
The rule corresponds to the request if:
- Request contains all the rule's parameters. (also request can contain the parameter that is not mention in rule)
- All values of common parameters are the same if rule's parameters condition is "equal" and not the same if rules condition is "not equal". Rule parameter values can contain wildcards "*" and "?".
Rule parameter's names and values can contain up to 24 chars. Values can not contain "," (comma) all commas are replaced by "." (dots) Names and values are CASE SENSITIVE. First parameter name should be skipped when points.
Glyph transformation
Example: We need to paint glyph with sizes 70х70 at the rectangle size 100х100.
Define for margins: Left, Top, Right, Bottom. These margins divide glyph at 9 areas:
- 4 corners
- 4 edges
- center
Transformation rules:
- Corner areas of glyph are painted as-it-is at the destination corners without any resizing.
- Edge parts transforms in direction along their nearest edges and keeping perpendicular to edge size as is.
- Center area transforms in both directions
After transformation (StretchBoth mode)
There is 4 transformation modes:
- StretchBoth — stretch at both directions
- TileHorz — Tile horizontal, but stretch vertical
- TileVert — Tile vertical but stretch horizontal
- TileBoth — Tile at both directions
Skin definition
Skin is union of skin description file (*.msf) and folder with graphic resources. Folder name should be the same as the name of descriptor file (without extension). All files inside descriptor should be referenced without path.
Descriptor file is the common ini file with changed extension. All keys imports to DB during skin loading. File formats is next:
[db_section_name] ; comments Key=#Value Key2=#Value2
Here «#» is placeholder for one of key type data marks. They can be one of following
- «b» — BYTE
- «w» — WORD
- «d» — DWORD
- «s» — STRING
All modern skin objects and rules are kept in [ModernSkin] section with string type value. So in this section all keys have ‘s’ after ‘=’ e.g.:
$hotopengroup=sGlyph,Image,hotopengroup.png,StretchBoth,2,2,2,2,250 @0=s$window:Main,ID=Background
Spaces inside are not allowed (only for string parameters like …,Name=First Name,…).
Objects description
So skin consists from several parts. One of they describes Objects.
Objects are described in next way:
$object_name=sGlyph,object_type,parameters,…
object_name — object name used to point from rules
object_type — one of types Image or Solid
parameters,… — parameters.
for Solid type:
$object_name =sGlyph,Solid,RedValue,GreenValue,BlueValue,AlphaValue
for Image:
$object_name =sGlyph,Image,File_Name,Fit_Mode,Left,Top,Right,Bottom,AlphaValue
RedValue, GreenValue, BlueValue, AlphaValue — Red,Green,Blue and alpha transparency values.
File_Name — glyph image file name.
Fit_Mode — transform mode: StretchBoth, TileHorz, TileVert, TileBoth.
Left, Top, Right, Bottom — transform margins.
Examples:
$window=sGlyph,Image,back.bmp,TileBoth,1,1,1,1,150 $closed_miranda_group=sGlyph,Solid,0,0,255,200