1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: CSWS Clipping</TITLE>
<META NAME="description" CONTENT="Crystal Space: CSWS Clipping">
<META NAME="keywords" CONTENT="Crystal Space: CSWS Clipping">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC321"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_146.html#SEC320"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_148.html#SEC324"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_142.html#SEC310"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_143.html#SEC311"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_149.html#SEC326"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H3> 6.6.4 Clipping </H3>
<!--docid::SEC321::-->
<P>
Clipping is the process of removing parts of output covered by other
components. CSWS has full clipping implemented for all existing graphics
primitives. There is no drawing operation that can influence other
component's image except transparent windows. Clipping is performed in the
following fasion. First primitive is clipped against <EM>dirty</EM> rectangle
(to cut off excessive output), then it is clipped against all its neightbours,
then against `<SAMP>clip parent</SAMP>' window and all its neightbours and so on.
</P><P>
<A NAME="SEC322"></A>
<H4> Clip Parents </H4>
<!--docid::SEC322::-->
<P>
All components have a `<SAMP>parent</SAMP>' component and a `<SAMP>clipparent</SAMP>'
component. What they are used for? Usually `<SAMP>clipparent</SAMP>' is equal to
`<SAMP>parent</SAMP>' so there is no difference between them. But in some rare cases
there is a need to perform clipping in a different way. For example, popup
menus that belong to a window usually should not be clipped against that
window, but rather to the parent of parent window or even clipped only to
desktop. In this case you should assign a different clip parent to that
component. This can be performed by using <CODE>InsertClipChild()</CODE> method.
For example, to make a menu clip to application's bounds, you should call:
</P><P>
<TABLE><tr><td> </td><td class=example><pre>app->InsertClipChild(menu);
</pre></td></tr></table></P><P>
You should not assign directly to `<SAMP>clipparent</SAMP>' variable since
<CODE>InsertClipChild()</CODE> does much extra work. For example it inserts the
so-called "clip children" into component's clip child list, removes
component from former <CODE>clipparent</CODE>'s "clip children" list and so on.
</P><P>
<A NAME="SEC323"></A>
<H4> Partially Transparent Components </H4>
<!--docid::SEC323::-->
<P>
You can set a state flag called `<SAMP>CSS_TRANSPARENT</SAMP>' to mark
semi-transparent components. Transparent components works differently in the
following ways:
</P><P>
<UL>
<LI>
When a part of such a component is invalidated, the same area of parent
component is invalidated as well.
<P>
<LI>
Mouse events for such components are considered "eaten" only if component's
<CODE>HandleEvent()</CODE> method returned `<SAMP>true</SAMP>'. Otherwise, the event is
sent to the component placed below the transparent component.
<P>
<LI>
The output of windows below transparent components is not clipped. Instead
the area of transparent component covered by output is invalidated so that it
gets redrawn at the end of frame.
</UL>
<P>
<A NAME="CSWS Tutorial"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_146.html#SEC320"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_148.html#SEC324"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_142.html#SEC310"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_143.html#SEC311"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_149.html#SEC326"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
</BODY>
</HTML>
|