drawcontext/src/RegionDrawContext.m3


 Copyright (c) 2000 California Institute of Technology 
 All rights reserved. See the file COPYRIGHT for a full description. 
 $Id: RegionDrawContext.m3.html,v 1.3 2010-04-29 17:18:11 wagner Exp $ 

MODULE RegionDrawContext;
IMPORT Region;
IMPORT Rect;
IMPORT DrawContextClass;
IMPORT TextBounder;
REVEAL
  T = Public BRANDED OBJECT
    region := Region.Empty;
  OVERRIDES
    init := Init;
    toRegion := GetRegion;
    gBox := GBox;
  END;

PROCEDURE Init(self: T; textBounder: TextBounder.T): T =
  BEGIN
    self.region := Region.Empty;
    self.textBounder := textBounder;
    RETURN self;
  END Init;

PROCEDURE GetRegion(self: T): Region.T =
  BEGIN
    RETURN self.region;
  END GetRegion;

PROCEDURE GBox(self: T; r: Rect.T) =
  BEGIN
    self.region := Region.JoinRect(r, self.region);
  END GBox;

BEGIN
END RegionDrawContext.