Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 51f7de0838007e2876221e819c82d833 > files > 566

sketch-0.6.13-2mdk.ppc.rpm

<html>
<head>
<title>Developer's Guide: The class GraphicsObject</title>
</head>
<body bgcolor=white text=black link=blue vlink=navy alink=red>
<TABLE WIDTH="100%">
<TR>
<TH ALIGN="left" WIDTH="33%"><img SRC="Images/arrow-left.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Prev"></TH>
<TH ALIGN="center" WIDTH="33%"><img SRC="Images/arrow-up.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Up"></TH>
<TH ALIGN="right" WIDTH="33%"><img SRC="Images/arrow-right.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Next"></TH>
</TR>
<TR>
<TD ALIGN="left"><A HREF="devguide-10.html">Class Hierarchy
</A></TD>
<TD ALIGN="center"><A HREF="devguide-9.html">The Document and Graphics Classes</A></TD>
<TD ALIGN="right"><A HREF="devguide-12.html">The class Bounded 
</A></TD>
</TR>
</TABLE>
<HR NOSHADE>
<H2><FONT face="Helvetica,Arial"><A NAME="N1"></A>The class <A NAME="N2"></A><tt>GraphicsObject</tt></font></H2>

<P>Base Classes: <A HREF="devguide-12.html#N2"><tt>Bounded</tt></A>, <A HREF="devguide-13.html#N2"><tt>HierarchyNode</tt></A>, <A HREF="devguide-15.html#N2"><tt>Selectable</tt></A> and <A HREF="devguide-14.html#N2"><tt>Protocols</tt></A>.</P>
<P>The class <tt>GraphicsObject</tt> defines the interface common to all
graphics objects.</P>
<P>For convenience of implementation, and because their interfaces are
needed elsewhere in the class hierarchy as well, some parts of this
interface are defined by the base classes:</P>
<P>
<DL>
<DT><B><A HREF="devguide-12.html#N2"><tt>Bounded</tt></A></B><DD>
<P>provides instance variables for
the vertical and horizontal dimensions of a graphics object and
some related methods.</P>

<DT><B><A HREF="devguide-13.html#N2"><tt>HierarchyNode</tt></A></B><DD>
<P>provides the default
behavior for all methods related to the management of the
object hierarchy in the document.</P>

<DT><B><A HREF="devguide-15.html#N2"><tt>Selectable</tt></A></B><DD>
<P>defines the generic interface
and default behavior for selection.</P>

<DT><B><A HREF="devguide-14.html#N2"><tt>Protocols</tt></A></B><DD>
<P>has some variables that
describe the object's capabilities.</P>
</DL>
</P>


<H3><FONT face="Helvetica,Arial"><A NAME="N3"></A>Instance Variables</font></H3>

<P><tt>GraphicsObject</tt> maintains no instance variables of its own, but uses
those managed by its base classes.</P>

<H3><FONT face="Helvetica,Arial"><A NAME="N4"></A>Methods</font></H3>

<P>Methods defined in <tt>GraphicsObject</tt>:</P>
<P>
<DL>
<DT><B><A NAME="N5"></A><tt>Blend(<i>other</i>, <i>frac1</i>, <i>frac2</i>)</tt></B><DD>
<P>Return the weighted average of <i>self</i> and <i>other</i>.
<i>frac1</i> and <i>frac2</i> are the weights (if <i>self</i> and
<i>other</i> were numbers this should be <i>frac1</i> * <i>self</i>
+ <i>frac2</i> * <i>other</i>).</P>
<P>This method is used by the function <tt>Blend</tt> in
<tt>blend.py</tt>. If <i>self</i> and <i>other</i> can't be blended,
raise the <CODE>blend.Mismatch</CODE> exception. This is the default
behavior.</P>

<DT><B><A NAME="N6"></A><tt>AsBezier()</tt></B><DD>
<P>Return self as a <tt>PolyBezier</tt> object if possible.
If this is not possible, return <CODE>None</CODE>.</P>
</DL>
</P>
<P>The following methods are not implemented in <tt>GraphicsObject</tt>
directly, but must be defined for every graphics object. The derived
classes <A HREF="devguide-16.html#N2"><tt>Primitive</tt></A> and <A HREF="devguide-17.html#N2"><tt>Compound</tt></A>
provide a default implementation for most objects.</P>
<P>
<DL>

<DT><B><A NAME="N7"></A><tt>Transform(<i>trafo</i>)</tt></B><DD>
<P>Apply the <A HREF="devguide-7.html">transformation object</A>
<i>trafo</i> to self. Return undo info.</P>


<DT><B><A NAME="N8"></A><tt>Translate(<i>offset</i>)</tt></B><DD>
<P>Translate (move) self by <i>offset</i>. <i>offset</i> is a <A HREF="devguide-5.html">point object</A>. Return undo info.</P>

<DT><B><A NAME="N9"></A><tt>DrawShape(<i>device</i> [, <i>clip</i>])</tt></B><DD>
<P>Draw self on <i>device</i>. <i>device</i> is a graphics device
.</P>
<P>The optional parameter <i>clip</i> is only provided if the object
is used as a clip mask. If it is provided its value is 1.
Objects that can be used as clip masks (their <CODE>is_clip</CODE> flag
is true) request appropriate clipping from the graphics device.
Objects that cannot be used as clip masks don't need to accept
it.</P>
<P>(Note: The clipping interface for the high level drawing
operations of the graphics devices is somewhat experimental)</P>



<DT><B><A NAME="N10"></A><tt>SaveToFile(<i>file</i>)</tt></B><DD>
<P>Save self to file. The argument <i>file</i> is currently an
instance of the class <tt>SKSaver</tt> which provides
special methods for the object types currently implemented in
Sketch.</P>

</DL>
</P>



<HR NOSHADE>
<TABLE WIDTH="100%">
<TR>
<TD ALIGN="left"><A HREF="devguide-10.html">Class Hierarchy
</A></TD>
<TD ALIGN="center"><A HREF="devguide-9.html">The Document and Graphics Classes</A></TD>
<TD ALIGN="right"><A HREF="devguide-12.html">The class Bounded 
</A></TD>
</TR>
<TR>
<TH ALIGN="left" WIDTH="33%"><img SRC="Images/arrow-left.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Prev"></TH>
<TH ALIGN="center" WIDTH="33%"><img SRC="Images/arrow-up.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Up"></TH>
<TH ALIGN="right" WIDTH="33%"><img SRC="Images/arrow-right.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Next"></TH>
</TR>
</TABLE>
</body>
</html>