# Glimmr Canvas-Based Drawing

## version 2/101030 by Erik Temple

**Section - Centering algorithm for image-maps**

To decide what list of numbers is the center-point of (grid - an image-map):

let dx be a number;

let dy be a number;

let x be entry 1 of the origin of grid;

let y be entry 2 of the origin of grid;

let imap-x be the desired tile-width of the grid;

let imap-y be the desired tile-height of the grid;

if the asymmetrical scaling option is not active:

let dx be imap-x real times the the scaling factor of the grid as an integer;

let dy be imap-y real times the scaling factor of the grid as an integer;

otherwise:

let dx be imap-x real times the x-scaling factor of the grid as an integer;

let dy be imap-y real times the y-scaling factor of the grid as an integer;

let the calc-height be the number of entries of the tile-array of the grid;

let the calc-width be the number of entries in entry 1 of the tile-array of the grid;

let dx be dx * calc-width;

let dy be dy * calc-height;

let x be x + (dx / 2);

let y be y + (dy / 2);

let coord be {0, 0};

now entry 1 of coord is x;

now entry 2 of coord is y;

decide on coord.