1 /* 2 * Copyright 2003-2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Adrian Oanca <adioanca@cotty.iren.ro> 7 * Axel Dörfler, axeld@pinc-software.de 8 */ 9 #ifndef VIEW_PRIVATE_H 10 #define VIEW_PRIVATE_H 11 12 13 #include <PortLink.h> 14 15 #include <Font.h> 16 #include <InterfaceDefs.h> 17 #include <Point.h> 18 #include <Rect.h> 19 #include <Region.h> 20 21 const static uint32 kDeleteDragger = 'JAHA'; 22 23 struct shape_data { 24 uint32* opList; 25 int32 opCount; 26 int32 opSize; 27 int32 opBlockSize; 28 BPoint* ptList; 29 int32 ptCount; 30 int32 ptSize; 31 int32 ptBlockSize; 32 }; 33 34 enum { 35 B_VIEW_FONT_BIT = 0x00000001, 36 B_VIEW_HIGH_COLOR_BIT = 0x00000002, 37 B_VIEW_DRAWING_MODE_BIT = 0x00000004, 38 B_VIEW_CLIP_REGION_BIT = 0x00000008, 39 B_VIEW_LINE_MODES_BIT = 0x00000010, 40 B_VIEW_BLENDING_BIT = 0x00000020, 41 B_VIEW_SCALE_BIT = 0x00000040, 42 B_VIEW_FONT_ALIASING_BIT = 0x00000080, 43 B_VIEW_FRAME_BIT = 0x00000100, 44 B_VIEW_ORIGIN_BIT = 0x00000200, 45 B_VIEW_PEN_SIZE_BIT = 0x00000400, 46 B_VIEW_PEN_LOCATION_BIT = 0x00000800, 47 B_VIEW_LOW_COLOR_BIT = 0x00008000, 48 B_VIEW_VIEW_COLOR_BIT = 0x00010000, 49 B_VIEW_PATTERN_BIT = 0x00020000, 50 51 B_VIEW_ALL_BITS = 0x0003ffff, 52 53 // these used for archiving only 54 B_VIEW_RESIZE_BIT = 0x00001000, 55 B_VIEW_FLAGS_BIT = 0x00002000, 56 B_VIEW_EVENT_MASK_BIT = 0x00004000 57 }; 58 59 60 namespace BPrivate { 61 62 class ViewState { 63 public: 64 ViewState(); 65 66 inline bool IsValid(uint32 bit) const; 67 inline bool IsAllValid() const; 68 69 void UpdateServerFontState(BPrivate::PortLink &link); 70 void UpdateServerState(BPrivate::PortLink &link); 71 72 void UpdateFrom(BPrivate::PortLink &link); 73 74 public: 75 BPoint pen_location; 76 float pen_size; 77 78 rgb_color high_color; 79 rgb_color low_color; 80 81 // This one is not affected by pop state/push state 82 rgb_color view_color; 83 84 ::pattern pattern; 85 86 ::drawing_mode drawing_mode; 87 BRegion clipping_region; 88 bool clipping_region_used; 89 BPoint origin; 90 91 // line modes 92 join_mode line_join; 93 cap_mode line_cap; 94 float miter_limit; 95 96 // alpha blending 97 source_alpha alpha_source_mode; 98 alpha_function alpha_function_mode; 99 100 float scale; 101 102 // fonts 103 BFont font; 104 uint16 font_flags; 105 bool font_aliasing; 106 // font aliasing. Used for printing only! 107 108 // flags used for synchronization with app_server 109 uint32 valid_flags; 110 // flags used for archiving 111 uint32 archiving_flags; 112 }; 113 114 inline bool 115 ViewState::IsValid(uint32 bit) const 116 { 117 return valid_flags & bit; 118 } 119 120 inline bool 121 ViewState::IsAllValid() const 122 { 123 return (valid_flags & B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT) 124 == (B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT); 125 } 126 127 } // namespace BPrivate 128 129 struct _array_hdr_{ 130 float startX; 131 float startY; 132 float endX; 133 float endY; 134 rgb_color color; 135 }; 136 137 struct _array_data_{ 138 // the max number of points in the array 139 uint32 maxCount; 140 // the current number of points in the array 141 uint32 count; 142 // the array of points 143 _array_hdr_* array; 144 }; 145 146 #endif /* VIEW_PRIVATE_H */ 147