💾 Archived View for lofi.haiku-os.org › docs › develop › servers › app_server › PatternHandler.gmi captured on 2024-08-25 at 00:21:49. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-09-28)
-=-=-=-=-=-=-
PatternHandler provides an easy way to integrate pattern support into classes which require it, such as the DisplayDriver class.
1. Initialize internal RGBColor variables to black and white, respectively.
2. Set internal pattern to B_SOLID_HIGH (all 1’s)
Empty
Updates the pattern handler’s pattern. It copies the pattern passed to it, so it does NOT take responsibility for freeing any memory.
1. cast the passed pointer in such a way to copy it as a uint64 to the pattern_enum.type64 member
Sets the internal high and low colors for the pattern handler. These will be the colors returned when GetColor() is called.
1. Assign c1 to high color and c2 to low color
GetColor returns the color in the pattern at the specified location. GetValue returns true for the high color and false for the low color.
1. xpos = x % 8, ypos = y % 8 2) value = pointer [ ypos ] & ( 1 << (7 - xpos) )
2. GetValue: return (value==0)?false:true
3. GetColor: return (value==0)?lowcolor:highcolor