Template:Coordinate to Pixel: Difference between revisions

From My Wiki
Jump to navigation Jump to search
imported>Tlosk's Bot
No edit summary
imported>Tlosk's Bot
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#vardefine:pixel|{{#switch: {{uc:{{{Direction}}}}}
<includeonly>
  | N = {{#expr: {{{Scale|128}}} - {{{Offset|0}}} - {{{Value|0}}} / 102.8 * 128 round 0}}
{{#switch: {{uc:{{{Direction}}}}}
  | S = {{#expr: {{{Scale|128}}} - {{{Offset|0}}} + {{{Value|0}}} / 102.8 * 128 round 0}}
  | N = {{#vardefine:vn|{{#expr: {{{Scale|128}}} - {{{Offset|0}}} - {{{Value|0}}} / 102.8 * {{{Scale|128}}} round 0}}}}
  | E = {{#expr: {{{Scale|128}}} - {{{Offset|0}}} + {{{Value|0}}} / 102.8 * 128 round 0}}
  | S = {{#vardefine:vs|{{#expr: {{{Scale|128}}} - {{{Offset|0}}} + {{{Value|0}}} / 102.8 * {{{Scale|128}}} round 0}}}}
  | W = {{#expr: {{{Scale|128}}} - {{{Offset|0}}} - {{{Value|0}}} / 102.8 * 128 round 0}}
  | E = {{#vardefine:ve|{{#expr: {{{Scale|128}}} - {{{Offset|0}}} + {{{Value|0}}} / 102.8 * {{{Scale|128}}} round 0}}}}
  | W = {{#vardefine:vw|{{#expr: {{{Scale|128}}} - {{{Offset|0}}} - {{{Value|0}}} / 102.8 * {{{Scale|128}}} round 0}}}}
| 0
}}
 
{{#switch: {{uc:{{{Direction}}}}}
| N = {{#var:vn}}
| S = {{#var:vs}}
| E = {{#var:ve}}
| W = {{#var:vw}}
  | 0
  | 0
}}}}
}}
<includeonly>
{{#var:vn}}
{{#var:pixel}}
</includeonly>
</includeonly>
<noinclude>
<noinclude>
Line 30: Line 38:


{{Coordinate to Pixel|10.5|N|128|3}}
{{Coordinate to Pixel|10.5|N|128|3}}
{{#expr: 128 - 3 - 10.5 / 102.8 * 128 round 0}}
{{#expr: {{{Scale|128}}} - {{{Offset|0}}} + {{{Value|0}}} / 102.8 * {{{Scale|128}}} round 0}}
{{#expr: {{{Scale|128}}} - {{{Offset|0}}} - {{{Value|0}}} / 102.8 * {{{Scale|128}}} round 0}}
{{#ifexist: Help:Contents | [[Help:Contents]] | Help:Contents }}


</noinclude>
</noinclude>

Latest revision as of 16:30, 20 January 2009


Syntax

{{Coordinate to Pixel
 | <Value> (0.0 to 102.8)
 | <Direction> (N E S W)
 | <Scale> (128, 256, 512, etc)
 | <Offset> (Half point image width rounded up, minus any border width)
}}

For example:

{{Coordinate to Pixel|10.5|N|128|3}}

gives the result:


0

0 {{#var:vn}}



112

128

128


Help:Contents