132517Sgibbs/*
232517Sgibbs * Copyright 2008-2010 Stephan A��mus <superstippi@gmx.de>
332517Sgibbs * Distributed under the terms of the MIT license.
432517Sgibbs */
532517Sgibbs//----------------------------------------------------------------------------
632517Sgibbs// Anti-Grain Geometry - Version 2.4
732517Sgibbs// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
832517Sgibbs//
932517Sgibbs// Permission to copy, use, modify, sell and distribute this software
1032517Sgibbs// is granted provided this copyright notice appears in all copies.
1132517Sgibbs// This software is provided "as is" without express or implied
1232517Sgibbs// warranty, and with no claim as to its suitability for any purpose.
1332517Sgibbs//
1432517Sgibbs//----------------------------------------------------------------------------
1532517Sgibbs// Contact: mcseem@antigrain.com
1632517Sgibbs//          mcseemagg@yahoo.com
1732517Sgibbs//          http://www.antigrain.com
1832517Sgibbs//----------------------------------------------------------------------------
1932517Sgibbs//
2032517Sgibbs// The Stack Blur Algorithm was invented by Mario Klingemann,
2132517Sgibbs// mario@quasimondo.com and described here:
2232517Sgibbs// http://incubator.quasimondo.com/processing/fast_blur_deluxe.php
2332517Sgibbs// (search phrase "Stackblur: Fast But Goodlooking").
2432517Sgibbs// The major improvement is that there's no more division table
2532517Sgibbs// that was very expensive to create for large blur radii. Insted,
2632517Sgibbs// for 8-bit per channel and radius not exceeding 254 the division is
2732517Sgibbs// replaced by multiplication and shift.
2832517Sgibbs//
2932517Sgibbs//----------------------------------------------------------------------------
3032517Sgibbs#ifndef STACK_BLUR_FILTER
3132517Sgibbs#define STACK_BLUR_FILTER
3232517Sgibbs
3332517Sgibbs#include <SupportDefs.h>
3432517Sgibbs
3532517Sgibbsclass BBitmap;
3632517Sgibbsclass RenderBuffer;
3732517Sgibbs
3832517Sgibbsclass StackBlurFilter {
3932517Sgibbspublic:
40139790Simp								StackBlurFilter();
4132517Sgibbs								~StackBlurFilter();
4232517Sgibbs
4332517Sgibbs
4432517Sgibbs			void				Filter(BBitmap* bitmap, double radius);
4532517Sgibbs
4632517Sgibbsprivate:
4732517Sgibbs			void				_Filter32(uint8* buffer,
4832517Sgibbs										  unsigned width, unsigned height,
4932517Sgibbs										  int32 bpr,
5032517Sgibbs										  unsigned rx, unsigned ry) const;
5132517Sgibbs			void				_Filter8(uint8* buffer,
5232517Sgibbs										 unsigned width, unsigned height,
5332517Sgibbs										 int32 bpr,
5432517Sgibbs										 unsigned rx, unsigned ry) const;
5532517Sgibbs};
5632517Sgibbs
5732517Sgibbs#endif // STACK_BLUR_FILTER
5832517Sgibbs