Plugin:Clist modern/en/Skin development guide

From Miranda NG
< Modern contact list‎ | Modern contact list
Revision as of 01:33, 23 August 2020 by Dart Raiden (talk | contribs) (initial part)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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:

  1. Module generate request string as soon as it needs to paint something and give it to skin engine.
  2. Skin engine try to find first rule that correspond to given request and select an object that pointed by this rule.
  3. If selected object is Solid type: The requested area is painted by corresponding color with specified alpha.
  4. If selected object is a Image: such image is transformed to requested region size and paints.

Rules and Request

Rule consists of:

  1. Number
  2. Name of object to point
  3. 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:

  1. Request contains all the rule's parameters. (also request can contain the parameter that is not mention in rule)
  2. 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:

  1. 4 corners
  2. 4 edges
  3. center