This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathbitmapeffectblur.h
More file actions
71 lines (56 loc) · 2.57 KB
/
bitmapeffectblur.h
File metadata and controls
71 lines (56 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* Copyright (C) 2003-2015 LiveCode Ltd.
This file is part of LiveCode.
LiveCode is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License v3 as published by the Free
Software Foundation.
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
#ifndef __MC_BITMAP_EFFECT_BLUR__
#define __MC_BITMAP_EFFECT_BLUR__
typedef struct MCBitmapEffectBlur *MCBitmapEffectBlurRef;
enum MCBitmapEffectFilter
{
// The faster (separated) 2*s*w*h algorithm.
kMCBitmapEffectFilterFastGaussian,
// One pass box blur filter
kMCBitmapEffectFilterOnePassBox,
// Two pass box blur filter
kMCBitmapEffectFilterTwoPassBox,
// Three pass box blur filter
kMCBitmapEffectFilterThreePassBox
};
// This structure defines the parameters that affect the blur operation. At
// present it is only the radius and quality, but will include spread/range eventually.
struct MCBitmapEffectBlurParameters
{
int32_t radius;
uint8_t spread;
MCBitmapEffectFilter filter;
};
// Start a blur effect using the given parameters, returning an opaque state
// object in r_blur.
//
// The output_rect defines the region in the plane for which mask values need
// to be computed. The input_rect defines the region in the plane that the
// provided 'pixels' pointer is defined. When generating the blurred mask, any
// pixels outside of the input region should be considered to be transparent.
// Note that the input pixels are ARGB (32-bit) and it is the alpha channel that
// is being blurred, while only an output mask (8-bit values) is required.
//
// MP-2013-02-05: [[ x64 ]] Change strides to be signed to avoid problems with
// ptr arithmetic and promotions in 64-bit.
bool MCBitmapEffectBlurBegin(const MCBitmapEffectBlurParameters& params, const MCRectangle& input_rect, const MCRectangle& output_rect, uint32_t *src_pixels, int32_t src_stride, MCBitmapEffectBlurRef& r_blur);
// Continue a blur effect by generating the next output scanline.
//
// The mask argument points to a buffer of mask values big enough for a single
// output scanline. (i.e. output_rect . width in size).
//
void MCBitmapEffectBlurContinue(MCBitmapEffectBlurRef blur, uint8_t *mask);
// End the blur effect, and clean up any temporary resources.
//
void MCBitmapEffectBlurEnd(MCBitmapEffectBlurRef blur);
#endif