1 /* 2 * Copyright 2008-2010 Stephan Aßmus <superstippi@gmx.de> 3 * Distributed under the terms of the MIT license. 4 */ 5 //---------------------------------------------------------------------------- 6 // Anti-Grain Geometry - Version 2.4 7 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 8 // 9 // Permission to copy, use, modify, sell and distribute this software 10 // is granted provided this copyright notice appears in all copies. 11 // This software is provided "as is" without express or implied 12 // warranty, and with no claim as to its suitability for any purpose. 13 // 14 //---------------------------------------------------------------------------- 15 // Contact: mcseem@antigrain.com 16 // mcseemagg@yahoo.com 17 // http://www.antigrain.com 18 //---------------------------------------------------------------------------- 19 // 20 // The Stack Blur Algorithm was invented by Mario Klingemann, 21 // mario@quasimondo.com and described here: 22 // http://incubator.quasimondo.com/processing/fast_blur_deluxe.php 23 // (search phrase "Stackblur: Fast But Goodlooking"). 24 // The major improvement is that there's no more division table 25 // that was very expensive to create for large blur radii. Insted, 26 // for 8-bit per channel and radius not exceeding 254 the division is 27 // replaced by multiplication and shift. 28 // 29 //---------------------------------------------------------------------------- 30 #ifndef STACK_BLUR_FILTER 31 #define STACK_BLUR_FILTER 32 33 #include <SupportDefs.h> 34 35 class BBitmap; 36 class RenderBuffer; 37 38 class StackBlurFilter { 39 public: 40 StackBlurFilter(); 41 ~StackBlurFilter(); 42 43 44 void Filter(BBitmap* bitmap, double radius); 45 46 private: 47 void _Filter32(uint8* buffer, 48 unsigned width, unsigned height, 49 int32 bpr, 50 unsigned rx, unsigned ry) const; 51 void _Filter8(uint8* buffer, 52 unsigned width, unsigned height, 53 int32 bpr, 54 unsigned rx, unsigned ry) const; 55 }; 56 57 #endif // STACK_BLUR_FILTER 58