Glimmr Canvas-Based Drawing

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Scaling rule for bitmaps

    An element scaling rule for a bitmap (called the grid) (this is the bitmap scaling rule):
        let the bitsize-temp be the bit-size of the grid as a fixed point number;
        unless the asymmetrical scaling option is active:
            now the dot-size of the grid is the bitsize-temp real times the scaling factor of the current window real times the scaling factor of the grid as an integer;
        otherwise:
            now the dot-size of the grid is the bitsize-temp real times the scaling factor of the current window real times the x-scaling factor of the grid as an integer;
        if the dot-size of the grid < 1, now the dot-size of the grid is 1;
        let the bitmap-width be the number of entries in entry 1 of the bitmap-array of the grid;
        let the bitmap-height be the number of entries of the bitmap-array of the grid;
        if the grid is center-aligned:
            now the win-x of the grid is win-x - (bitmap-width * dot-size) / 2;
            now the win-y of the grid is win-y - (bitmap-height * dot-size) / 2;
        if the grid is right-aligned:
            now the win-x of the grid is win-x - (bitmap-width * dot-size);
            now the win-y of the grid is win-y - (bitmap-height * dot-size);
        continue.