1 | // Aseprite Document Library |
2 | // Copyright (C) 2019 Igara Studio S.A. |
3 | // Copyright (c) 2001-2017 David Capello |
4 | // |
5 | // This file is released under the terms of the MIT license. |
6 | // Read LICENSE.txt for more information. |
7 | |
8 | #ifndef DOC_BLEND_FUNCS_H_INCLUDED |
9 | #define DOC_BLEND_FUNCS_H_INCLUDED |
10 | #pragma once |
11 | |
12 | #include "doc/blend_mode.h" |
13 | #include "doc/color.h" |
14 | |
15 | namespace doc { |
16 | |
17 | typedef color_t (*BlendFunc)(color_t backdrop, color_t src, int opacity); |
18 | |
19 | color_t rgba_blender_src(color_t backdrop, color_t src, int opacity); |
20 | color_t rgba_blender_merge(color_t backdrop, color_t src, int opacity); |
21 | color_t rgba_blender_neg_bw(color_t backdrop, color_t src, int opacity); |
22 | color_t rgba_blender_red_tint(color_t backdrop, color_t src, int opacity); |
23 | color_t rgba_blender_blue_tint(color_t backdrop, color_t src, int opacity); |
24 | color_t rgba_blender_normal(color_t backdrop, color_t src, int opacity = 255); |
25 | color_t rgba_blender_normal_dst_over(color_t backdrop, color_t src, int opacity); |
26 | color_t rgba_blender_multiply(color_t backdrop, color_t src, int opacity); |
27 | color_t rgba_blender_screen(color_t backdrop, color_t src, int opacity); |
28 | color_t rgba_blender_overlay(color_t backdrop, color_t src, int opacity); |
29 | color_t rgba_blender_darken(color_t backdrop, color_t src, int opacity); |
30 | color_t rgba_blender_lighten(color_t backdrop, color_t src, int opacity); |
31 | color_t rgba_blender_color_dodge(color_t backdrop, color_t src, int opacity); |
32 | color_t rgba_blender_color_burn(color_t backdrop, color_t src, int opacity); |
33 | color_t rgba_blender_hard_light(color_t backdrop, color_t src, int opacity); |
34 | color_t rgba_blender_soft_light(color_t backdrop, color_t src, int opacity); |
35 | color_t rgba_blender_difference(color_t backdrop, color_t src, int opacity); |
36 | color_t rgba_blender_exclusion(color_t backdrop, color_t src, int opacity); |
37 | color_t rgba_blender_hsl_hue(color_t backdrop, color_t src, int opacity); |
38 | color_t rgba_blender_hsl_saturation(color_t backdrop, color_t src, int opacity); |
39 | color_t rgba_blender_hsl_color(color_t backdrop, color_t src, int opacity); |
40 | color_t rgba_blender_hsl_luminosity(color_t backdrop, color_t src, int opacity); |
41 | color_t rgba_blender_addition(color_t backdrop, color_t src, int opacity); |
42 | color_t rgba_blender_subtract(color_t backdrop, color_t src, int opacity); |
43 | color_t rgba_blender_divide(color_t backdrop, color_t src, int opacity); |
44 | |
45 | color_t graya_blender_src(color_t backdrop, color_t src, int opacity); |
46 | color_t graya_blender_merge(color_t backdrop, color_t src, int opacity); |
47 | color_t graya_blender_neg_bw(color_t backdrop, color_t src, int opacity); |
48 | color_t graya_blender_normal(color_t backdrop, color_t src, int opacity = 255); |
49 | color_t graya_blender_normal_dst_over(color_t backdrop, color_t src, int opacity); |
50 | color_t graya_blender_multiply(color_t backdrop, color_t src, int opacity); |
51 | color_t graya_blender_screen(color_t backdrop, color_t src, int opacity); |
52 | color_t graya_blender_overlay(color_t backdrop, color_t src, int opacity); |
53 | color_t graya_blender_darken(color_t backdrop, color_t src, int opacity); |
54 | color_t graya_blender_lighten(color_t backdrop, color_t src, int opacity); |
55 | color_t graya_blender_color_dodge(color_t backdrop, color_t src, int opacity); |
56 | color_t graya_blender_color_burn(color_t backdrop, color_t src, int opacity); |
57 | color_t graya_blender_hard_light(color_t backdrop, color_t src, int opacity); |
58 | color_t graya_blender_soft_light(color_t backdrop, color_t src, int opacity); |
59 | color_t graya_blender_difference(color_t backdrop, color_t src, int opacity); |
60 | color_t graya_blender_exclusion(color_t backdrop, color_t src, int opacity); |
61 | color_t graya_blender_addition(color_t backdrop, color_t src, int opacity); |
62 | color_t graya_blender_subtract(color_t backdrop, color_t src, int opacity); |
63 | color_t graya_blender_divide(color_t backdrop, color_t src, int opacity); |
64 | |
65 | color_t indexed_blender_src(color_t dst, color_t src, int opacity); |
66 | |
67 | BlendFunc get_rgba_blender(BlendMode blendmode, const bool newBlend); |
68 | BlendFunc get_graya_blender(BlendMode blendmode, const bool newBlend); |
69 | BlendFunc get_indexed_blender(BlendMode blendmode, const bool newBlend); |
70 | |
71 | } // namespace doc |
72 | |
73 | #endif |
74 | |