haiku/docs/develop/servers/app_server/PatternHandler.htm

119 lines
4.9 KiB
HTML
Raw Normal View History

<HTML>
<HEAD>
<TITLE>PatternHandler.htm</TITLE>
<style type="text/css">
<!--
.Default {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 12pt}
.OBOS-Function-Def {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 16pt}
.OBOS-Title {background-color: rgb(255,255,255); color: rgb(0,128,0); font-family: 'Dutch801 Rm BT'; font-size: 24pt}
.Text-Background {background-color: rgb(255,255,255)}
.GR-Default {}
.Body {margin: 0px}
.Footer {margin: 0px}
.Header {margin: 0px}
.WP-Default {text-align: left; text-indent: 0px; margin-left: 0px; margin-right: 0px}
-->
</style>
</HEAD>
<BODY BGCOLOR="#ffffff">
<DIV class="sheet" id="Sheet 1">
<P class="Body" style="margin: 0px"><span class="OBOS-Title">PatternHandler class</span><span style="color: rgb(0,0,0); font-size: 24pt"></span></P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">PatternHandler provides an easy way to integrate pattern support into classes which require it, such as the DisplayDriver class.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><BR>
Member Functions</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=618 HEIGHT=90 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=219 HEIGHT=17>
<P class="Body" style="margin: 0px">PatternHandler(void)</P>
</TD>
<TD WIDTH=245 HEIGHT=17>
<P class="Body" style="margin: 0px">~PatternHandler(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=219 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetTarget(int8 *pattern)</P>
</TD>
<TD WIDTH=245 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetColors(RGBColor c1, RGBColor c2)</P>
</TD>
</TR>
<TR>
<TD WIDTH=219 HEIGHT=17>
<P class="Body" style="margin: 0px">RGBColor GetColor(BPoint pt)</P>
</TD>
<TD WIDTH=245 HEIGHT=17>
<P class="Body" style="margin: 0px">RGBColor GetColor(float x, float y)</P>
</TD>
</TR>
<TR>
<TD WIDTH=219 HEIGHT=17>
<P class="Body" style="margin: 0px">bool GetValue(float x, float y)</P>
</TD>
<TD WIDTH=245 HEIGHT=17>
<P class="Body" style="margin: 0px">bool GetValue(BPoint pt)</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
Enumerated Types</P>
<P class="Body" style="margin: 0px"><BR>
pattern_enum</P>
<P class="Body" style="margin: 0px">{</P>
<P class="Body" style="margin: 0px"> uint64 type64</P>
<P class="Body" style="margin: 0px"> uint8 type8 [8]</P>
<P class="Body" style="margin: 0px">}</P>
<P class="Body" style="margin: 0px"><BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">PatternHandler()</span><span style="font-size: 16pt"></span></P>
<P class="Body" style="margin: 0px"><BR>
1) Initialize internal RGBColor variables to black and white, respectively.</P>
<P class="Body" style="margin: 0px">2) Set internal pattern to B_SOLID_HIGH (all 1's)</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">~PatternHandler()</span><span style="font-size: 16pt"></span></P>
<P class="Body" style="margin: 0px"><BR>
Empty</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void SetTarget(int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><BR>
Updates the pattern handler's pattern. It copies the pattern passed to it, so it does NOT take responsibility for freeing any memory.</P>
<P class="Body" style="margin: 0px"><BR>
1) cast the passed pointer in such a way to copy it as a uint64 to the pattern_enum.type64 member</P>
<P class="Body" style="margin: 0px"><BR>
<span class="OBOS-Function-Def">void SetColors(RGBColor c1, RGBColor c2)</span></P>
<P class="Body" style="margin: 0px"><BR>
Sets the internal high and low colors for the pattern handler. These will be the colors returned when GetColor() is called.</P>
<P class="Body" style="margin: 0px"><BR>
1) Assign c1 to high color and c2 to low color</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">RGBColor GetColor(BPoint pt)
RGBColor GetColor (float x, float y)</span></P>
<P class="Body" style="margin: 0px"><BR>
<span class="OBOS-Function-Def">bool GetValue(BPoint pt)
bool GetValue (float x, float y)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def"><BR>
</span><span class="Default">GetColor returns the color in the pattern at the specified location. GetValue returns true for the high color and false for the low color.</span></P>
<P class="Body" style="margin: 0px"><span class="Default"><BR>
1) xpos = x % 8, ypos = y % 8
2) value = pointer [ ypos ] &amp; ( 1 &lt;&lt; (7 - xpos) )</span></P>
<P class="Body" style="margin: 0px"><span class="Default">3) GetValue: return (value==0)?false:true</span></P>
<P class="Body" style="margin: 0px"><span class="Default">GetColor: return (value==0)?lowcolor:highcolor</span></P>
<DIV class="layer" id="Layer 1">
</DIV>
</DIV>
</BODY>
</HTML>