# Hierba tras el cristal — 2 of 16

## Johan Paz

Release 2

- Home page
- Beginning
- Previous
- Next

Part 0 - Multimedia

Chapter 0 - Right alligned rule

Include (-

[ MyRedrawGraphicsWindowsUpRight cur_pic result graph_width graph_height

img_width img_height w_offset h_offset w_total h_total;

if (FollowRulebook( (+glulx picture selection rules+) ) ) { cur_pic = ResourceIDsOfFigures-->(+ internally selected picture +); }

if (cur_pic == 0) rtrue;

if (gg_picwin) {

result = glk_window_get_size(gg_picwin, gg_arguments, gg_arguments+WORDSIZE);

graph_width = gg_arguments-->0;

graph_height = gg_arguments-->1;

result = glk_image_get_info( cur_pic, gg_arguments, gg_arguments+WORDSIZE);

img_width = gg_arguments-->0;

img_height = gg_arguments-->1;

w_total = img_width;

h_total = img_height;

if (graph_height - h_total < 0) ! if the image won't fit, find the scaling factor

{

w_total = (graph_height * w_total)/h_total;

h_total = graph_height;

}

w_offset = (graph_width - w_total); if (w_offset < 0) w_offset = 0;

h_offset = 0;

glk_image_draw_scaled(gg_picwin, cur_pic, w_offset, h_offset, w_total, h_total);

}

];

-).

This is the up right scaled drawing rule:

blank window to graphics background color;

draw up right scaled image in graphics window.

To draw up right scaled image in graphics window:

(- MyRedrawGraphicsWindowsUpRight(); -)

Include (-

[ SelectWindowPixelCount cur_pic result graph_width graph_height

img_width img_height w_offset h_offset w_total h_total;

if (gg_picwin) {

result = glk_window_get_size(gg_picwin, gg_arguments, gg_arguments+WORDSIZE);

graph_width = gg_arguments-->0;

graph_height = gg_arguments-->1;

}

if (graph_width > 1313)

return 525;

else

return (graph_width*40)/100;

];

-).

To decide which number is window pixel count:

(- SelectWindowPixelCount() -)