1 #include <Application.h> 2 #include <Bitmap.h> 3 #include <View.h> 4 #include <Window.h> 5 #include <stdio.h> 6 #include <string.h> 7 8 uint32 kBitmapBits[] = { 9 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 10 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 11 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 12 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 13 0x00777477, 0x00777477, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 14 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 15 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 16 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 17 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 18 0x00777477, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00111111, 19 0x00777777, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 20 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 21 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 22 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 23 0x00777477, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00111111, 24 0x00777777, 0x00444444, 0x00000000, 0x00000000, 0x00777477, 0x00777477, 25 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 26 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 27 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 28 0x00777477, 0x00000000, 0x00000000, 0x00bb0000, 0x00ffffff, 0x00000000, 29 0x00444444, 0x00777777, 0x00111111, 0x00000000, 0x00000000, 0x00000000, 30 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 31 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 32 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 33 0x00777477, 0x00777477, 0x00000000, 0x00bb0000, 0x00ee0000, 0x00ee0000, 34 0x00ff0000, 0x00ffffff, 0x00ee0000, 0x00111111, 0x00000000, 0x00000000, 35 0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 36 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 37 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 38 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00bb0000, 0x00ee0000, 39 0x00ee0000, 0x00ff0000, 0x00ffffff, 0x00ee0000, 0x00ee0000, 0x00ee0000, 40 0x00000000, 0x00000000, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 41 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 42 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 43 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00bb0000, 44 0x00ee0000, 0x00ee0000, 0x00ff0000, 0x00ffffff, 0x00ee0000, 0x00ee0000, 45 0x00ee0000, 0x00cc0000, 0x00000000, 0x00000000, 0x00000000, 0x00777477, 46 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 47 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 48 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 49 0x00bb0000, 0x00ee0000, 0x00ee0000, 0x00ff0000, 0x00ffffff, 0x00ee0000, 50 0x00ee0000, 0x00ee0000, 0x00cc0000, 0x00990000, 0x00990000, 0x00000000, 51 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 52 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 53 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 54 0x00777477, 0x00000000, 0x00ee0000, 0x00ee0000, 0x00ee0000, 0x00ffffff, 55 0x00ee0000, 0x00ff0000, 0x00cc0000, 0x00cc0000, 0x00990000, 0x00bb0000, 56 0x00880000, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 57 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 58 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 59 0x00777477, 0x00777477, 0x00000000, 0x00ee0000, 0x00ee0000, 0x00ee0000, 60 0x00ffffff, 0x00ee0000, 0x00ff0000, 0x00cc0000, 0x00cc0000, 0x00990000, 61 0x00bb0000, 0x00880000, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 62 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 63 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 64 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ee0000, 0x00ee0000, 65 0x00ee0000, 0x00ffffff, 0x00ee0000, 0x00ff0000, 0x00cc0000, 0x00cc0000, 66 0x00990000, 0x00bb0000, 0x00880000, 0x00990000, 0x00000000, 0x00777477, 67 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 68 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 69 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ee0000, 70 0x00ee0000, 0x00ee0000, 0x00ffffff, 0x00ee0000, 0x00ff0000, 0x00cc0000, 71 0x00cc0000, 0x00990000, 0x00bb0000, 0x00880000, 0x00990000, 0x00000000, 72 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 73 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 74 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 75 0x00000000, 0x00ee0000, 0x00ff0000, 0x00ffffff, 0x00ee0000, 0x00ee0000, 76 0x00ee0000, 0x00cc0000, 0x00990000, 0x00bb0000, 0x00880000, 0x00880000, 77 0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 78 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 79 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 80 0x00777477, 0x00000000, 0x00ee0000, 0x00ee0000, 0x00ffffff, 0x00ee0000, 81 0x00ff0000, 0x00cc0000, 0x00cc0000, 0x00990000, 0x00bb0000, 0x00880000, 82 0x00990000, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 83 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 84 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00000000, 0x00000000, 85 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00ee0000, 0x00ffffff, 86 0x00ee0000, 0x00ff0000, 0x00cc0000, 0x00cc0000, 0x00990000, 0x00bb0000, 87 0x00880000, 0x00000000, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 88 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 89 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ff6666, 90 0x00ff6666, 0x00ff6666, 0x00ff6666, 0x00880000, 0x00000000, 0x00ee0000, 91 0x00ff6666, 0x00000000, 0x00ee0000, 0x00ee0000, 0x00bb0000, 0x00bb0000, 92 0x00bb0000, 0x00880000, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 93 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 94 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 95 0x00ee0000, 0x00ff0000, 0x00ee0000, 0x00880000, 0x00990000, 0x00000000, 96 0x00ee0000, 0x00ff6666, 0x00880000, 0x00000000, 0x00cc0000, 0x00990000, 97 0x00bb0000, 0x00880000, 0x00990000, 0x00000000, 0x00777477, 0x00777477, 98 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 99 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 100 0x00000000, 0x00ee0000, 0x00ff0000, 0x00ee0000, 0x00880000, 0x00990000, 101 0x00000000, 0x00ee0000, 0x00ff6666, 0x00880000, 0x00000000, 0x00990000, 102 0x00880000, 0x00880000, 0x00990000, 0x00000000, 0x00000000, 0x00777477, 103 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 104 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 105 0x00777477, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 106 0x00000000, 0x00000000, 0x00000000, 0x00ff6666, 0x00880000, 0x00000000, 107 0x00990000, 0x00880000, 0x00880000, 0x00000000, 0x00000000, 0x00777477, 108 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 109 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 110 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 111 0x00777477, 0x00777477, 0x00000000, 0x00444444, 0x00ff6666, 0x00880000, 112 0x00000000, 0x00990000, 0x00880000, 0x00880000, 0x00000000, 0x00ee0000, 113 0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 114 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00777777, 115 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 116 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ff6666, 117 0x00880000, 0x00000000, 0x00000000, 0x00000000, 0x00990000, 0x00000000, 118 0x00880000, 0x00ee0000, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 119 0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 120 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 121 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00000000, 122 0x00ff9900, 0x00000000, 0x00000000, 0x00000000, 0x00444444, 0x00000000, 123 0x00000000, 0x00880000, 0x00990000, 0x00ee0000, 0x00000000, 0x00777477, 124 0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 125 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 126 0x00777777, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 127 0x00ff9900, 0x00ff9900, 0x00ffff00, 0x00ffff00, 0x00ffff00, 0x00000000, 128 0x00444444, 0x00000000, 0x00000000, 0x00880000, 0x00ff0000, 0x00ee0000, 129 0x00000000, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 130 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 131 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477, 132 0x00000000, 0x00ff9900, 0x00ff9900, 0x00ffff00, 0x00ffff00, 0x00ffff00, 133 0x00ff9900, 0x00000000, 0x00000000, 0x00777477, 0x00000000, 0x00ee0000, 134 0x00ff0000, 0x00880000, 0x00000000, 0x00777477, 0x00777777, 0x00777777, 135 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 136 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 137 0x00777477, 0x00777477, 0x00000000, 0x00ff9900, 0x00ff9900, 0x00ffff00, 138 0x00ffff00, 0x00ff9900, 0x00000000, 0x00777777, 0x00777777, 0x00777777, 139 0x00000000, 0x00ee0000, 0x00990000, 0x00000000, 0x00777777, 0x00777777, 140 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 141 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 142 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ff9900, 0x00ff9900, 143 0x00ffff00, 0x00ff9900, 0x00ff9900, 0x00ff9900, 0x00000000, 0x00777777, 144 0x00777777, 0x00777777, 0x00000000, 0x00880000, 0x00000000, 0x00777777, 145 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 146 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 147 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 148 0x00ff9900, 0x00ffff00, 0x00ff9900, 0x00ff9900, 0x00ff9900, 0x00000000, 149 0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00000000, 0x00000000, 150 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 151 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477, 152 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 153 0x00000000, 0x00ff9900, 0x00ffff00, 0x00ff9900, 0x00ff9900, 0x00000000, 154 0x00000000, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 155 0x00000000, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 156 0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 157 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 158 0x00777477, 0x00777477, 0x00000000, 0x00ffff00, 0x00ff9900, 0x00000000, 159 0x00000000, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 160 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 161 0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 162 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 163 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00000000, 164 0x00000000, 0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 165 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 166 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 167 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 168 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 169 0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 170 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 171 0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 172 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 173 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 174 0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 175 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477, 176 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00777777, 177 0x00777777, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 178 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 179 0x00777477, 0x00777477, 0x00777477, 0x00777477 180 }; 181 182 class DrawingModeView : public BView { 183 public: 184 DrawingModeView(BRect frame); 185 virtual ~DrawingModeView(); 186 187 virtual void Draw(BRect updateRect); 188 189 private: 190 BBitmap * fBitmap; 191 }; 192 193 194 class DrawingModeWindow : public BWindow { 195 public: 196 DrawingModeWindow(BRect frame); 197 198 private: 199 DrawingModeView * fView; 200 }; 201 202 203 class DrawingModeApp : public BApplication { 204 public: 205 DrawingModeApp(); 206 207 private: 208 DrawingModeWindow * fWindow; 209 }; 210 211 212 DrawingModeApp::DrawingModeApp() 213 : BApplication("application/x.vnd-Haiku.DrawingModeTest") 214 { 215 fWindow = new DrawingModeWindow(BRect(200, 200, 380, 600)); 216 fWindow->Show(); 217 } 218 219 220 DrawingModeWindow::DrawingModeWindow(BRect frame) 221 : BWindow(frame, "Drawing Modes Test", B_TITLED_WINDOW, 222 B_QUIT_ON_WINDOW_CLOSE) 223 { 224 fView = new DrawingModeView(frame.OffsetToSelf(0, 0)); 225 AddChild(fView); 226 fView->SetViewColor(255, 203, 0); 227 fView->SetDrawingMode(B_OP_OVER); 228 } 229 230 231 DrawingModeView::DrawingModeView(BRect frame) 232 : BView(frame, "DrawingModeView", B_FOLLOW_ALL, B_WILL_DRAW), 233 fBitmap(NULL) 234 { 235 fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_RGB32); 236 memcpy(fBitmap->Bits(), kBitmapBits, fBitmap->BitsLength()); 237 } 238 239 240 DrawingModeView::~DrawingModeView() 241 { 242 delete fBitmap; 243 } 244 245 246 void 247 DrawingModeView::Draw(BRect updateRect) 248 { 249 SetDrawingMode(B_OP_COPY); 250 SetLowColor(ViewColor()); 251 FillRect(Bounds(), B_SOLID_LOW); 252 253 SetLowColor(255, 0, 0); 254 SetHighColor(0, 0, 255); 255 256 BRect bitmapBounds = fBitmap->Bounds(); 257 int32 imageHeight = bitmapBounds.IntegerHeight() + 10; 258 int32 imageWidth = bitmapBounds.IntegerWidth() + 10; 259 260 struct { 261 drawing_mode mode; 262 const char *name; 263 } drawingModes[] = { 264 { B_OP_COPY, "B_OP_COPY" }, 265 { B_OP_OVER, "B_OP_OVER" }, 266 { B_OP_ERASE, "B_OP_ERASE" }, 267 { B_OP_INVERT, "B_OP_INVERT" }, 268 { B_OP_SELECT, "B_OP_SELECT" }, 269 { B_OP_ADD, "B_OP_ADD" }, 270 { B_OP_SUBTRACT, "B_OP_SUBTRACT" }, 271 { B_OP_BLEND, "B_OP_BLEND" }, 272 { B_OP_MIN, "B_OP_MIN" }, 273 { B_OP_MAX, "B_OP_MAX" } 274 }; 275 276 int32 modeCount = sizeof(drawingModes) / sizeof(drawingModes[0]); 277 for (int32 i = 0; i < modeCount; i++) { 278 if (drawingModes[i].mode == B_OP_SELECT) { 279 // make the background contain the low and high color to see 280 // actual effect of B_OP_SELECT 281 SetDrawingMode(B_OP_COPY); 282 FillRect(BRect(0, imageHeight * i, imageWidth * 2 - 10, 283 imageHeight * i + bitmapBounds.Height() / 2), B_SOLID_LOW); 284 FillRect(BRect(0, imageHeight * i + bitmapBounds.Height() / 2, 285 imageWidth * 2 - 10, imageHeight * i + bitmapBounds.Height()), 286 B_SOLID_HIGH); 287 } else if (drawingModes[i].mode == B_OP_MAX 288 || drawingModes[i].mode == B_OP_MIN) { 289 // need a darker/lighter color as a background otherwise nothing 290 // will be selected from the source 291 SetDrawingMode(B_OP_COPY); 292 SetHighColor(255, 255, 255); 293 FillRect(BRect(0, imageHeight * i, imageWidth * 2 - 10, 294 imageHeight * i + bitmapBounds.Height() / 3), B_SOLID_HIGH); 295 SetHighColor(128, 128, 128); 296 FillRect(BRect(0, imageHeight * i + bitmapBounds.Height() / 3, 297 imageWidth * 2 - 10, imageHeight * i + bitmapBounds.Height()), 298 B_SOLID_HIGH); 299 SetHighColor(0, 0, 0); 300 FillRect(BRect(0, imageHeight * i + bitmapBounds.Height() / 3 * 2, 301 imageWidth * 2 - 10, imageHeight * i + bitmapBounds.Height()), 302 B_SOLID_HIGH); 303 SetHighColor(0, 0, 255); 304 } 305 306 SetDrawingMode(drawingModes[i].mode); 307 DrawBitmap(fBitmap, BPoint(0, imageHeight * i)); 308 FillRect(bitmapBounds.OffsetToCopy(imageWidth, 309 imageHeight * i), B_MIXED_COLORS); 310 311 SetDrawingMode(B_OP_OVER); 312 DrawString(drawingModes[i].name, BPoint(imageWidth * 2, 313 imageHeight * i + 20)); 314 } 315 } 316 317 318 int 319 main(int argc, const char *argv[]) 320 { 321 DrawingModeApp *app = new DrawingModeApp(); 322 app->Run(); 323 delete app; 324 return 0; 325 } 326