vfs: check userland buffers before reading them.
[haiku.git] / docs / develop / servers / app_server / PatternHandler.htm
blobead8019a5623eeb4713d355b7757403a28a2c4db
1 <HTML>
2 <HEAD>
3 <TITLE>PatternHandler.htm</TITLE>
4 <style type="text/css">
5 <!--
6 .Default {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 12pt}
7 .OBOS-Function-Def {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 16pt}
8 .OBOS-Title {background-color: rgb(255,255,255); color: rgb(0,128,0); font-family: 'Dutch801 Rm BT'; font-size: 24pt}
9 .Text-Background {background-color: rgb(255,255,255)}
10 .GR-Default {}
11 .Body {margin: 0px}
12 .Footer {margin: 0px}
13 .Header {margin: 0px}
14 .WP-Default {text-align: left; text-indent: 0px; margin-left: 0px; margin-right: 0px}
15 -->
16 </style>
17 </HEAD>
18 <BODY BGCOLOR="#ffffff">
19 <DIV class="sheet" id="Sheet 1">
20 <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>
21 <P class="Body" style="margin: 0px"><BR>
22 </P>
23 <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>
24 <P class="Body" style="margin: 0px"><BR>
25 <BR>
26 <HR>
27 </P>
28 <P class="Body" style="margin: 0px"><BR>
29 Member Functions</P>
30 <P class="Body" style="margin: 0px"><BR>
31 </P>
32 <TABLE WIDTH=618 HEIGHT=90 BORDER=1 CELLPADDING=1 CELLSPACING=2>
33 <TR>
34 <TD WIDTH=219 HEIGHT=17>
35 <P class="Body" style="margin: 0px">PatternHandler(void)</P>
36 </TD>
37 <TD WIDTH=245 HEIGHT=17>
38 <P class="Body" style="margin: 0px">~PatternHandler(void)</P>
39 </TD>
40 </TR>
41 <TR>
42 <TD WIDTH=219 HEIGHT=17>
43 <P class="Body" style="margin: 0px">void SetTarget(int8 *pattern)</P>
44 </TD>
45 <TD WIDTH=245 HEIGHT=17>
46 <P class="Body" style="margin: 0px">void SetColors(RGBColor c1, RGBColor c2)</P>
47 </TD>
48 </TR>
49 <TR>
50 <TD WIDTH=219 HEIGHT=17>
51 <P class="Body" style="margin: 0px">RGBColor GetColor(BPoint pt)</P>
52 </TD>
53 <TD WIDTH=245 HEIGHT=17>
54 <P class="Body" style="margin: 0px">RGBColor GetColor(float x, float y)</P>
55 </TD>
56 </TR>
57 <TR>
58 <TD WIDTH=219 HEIGHT=17>
59 <P class="Body" style="margin: 0px">bool GetValue(float x, float y)</P>
60 </TD>
61 <TD WIDTH=245 HEIGHT=17>
62 <P class="Body" style="margin: 0px">bool GetValue(BPoint pt)</P>
63 </TD>
64 </TR>
65 </TABLE>
66 <P class="Body" style="margin: 0px"><BR>
67 <BR>
68 Enumerated Types</P>
69 <P class="Body" style="margin: 0px"><BR>
70 pattern_enum</P>
71 <P class="Body" style="margin: 0px">{</P>
72 <P class="Body" style="margin: 0px"> uint64 type64</P>
73 <P class="Body" style="margin: 0px"> uint8 type8 [8]</P>
74 <P class="Body" style="margin: 0px">}</P>
75 <P class="Body" style="margin: 0px"><BR>
76 <HR>
77 </P>
78 <P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">PatternHandler()</span><span style="font-size: 16pt"></span></P>
79 <P class="Body" style="margin: 0px"><BR>
80 1) Initialize internal RGBColor variables to black and white, respectively.</P>
81 <P class="Body" style="margin: 0px">2) Set internal pattern to B_SOLID_HIGH (all 1's)</P>
82 <P class="Body" style="margin: 0px"><BR>
83 <BR>
84 <span class="OBOS-Function-Def">~PatternHandler()</span><span style="font-size: 16pt"></span></P>
85 <P class="Body" style="margin: 0px"><BR>
86 Empty</P>
87 <P class="Body" style="margin: 0px"><BR>
88 <BR>
89 <span class="OBOS-Function-Def">void SetTarget(int8 *pattern)</span></P>
90 <P class="Body" style="margin: 0px"><BR>
91 Updates the pattern handler's pattern. It copies the pattern passed to it, so it does NOT take responsibility for freeing any memory.</P>
92 <P class="Body" style="margin: 0px"><BR>
93 1) cast the passed pointer in such a way to copy it as a uint64 to the pattern_enum.type64 member</P>
94 <P class="Body" style="margin: 0px"><BR>
95 <span class="OBOS-Function-Def">void SetColors(RGBColor c1, RGBColor c2)</span></P>
96 <P class="Body" style="margin: 0px"><BR>
97 Sets the internal high and low colors for the pattern handler. These will be the colors returned when GetColor() is called.</P>
98 <P class="Body" style="margin: 0px"><BR>
99 1) Assign c1 to high color and c2 to low color</P>
100 <P class="Body" style="margin: 0px"><BR>
101 <BR>
102 <span class="OBOS-Function-Def">RGBColor GetColor(BPoint pt)
103 RGBColor GetColor (float x, float y)</span></P>
104 <P class="Body" style="margin: 0px"><BR>
105 <span class="OBOS-Function-Def">bool GetValue(BPoint pt)
106 bool GetValue (float x, float y)</span></P>
107 <P class="Body" style="margin: 0px"><span class="OBOS-Function-Def"><BR>
108 </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>
109 <P class="Body" style="margin: 0px"><span class="Default"><BR>
110 1) xpos = x % 8, ypos = y % 8
111 2) value = pointer [ ypos ] &amp; ( 1 &lt;&lt; (7 - xpos) )</span></P>
112 <P class="Body" style="margin: 0px"><span class="Default">3) GetValue: return (value==0)?false:true</span></P>
113 <P class="Body" style="margin: 0px"><span class="Default">GetColor: return (value==0)?lowcolor:highcolor</span></P>
114 <DIV class="layer" id="Layer 1">
115 </DIV>
116 </DIV>
117 </BODY>
118 </HTML>