Module: duim-dcs-internals Synopsis: DUIM display device contexts Author: Scott McKay, Andy Armstrong Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND /// Brushes define protocol <> () getter brush-foreground (brush :: ) => (foreground :: ); getter brush-background (brush :: ) => (background :: ); getter brush-mode (brush :: ) => (mode :: ); getter brush-fill-style (brush :: ) => (fill-style); getter brush-fill-rule (brush :: ) => (fill-rule); getter brush-tile (brush :: ) => (image); getter brush-stipple (brush :: ) => (stipple); getter brush-ts-x (brush :: ) => (x :: false-or()); getter brush-ts-y (brush :: ) => (y :: false-or()); getter brush-stretch-mode (brush :: ) => (stretch-mode); end protocol <>; // Drawing "functions"... define constant $boole-clr :: = 0; define constant $boole-set :: = 1; define constant $boole-1 :: = 2; define constant $boole-2 :: = 3; define constant $boole-c1 :: = 4; define constant $boole-c2 :: = 5; define constant $boole-and :: = 6; define constant $boole-ior :: = 7; define constant $boole-xor :: = 8; define constant $boole-eqv :: = 9; define constant $boole-nand :: = 10; define constant $boole-nor :: = 11; define constant $boole-andc1 :: = 12; define constant $boole-andc2 :: = 13; define constant $boole-orc1 :: = 14; define constant $boole-orc2 :: = 15; //--- What about other Windows arguments? //--- What about X plane-mask, arc-mode, clip-x/y, clip-ordering? define sealed class () sealed constant slot brush-foreground :: = $foreground, init-keyword: foreground:; sealed constant slot brush-background :: = $background, init-keyword: background:; sealed constant slot brush-mode :: = $boole-1, init-keyword: mode:; sealed constant slot brush-fill-style = #f, init-keyword: fill-style:; sealed constant slot brush-fill-rule = #f, init-keyword: fill-rule:; sealed constant slot brush-tile = #f, init-keyword: tile:; sealed constant slot brush-stipple = #f, init-keyword: stipple:; sealed constant slot brush-ts-x :: false-or() = #f, init-keyword: ts-x:; sealed constant slot brush-ts-y :: false-or() = #f, init-keyword: ts-y:; sealed constant slot brush-stretch-mode = #f, init-keyword: stretch-mode:; end class ; define sealed domain make (singleton()); define sealed domain initialize (); define sealed method \= (brush1 :: , brush2 :: ) => (true? :: ) brush1 == brush2 | begin brush-foreground(brush1) = brush-foreground(brush2) & brush-background(brush1) = brush-background(brush2) & brush-mode(brush1) == brush-mode(brush2) & brush-fill-style(brush1) == brush-fill-style(brush2) & brush-fill-rule(brush1) == brush-fill-rule(brush2) & brush-tile(brush1) = brush-tile(brush2) & brush-stipple(brush1) = brush-stipple(brush2) & brush-ts-x(brush1) == brush-ts-x(brush2) & brush-ts-y(brush1) == brush-ts-y(brush2) & brush-stretch-mode(brush1) == brush-stretch-mode(brush2) end end method \=; define sealed inline method make (class == , #key foreground = $foreground, background = $background, mode = $boole-1, fill-style, fill-rule, tile, stipple, ts-x, ts-y) => (brush :: ) make(, foreground: foreground, background: background, mode: mode, fill-style: fill-style, fill-rule: fill-rule, tile: tile, stipple: stipple, ts-x: ts-x, ts-y: ts-y) end method make; // This one is pretty useful... define constant $xor-brush :: = make(, mode: $boole-xor);