Krita Source Code Documentation
Loading...
Searching...
No Matches
MyPaintSurface.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Ashwin Dhakaita <ashwingpdhakaita@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KIS_MYPAINT_SURFACE_H
8#define KIS_MYPAINT_SURFACE_H
9
10#include <QObject>
11
12#include <kis_paint_device.h>
14#include <kis_painter.h>
16#include <kis_lod_transform.h>
17#include <KoColor.h>
18#include <kis_marker_painter.h>
21
22#include <libmypaint/mypaint-brush.h>
23#include <libmypaint/mypaint-surface.h>
24
26{
27public:
28
33
34public:
35 KisMyPaintSurface(KisPainter* painter, KisPaintDeviceSP paintNode=nullptr, KisImageSP image = nullptr);
37
43 static int draw_dab(MyPaintSurface *self, float x, float y, float radius,
44 float color_r, float color_g, float color_b, float opaque, float hardness,
45 float color_a, float aspect_ratio, float angle, float lock_alpha,
46 float colorize);
47
48 static void get_color(MyPaintSurface *self, float x, float y, float radius,
49 float * color_r, float * color_g, float * color_b, float * color_a);
50
51 template <typename channelType>
52 int drawDabImpl(MyPaintSurface *self, float x, float y, float radius, float color_r, float color_g,
53 float color_b, float opaque, float hardness, float color_a,
54 float aspect_ratio, float angle, float lock_alpha, float colorize);
55
56 template <typename channelType>
57 void getColorImpl(MyPaintSurface *self, float x, float y, float radius,
58 float * color_r, float * color_g, float * color_b, float * color_a);
59
60 inline float
61 calculate_rr_antialiased (int xp, int yp, float x, float y, float aspect_ratio,
62 float sn, float cs, float one_over_radius2, float r_aa_start);
63
64 inline float
65 calculate_alpha_for_rr (float rr, float hardness, float slope1, float slope2);
66
67 inline float
68 calculate_rr (int xp, int yp, float x, float y, float aspect_ratio,
69 float sn, float cs, float one_over_radius2);
70
71
73 void paint(KoColor *color, KoColor* bgColor);
74 qreal calculateOpacity(float angle, float hardness, float opaque, float x, float y,
75 float xp, float yp, float aspect_ratio, float radius);
76
77 MyPaintSurface* surface();
78
79private:
86 QScopedPointer<KisPainter> m_tempPainter;
87 QScopedPointer<KisPainter> m_backgroundPainter;
90
91};
92
93#endif // KIS_MYPAINT_SURFACE_H
KisPaintDeviceSP m_imageDevice
float calculate_alpha_for_rr(float rr, float hardness, float slope1, float slope2)
float calculate_rr_antialiased(int xp, int yp, float x, float y, float aspect_ratio, float sn, float cs, float one_over_radius2, float r_aa_start)
qreal calculateOpacity(float angle, float hardness, float opaque, float x, float y, float xp, float yp, float aspect_ratio, float radius)
MyPaintSurface * surface()
void getColorImpl(MyPaintSurface *self, float x, float y, float radius, float *color_r, float *color_g, float *color_b, float *color_a)
static void get_color(MyPaintSurface *self, float x, float y, float radius, float *color_r, float *color_g, float *color_b, float *color_a)
KisPainter * m_painter
KisOverlayPaintDeviceWrapper m_precisePainterWrapper
KisFixedPaintDeviceSP m_maskDevice
KisPainter * painter()
KisFixedPaintDeviceSP m_blendDevice
QScopedPointer< KisPainter > m_tempPainter
QScopedPointer< KisPainter > m_backgroundPainter
static int draw_dab(MyPaintSurface *self, float x, float y, float radius, float color_r, float color_g, float color_b, float opaque, float hardness, float color_a, float aspect_ratio, float angle, float lock_alpha, float colorize)
KisPaintDeviceSP m_dab
KisMyPaintSurface(KisPainter *painter, KisPaintDeviceSP paintNode=nullptr, KisImageSP image=nullptr)
float calculate_rr(int xp, int yp, float x, float y, float aspect_ratio, float sn, float cs, float one_over_radius2)
MyPaintSurfaceInternal * m_surface
void paint(KoColor *color, KoColor *bgColor)
int drawDabImpl(MyPaintSurface *self, float x, float y, float radius, float color_r, float color_g, float color_b, float opaque, float hardness, float color_a, float aspect_ratio, float angle, float lock_alpha, float colorize)
enumChannelValueType
enum to define the value of the channel
KoChannelInfo::enumChannelValueType bitDepth