Glimmr Canvas-Based Drawing

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Scaling rule for image-maps

    An element scaling rule for an image-map (called the grid) (this is the image-map scaling rule):
        let imap-x be the desired tile-width of the grid;
        let imap-y be the desired tile-height of the grid;
        unless the asymmetrical scaling option is active:
            now the scaled tile-width of the grid is imap-x real times the scaling factor of current window real times the scaling factor of the grid as an integer;
            now the scaled tile-height of the grid is imap-y real times the scaling factor of current window real times the scaling factor of the grid as an integer;
        otherwise:
            now the scaled tile-width of the grid is imap-x real times the scaling factor of current window real times the x-scaling factor of the grid as an integer;
            now the scaled tile-height of the grid is imap-y real times the scaling factor of current window real times the y-scaling factor of the grid as an integer;
        if grid is center-aligned:
            now the win-x of the grid is win-x - (imap-x * scaled tile-width) / 2;
            now the win-y of the grid is win-y - (imap-y * scaled tile-height) / 2;
        if grid is right-aligned:
            now the win-x of grid is win-x - (imap-x * scaled tile-width);
            now the win-y of grid is win-y - (imap-y * scaled tile-height);
        continue.

    To decide which number is the desired tile-width of (grid - an image-map):
        if the grid is a tileset image-map:
            if the tile-width override of the grid is greater than 0:
                decide on the tile-width override of the grid;
            otherwise:
                decide on the tile-width of the associated tileset of the grid;
        if the grid is a direct image-map:
            decide on the tile-width of the grid.
            
    To decide which number is the desired tile-height of (grid - an image-map):
        if the grid is a tileset image-map:
            if the tile-height override of the grid is greater than 0:
                decide on the tile-height override of the grid;
            otherwise:
                decide on the tile-height of the associated tileset of the grid;
        if the grid is a direct image-map:
            decide on the tile-height of the grid.