Difference between revisions of "Bobscreen"
From Sega Retro
Line 1: | Line 1: | ||
<includeonly><div style="display:none"> | <includeonly><div style="display:none"> | ||
{{#vardefine:screenwidth|{{#mediawidth:{{{1}}}}}}} | {{#vardefine:screenwidth|{{#mediawidth:{{{1}}}}}}} | ||
+ | {{#vardefine:screenheight|{{#mediaheight:{{{1}}}}}}} | ||
{{#vardefine:scale|1}} | {{#vardefine:scale|1}} | ||
{{#vardefine:yscale|1}} | {{#vardefine:yscale|1}} | ||
{{#ifexpr: {{#mediawidth:{{{1}}}}} > 320 | {{#vardefine:screenwidth|320}} }} | {{#ifexpr: {{#mediawidth:{{{1}}}}} > 320 | {{#vardefine:screenwidth|320}} }} | ||
+ | {{#ifexpr: {{#mediaheight:{{{1}}}}} > 240 | {{#vardefine:screenheight|240}} }} | ||
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 512 × 448 | {{#vardefine:screenwidth|256}}{{#vardefine:scale|1.25}} }} | {{#ifeq: {{#mediadimensions:{{{1}}}}} | 512 × 448 | {{#vardefine:screenwidth|256}}{{#vardefine:scale|1.25}} }} | ||
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 512 × 480 | {{#vardefine:screenwidth|256}}{{#vardefine:scale|1.25}} }} | {{#ifeq: {{#mediadimensions:{{{1}}}}} | 512 × 480 | {{#vardefine:screenwidth|256}}{{#vardefine:scale|1.25}} }} | ||
Line 17: | Line 19: | ||
{{#vardefine:newheight|{{#expr:{{#var:screenheight}}*{{#var:scale}}}}}} | {{#vardefine:newheight|{{#expr:{{#var:screenheight}}*{{#var:scale}}}}}} | ||
− | {{#vardefine:vmargin|{{#expr:(({{# | + | {{#vardefine:vmargin|{{#expr:(({{#var:screenheight}}}}*{{#var:yscale}})-{{#var:screenheight}}}})/2}}}} |
</div><div style="width:{{#var:visiblewidth}}px; display:inline-block; text-align:center;"><div style="transform:scalex({{#var:scale}}); {{#ifeq:{{#var:yscale}}|1||transform:scaley({{#var:yscale}}); margin-top:{{#var:vmargin}}px; margin-bottom:{{#var:vmargin}}px;}} transform-origin:50%">[[File:{{{1}}}|{{#var:screenwidth}}x384px]]</div></div></includeonly><noinclude> | </div><div style="width:{{#var:visiblewidth}}px; display:inline-block; text-align:center;"><div style="transform:scalex({{#var:scale}}); {{#ifeq:{{#var:yscale}}|1||transform:scaley({{#var:yscale}}); margin-top:{{#var:vmargin}}px; margin-bottom:{{#var:vmargin}}px;}} transform-origin:50%">[[File:{{{1}}}|{{#var:screenwidth}}x384px]]</div></div></includeonly><noinclude> |
Revision as of 07:57, 11 February 2017
This template sets the maximum width of a screenshot to 320 pixels, and corrects its aspect ratio.
Usage
{{bobscreen|MagicalPuzzlePopils title.png}}
returns
This is how the game appears on an actual Sega Game Gear. The original image taken from an emulator is below:
Options
{{bobscreen|MagicalPuzzlePopils title.png|width=120}}
returns
"width" also takes into account the adjusted aspect ratio, so the image appears 120 pixels wide even if the source image is not.
Height
In addition, this template corrects heights:
<div style="transform:scalex(1); transform:scaley(1.1); margin-top:Expression error: Unclosed bracket.*1.1)-240px; margin-bottom:Expression error: Unclosed bracket.*1.1)-240px; transform-origin:50%">