xref: /haiku/docs/develop/servers/app_server/PatternHandler.rst (revision a5061ecec55353a5f394759473f1fd6df04890da)
1*a5061eceSAdrien DestuguesPatternHandler class
2*a5061eceSAdrien Destugues####################
3*a5061eceSAdrien Destugues
4*a5061eceSAdrien DestuguesPatternHandler provides an easy way to integrate pattern support into
5*a5061eceSAdrien Destuguesclasses which require it, such as the DisplayDriver class.
6*a5061eceSAdrien Destugues
7*a5061eceSAdrien Destugues
8*a5061eceSAdrien DestuguesEnumerated Types
9*a5061eceSAdrien Destugues================
10*a5061eceSAdrien Destugues
11*a5061eceSAdrien Destuguespattern_enum
12*a5061eceSAdrien Destugues------------
13*a5061eceSAdrien Destugues
14*a5061eceSAdrien Destugues- uint64 type64
15*a5061eceSAdrien Destugues- uint8 type8 [8]
16*a5061eceSAdrien Destugues
17*a5061eceSAdrien DestuguesMember Functions
18*a5061eceSAdrien Destugues================
19*a5061eceSAdrien Destugues
20*a5061eceSAdrien DestuguesPatternHandler()
21*a5061eceSAdrien Destugues----------------
22*a5061eceSAdrien Destugues
23*a5061eceSAdrien Destugues
24*a5061eceSAdrien Destugues1. Initialize internal RGBColor variables to black and white, respectively.
25*a5061eceSAdrien Destugues2. Set internal pattern to B_SOLID_HIGH (all 1's)
26*a5061eceSAdrien Destugues
27*a5061eceSAdrien Destugues~PatternHandler()
28*a5061eceSAdrien Destugues-----------------
29*a5061eceSAdrien Destugues
30*a5061eceSAdrien DestuguesEmpty
31*a5061eceSAdrien Destugues
32*a5061eceSAdrien Destugues
33*a5061eceSAdrien Destuguesvoid SetTarget(int8 \*pattern)
34*a5061eceSAdrien Destugues------------------------------
35*a5061eceSAdrien Destugues
36*a5061eceSAdrien DestuguesUpdates the pattern handler's pattern. It copies the pattern passed to
37*a5061eceSAdrien Destuguesit, so it does NOT take responsibility for freeing any memory.
38*a5061eceSAdrien Destugues
39*a5061eceSAdrien Destugues
40*a5061eceSAdrien Destugues1. cast the passed pointer in such a way to copy it as a uint64 to the
41*a5061eceSAdrien Destugues   pattern_enum.type64 member
42*a5061eceSAdrien Destugues
43*a5061eceSAdrien Destuguesvoid SetColors(RGBColor c1, RGBColor c2)
44*a5061eceSAdrien Destugues----------------------------------------
45*a5061eceSAdrien Destugues
46*a5061eceSAdrien DestuguesSets the internal high and low colors for the pattern handler. These
47*a5061eceSAdrien Destugueswill be the colors returned when GetColor() is called.
48*a5061eceSAdrien Destugues
49*a5061eceSAdrien Destugues
50*a5061eceSAdrien Destugues1. Assign c1 to high color and c2 to low color
51*a5061eceSAdrien Destugues
52*a5061eceSAdrien Destugues
53*a5061eceSAdrien DestuguesRGBColor GetColor(BPoint pt) RGBColor GetColor (float x, float y)
54*a5061eceSAdrien Destugues-----------------------------------------------------------------
55*a5061eceSAdrien Destugues
56*a5061eceSAdrien Destuguesbool GetValue(BPoint pt) bool GetValue (float x, float y)
57*a5061eceSAdrien Destugues---------------------------------------------------------
58*a5061eceSAdrien Destugues
59*a5061eceSAdrien DestuguesGetColor returns the color in the pattern at the specified location.
60*a5061eceSAdrien DestuguesGetValue returns true for the high color and false for the low color.
61*a5061eceSAdrien Destugues
62*a5061eceSAdrien Destugues1. xpos = x % 8, ypos = y % 8 2) value = pointer [ ypos ] & ( 1 << (7 - xpos) )
63*a5061eceSAdrien Destugues2. GetValue: return (value==0)?false:true
64*a5061eceSAdrien Destugues3. GetColor: return (value==0)?lowcolor:highcolor
65*a5061eceSAdrien Destugues
66