Glimmr Drawing Commands

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - Color specified as a hexadecimal

    To decide which number is hex (hex - indexed text):
        let curval be a number;
        let hex be hex in upper case;
        replace the regular expression "\$|\#|0x" in hex with "";
        let len be the number of characters in hex;
        let total be 0;
        let multiplier be 1;
        repeat with index running from 1 to len:
            let N be (len - index) + 1;
            let V be the character code of position N of hex;
            unless V < 48 or V > 70 or ( V > 57 and V < 65):
                if V > 64:
                    let curval be V - 55;
                otherwise if V < 58:
                    let curval be V - 48;
            otherwise:
                let total be 0;
                break;
            let curval be curval * multiplier;
            increase total by curval;
            let multiplier be multiplier * 16;
        decide on total.