Glimmr Canvas Editor

version 1/100805 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - The color-picker

    The drawing colors is a list of glulx color values that varies.

    A color-chip is a kind of rectangle primitive. The associated canvas of a color-chip is the drawing-canvas. The display-layer of a color-chip is 4. The graphlink status of a color-chip is g-active. The origin of a color-chip is {0, 5}. The endpoint of a color-chip is {0, 20}. The tint of a color-chip is g-black. The linked replacement-command of a color-chip is "". The display status of a color-chip is g-inactive.

    The null color-chip is a color-chip. The tint is g-placenullcol.

    The mother color-chip is a color-chip.

    An element display rule for the null color-chip:
        let x be entry 1 of the origin of the null color-chip;
        let y be entry 2 of the origin of the null color-chip;
        display Figure of Null Color-Chip in drawing-window at x by y;
        set a graphlink in drawing-window identified as null color-chip from x by y to (x + 15) by (y + 15) as the linked replacement-command of null color-chip.
        [let xx be entry 1 of the endpoint of the null color-chip;
        let yy be entry 2 of the endpoint of the null color-chip;
        draw a rectangle (color g-white) in drawing-window from x by y to xx by yy with 2 px line-weight (color g-red);
        draw a line (color g-red) in drawing-window from (x + 1) by (yy - 2) to (xx - 1) by y with 2 px line-weight;
        set a graphlink in drawing-window identified as null color-chip from x by y to xx by yy as the linked replacement-command of null color-chip;]

    When play begins:
        if the number of entries of the drawing colors is 0:
            change the drawing colors to {g-black, g-white, g-red, g-blue, g-yellow};
        repeat with item running through the drawing colors:
            let the new element be a new object cloned from the mother color-chip;
            change the tint of the new element to item;
            unlink the origin of the new element;
            unlink the endpoint of the new element.