File: SVArtwork.mesa
Author: Eric Bier on December 22, 1982 1:58 am
Last edited by Bier on July 6, 1983 4:05 pm
Contents: Procedures for mapping from simple surfaces to arbitrary surfaces and back again
DIRECTORY
AIS,
Graphics,
GraphicsColor,
IO,
Matrix3d,
Rope,
SV2d,
SVCoordSys2d,
SVMatrix2d,
SVVector3d;
SVArtwork: DEFINITIONS
IMPORTS SVMatrix2d =
BEGIN
Color: TYPE = GraphicsColor.Color;
CoordSystem2d: TYPE = SVCoordSys2d.CoordSystem2d;
OMap: TYPE = {orthogonal, radial, tubeO};
SMap: TYPE = {unfoldedBox, tubeS};
Artwork: TYPE = REF ArtworkObj;
ArtworkObj: TYPE = RECORD [
material: Material,
surface: REF ANY, -- an SVMappings.<REF surface>
oMap: OMap, -- the simple surface to object mapping
sMap: SMap, -- the artwork to simple surface mapping
source: Rope.ROPE,
color: Color,
isColorFile: BOOL,
resolution: REAL,
halfWidth, halfHeight: REAL,-- in inches
halfWidthDots, halfHeightDots: REAL, -- in samples
centerWRTLowerLeft: Point2d, -- in screen dots
artWRTPad: CoordSystem2d,
redfile: AIS.FRef,
greenfile: AIS.FRef,
bluefile: AIS.FRef,
blackfile: AIS.FRef,
redWindow: AIS.WRef,
greenWindow: AIS.WRef,
blueWindow: AIS.WRef,
blackWindow: AIS.WRef,
open: BOOL];
Material: TYPE = {plastic, chalk}; -- remember to update MaterialToRope and RopeToMaterial if you change this list
Matrix3by3: TYPE = SVMatrix2d.Matrix3by3;
Point2d: TYPE = SV2d.Point2d;
Point3d: TYPE = Matrix3d.Point3d;
Vector: TYPE = SVVector3d.Vector;
CreateFileArtwork: PROC [material: Material, surface: REF ANY, oMap: OMap, sMap: SMap, filename: Rope.ROPE, isColor: BOOL, background: Color, resolution: REAL ← 72.0, mat: Matrix3by3 ← SVMatrix2d.Identity[]] RETURNS [artwork: Artwork];
mat is the 2d transform matrix between the pad and the ais file.
FileNotFound: ERROR;
CreateColorArtwork: PROC [color: Color, material: Material] RETURNS [artwork: Artwork];
Copy: PROC [artwork: Artwork] RETURNS [copy: Artwork];
OpenArtwork: PROC [artwork: Artwork];
CloseArtwork: PROC [artwork: Artwork];
FindImageColorAtPoint: PROC [artwork: Artwork, imagePoint: Point2d] RETURNS [color: Color];
FindColorAtSurfacePoint: PROC [artwork: Artwork, point3d: Point3d, normal: Vector] RETURNS [color: Color];
DrawArtwork: PROC [dc: Graphics.Context, artwork: Artwork, origin: Point2d, scalar: REAL];
origin is the origin of the pad in screen coordinates. The picture will be scaled by scalar about this origin
Some convenience functions to aid user-readable representations and user interfaces.
MaterialToRope: PROC [material: Material] RETURNS [materialName: Rope.ROPE];
ie returns "plastic" given plastic, "chalk" given chalk
RopeToMaterial: PROC [materialName: Rope.ROPE] RETURNS [material: Material, success: BOOL];
Does the inverse of MaterialToRope.
OMapToRope: PROC [oMap: OMap] RETURNS [mapName: Rope.ROPE];
RopeToOMap: PROC [mapName: Rope.ROPE] RETURNS [oMap: OMap, success: BOOL];
SMapToRope: PROC [sMap: SMap] RETURNS [mapName: Rope.ROPE];
RopeToSMap: PROC [mapName: Rope.ROPE] RETURNS [sMap: SMap, success: BOOL];
END.