Glimmr Canvas-Based Drawing

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Centering algorithm for bitmap-rendered strings

    To decide what list of numbers is the center-point of (item - a bitmap-rendered string):
        let dx be a number;
        let dy be a number;
        let x be entry 1 of the origin of item;
        let y be entry 2 of the origin of item;
        let dot-width be (bit-size of the item * length of the item) as a fixed point number;
        unless the asymmetrical scaling option is active:
            let dx be the dot-width real times the scaling factor of the item as an integer;
            let dy be the font-height of the associated font of the item real times the scaling factor of the item as an integer;
        otherwise:
            let dx be the dot-width real times the x-scaling factor of the item as an integer;
            let dy be the font-height of the associated font of the item real times the x-scaling factor of the item as an integer;
        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.