3 <TITLE>PatternHandler.htm
</TITLE>
4 <style type=
"text/css">
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)}
14 .WP-Default {text-align: left
; text-indent: 0px; margin-left: 0px; margin-right: 0px}
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>
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>
28 <P class=
"Body" style=
"margin: 0px"><BR>
30 <P class=
"Body" style=
"margin: 0px"><BR>
32 <TABLE WIDTH=
618 HEIGHT=
90 BORDER=
1 CELLPADDING=
1 CELLSPACING=
2>
34 <TD WIDTH=
219 HEIGHT=
17>
35 <P class=
"Body" style=
"margin: 0px">PatternHandler(void)
</P>
37 <TD WIDTH=
245 HEIGHT=
17>
38 <P class=
"Body" style=
"margin: 0px">~PatternHandler(void)
</P>
42 <TD WIDTH=
219 HEIGHT=
17>
43 <P class=
"Body" style=
"margin: 0px">void SetTarget(int8 *pattern)
</P>
45 <TD WIDTH=
245 HEIGHT=
17>
46 <P class=
"Body" style=
"margin: 0px">void SetColors(RGBColor c1, RGBColor c2)
</P>
50 <TD WIDTH=
219 HEIGHT=
17>
51 <P class=
"Body" style=
"margin: 0px">RGBColor GetColor(BPoint pt)
</P>
53 <TD WIDTH=
245 HEIGHT=
17>
54 <P class=
"Body" style=
"margin: 0px">RGBColor GetColor(float x, float y)
</P>
58 <TD WIDTH=
219 HEIGHT=
17>
59 <P class=
"Body" style=
"margin: 0px">bool GetValue(float x, float y)
</P>
61 <TD WIDTH=
245 HEIGHT=
17>
62 <P class=
"Body" style=
"margin: 0px">bool GetValue(BPoint pt)
</P>
66 <P class=
"Body" style=
"margin: 0px"><BR>
69 <P class=
"Body" style=
"margin: 0px"><BR>
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>
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>
84 <span class=
"OBOS-Function-Def">~PatternHandler()
</span><span style=
"font-size: 16pt"></span></P>
85 <P class=
"Body" style=
"margin: 0px"><BR>
87 <P class=
"Body" style=
"margin: 0px"><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>
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 ]
& (
1 << (
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">