1PatternHandler class 2#################### 3 4PatternHandler provides an easy way to integrate pattern support into 5classes which require it, such as the DisplayDriver class. 6 7 8Enumerated Types 9================ 10 11pattern_enum 12------------ 13 14- uint64 type64 15- uint8 type8 [8] 16 17Member Functions 18================ 19 20PatternHandler() 21---------------- 22 23 241. Initialize internal RGBColor variables to black and white, respectively. 252. Set internal pattern to B_SOLID_HIGH (all 1's) 26 27~PatternHandler() 28----------------- 29 30Empty 31 32 33void SetTarget(int8 \*pattern) 34------------------------------ 35 36Updates the pattern handler's pattern. It copies the pattern passed to 37it, so it does NOT take responsibility for freeing any memory. 38 39 401. cast the passed pointer in such a way to copy it as a uint64 to the 41 pattern_enum.type64 member 42 43void SetColors(RGBColor c1, RGBColor c2) 44---------------------------------------- 45 46Sets the internal high and low colors for the pattern handler. These 47will be the colors returned when GetColor() is called. 48 49 501. Assign c1 to high color and c2 to low color 51 52 53RGBColor GetColor(BPoint pt) RGBColor GetColor (float x, float y) 54----------------------------------------------------------------- 55 56bool GetValue(BPoint pt) bool GetValue (float x, float y) 57--------------------------------------------------------- 58 59GetColor returns the color in the pattern at the specified location. 60GetValue returns true for the high color and false for the low color. 61 621. xpos = x % 8, ypos = y % 8 2) value = pointer [ ypos ] & ( 1 << (7 - xpos) ) 632. GetValue: return (value==0)?false:true 643. GetColor: return (value==0)?lowcolor:highcolor 65 66