<HTML>
<HEAD>
<TITLE>Untitled file 'KaliCanvas.html'</TITLE>
<!-- Copyright (c) 1996 by The Geometry Center. All Rights Reserved. -->
</HEAD>
<BODY BGCOLOR="FFFFFF">
<!-- *Navigation-Links -->
<B>Up:</B> <A HREF="source.html"><I>Java Kali Source Code and Documentation</I></A><BR>
<HR>
<p>

<!-- *Begin-Document-Body -->
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Mon Sep 16 15:21:10 CDT 1996 -->
<A NAME="_top_"></A>
<TITLE>
  Class KaliCanvas
</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<H1>Class KaliCanvas</H1>
<PRE>
<A HREF="http://www.javasoft.com/products/JDK/CurrentRelease/api/java.lang.Object.html#_top_">java.lang.Object</A>
   |
   +----KaliCanvas
</PRE>
<HR>
<DL>
  <DT>class <B>KaliCanvas</B>
  <DT>extends <A HREF="http://www.javasoft.com/products/JDK/CurrentRelease/api/java.lang.Object.html#_top_">Object</A>
</DL>
An abstract canvas object which serves the purpose of insulating the
mathematical part of the program (Panorama object below) from the
graphics (DrawPanel object above).  The Panorama object does its
drawing by making calls to the KaliCanvas object, which in turn
translates them into the appropriate graphics calls for drawing on
the DrawPanel object.
<p>
(It might be more efficient to have the Panorama object make the
graphics calls directly, but for now we try it this way.)
<p>
<B>Coordinate systems:</B>
<p>
Kali uses 3 different coordinate systems for the image in the DrawPanel:
<DL>
    <DT><I>Raw Screen Coordinates</I>
        <DD>This is the original screen coordinate system of the
	    drawing area, which goes from (0,0) in the upper left to
	    (screenWidth, screenHeight) in the lower right (in
	    pixels).  Y increases DOWN in this system.
<p>
	    Mouse events happen in this coordinate system.
<p>
    <DT><I>Screen Coordinates</I>
	<DD>This system is the result of translating the raw screen
	    system so that (0,0) is at the center of the screen; so it
	    goes from (-screenWidth/2, -screenHeight/2) in the upper
	    left to (screenWidth/2, screenHeight/2) in the lower
	    right.  Y increases DOWN in this system too.
<p>
	    Drawing happens in this coordinate system; the
	    KaliCanvas.setGraphics() method calls g.translate() to
	    move the Graphics object's origin from the upper left (the
	    default) to the center of the screen.  Also, the
	    translation computations in the Panorama object happen in
	    this system.
<p>
      <DT><I>Internal Coordinates</I>
	<DD>This system goes from (-internalWidth, internalHeight) in
	    the upper left to (internalWidth, -internalHeight) in the
	    lower right; so (0,0) is at the center of the screen.  Y
	    increases UP in this system.
<p>
	    The coordinates of drawn segments are stored in this
	    system.  Also, the Panorama object does some of the group
	    action math (reflection and rotation) in this system.
<p>
	    Also, in the future, scaling and translation may be
	    implemented by transforming this system.
<p>
</DL>
<DL>
    <DT><B>See Also:</B>
    <DD><A HREF="Panorama.html#_top_">Panorama</A>, <A HREF="DrawPanel.html#_top_">DrawPanel</A>
</DL>
<HR>
<A NAME="index"></A>
<H2><IMG SRC="images/constructor-index.gif" WIDTH=275 HEIGHT=38 ALT="Constructor Index"></H2>
<DL>
  <DT><IMG SRC="images/yellow-ball-small.gif" WIDTH=6 HEIGHT=6 ALT=" o ">
	<A HREF="#KaliCanvas()"><B>KaliCanvas</B></A>()
<DD></DL>
<H2><IMG SRC="images/method-index.gif" WIDTH=207 HEIGHT=38 ALT="Method Index"></H2>
<DL>
  <DT><IMG SRC="images/red-ball-small.gif" WIDTH=6 HEIGHT=6 ALT=" o ">
	<A HREF="#drawSegment(Segment, java.awt.Color)"><B>drawSegment</B></A>(Segment, Color)
  <DD>Draw a single line segment.
  <DT><IMG SRC="images/red-ball-small.gif" WIDTH=6 HEIGHT=6 ALT=" o ">
	<A HREF="#internalToScreen(DVector)"><B>internalToScreen</B></A>(DVector)
  <DD>Convert internal coordinates to screen coordinates.
  <DT><IMG SRC="images/red-ball-small.gif" WIDTH=6 HEIGHT=6 ALT=" o ">
	<A HREF="#rawScreenToInternal(int, int)"><B>rawScreenToInternal</B></A>(int, int)
  <DD>Convert raw screen coordinates to internal coordinates.
  <DT><IMG SRC="images/red-ball-small.gif" WIDTH=6 HEIGHT=6 ALT=" o ">
	<A HREF="#setGraphics(java.awt.Graphics)"><B>setGraphics</B></A>(Graphics)
  <DD>Set the graphics context for future drawing; this results in
a new screen coordinate system being computed based on the
current size of this graphics context.
</DL>
<A NAME="constructors"></A>
<H2><IMG SRC="images/constructors.gif" WIDTH=231 HEIGHT=38 ALT="Constructors"></H2>
<A NAME="KaliCanvas"></A>
<A NAME="KaliCanvas()"><IMG SRC="images/yellow-ball.gif" WIDTH=12 HEIGHT=12 ALT=" o "></A>
<B>KaliCanvas</B>
<PRE>
  public KaliCanvas()
</PRE>
<A NAME="methods"></A>
<H2><IMG SRC="images/methods.gif" WIDTH=151 HEIGHT=38 ALT="Methods"></H2>
<A NAME="rawScreenToInternal(int, int)"><IMG SRC="images/red-ball.gif" WIDTH=12 HEIGHT=12 ALT=" o "></A>
<A NAME="rawScreenToInternal"><B>rawScreenToInternal</B></A>
<PRE>
  public <A HREF="DVector.html#_top_">DVector</A> rawScreenToInternal(int x,
                                     int y)
</PRE>
<DL>
  <DD>Convert raw screen coordinates to internal coordinates.
</DL>
<A NAME="internalToScreen(DVector)"><IMG SRC="images/red-ball.gif" WIDTH=12 HEIGHT=12 ALT=" o "></A>
<A NAME="internalToScreen"><B>internalToScreen</B></A>
<PRE>
  public <A HREF="DVector.html#_top_">DVector</A> internalToScreen(<A HREF="DVector.html#_top_">DVector</A> v)
</PRE>
<DL>
  <DD>Convert internal coordinates to screen coordinates.
</DL>
<A NAME="setGraphics(java.awt.Graphics)"><IMG SRC="images/red-ball.gif" WIDTH=12 HEIGHT=12 ALT=" o "></A>
<A NAME="setGraphics"><B>setGraphics</B></A>
<PRE>
  public void setGraphics(<A HREF="http://www.javasoft.com/products/JDK/CurrentRelease/api/java.awt.Graphics.html#_top_">Graphics</A> g)
</PRE>
<DL>
  <DD>Set the graphics context for future drawing; this results in
a new screen coordinate system being computed based on the
current size of this graphics context.
</DL>
<A NAME="drawSegment(Segment, java.awt.Color)"><IMG SRC="images/red-ball.gif" WIDTH=12 HEIGHT=12 ALT=" o "></A>
<A NAME="drawSegment"><B>drawSegment</B></A>
<PRE>
  public void drawSegment(<A HREF="Segment.html#_top_">Segment</A> s,
                          <A HREF="http://www.javasoft.com/products/JDK/CurrentRelease/api/java.awt.Color.html#_top_">Color</A> c)
</PRE>
<DL>
  <DD>Draw a single line segment.
</DL>
<!-- *End-Document-Body -->
<p>

<!-- *Navigation-Links -->
<HR>
<B>Up:</B> <A HREF="source.html"><I>Java Kali Source Code and Documentation</I></A><BR>

<!-- *GC-Common-Footer -->
<HR>
<NOBR><A HREF="/"><IMG SRC="/pix/home.gif" ALT="[HOME]" ALIGN=MIDDLE></A>
<I>The Geometry Center Home Page</I></NOBR>
<p>
Author: <A HREF="http://www.geom.umn.edu/locate/mbp">Mark Phillips</A><BR>
Comments to:
<A HREF="/admin/mail/webmaster.html">webmaster@geom.umn.edu</A><BR>
Created:  Sep 16 1996 --- 
<!-- hhmts start -->
Last modified: Sep 18 1996
<!-- hhmts end -->
</BODY>
</HTML>
