3#include "sdl_painter/color.h"
4#include "sdl_painter/geometry.h"
11enum class BrushType : uint8_t {
53 const Color& to)
noexcept {
55 b.mType = BrushType::kLinear;
71 const Color& to)
noexcept {
73 b.mType = BrushType::kRadial;
82 [[nodiscard]] BrushType
GetType() const noexcept {
return mType; }
86 return mType != BrushType::kSolid;
96 [[nodiscard]]
const Point&
GetEnd() const noexcept {
return mEnd; }
99 [[nodiscard]]
float GetRadius() const noexcept {
return mRadius; }
114 return mColor.a > 0 || (
IsGradient() && mColor2.a > 0);
117 [[nodiscard]]
bool operator==(
const Brush& other)
const noexcept {
118 if (mColor != other.mColor || mType != other.mType) {
121 if (mType == BrushType::kSolid) {
124 return mColor2 == other.mColor2 && mStart.x == other.mStart.x &&
125 mStart.y == other.mStart.y && mEnd.x == other.mEnd.x &&
126 mEnd.y == other.mEnd.y && mRadius == other.mRadius;
128 [[nodiscard]]
bool operator!=(
const Brush& other)
const noexcept {
129 return !(*
this == other);
134 return Brush(Color::Transparent());
138 Color mColor{Color::Black()};
139 Color mColor2{Color::White()};
143 BrushType mType{BrushType::kSolid};
Dolgu stili — düz renk veya gradient.
Definition brush.h:34
static Brush LinearGradient(const Point &start, const Point &end, const Color &from, const Color &to) noexcept
Doğrusal gradient fırça.
Definition brush.h:51
bool IsVisible() const noexcept
Fırça görünür mü? (alpha > 0)
Definition brush.h:113
const Point & GetEnd() const noexcept
Doğrusal gradientte bitiş noktası.
Definition brush.h:96
BrushType GetType() const noexcept
Fırçanın dolgu türü.
Definition brush.h:82
float GetRadius() const noexcept
Işınsal gradientte yarıçap.
Definition brush.h:99
static Brush RadialGradient(const Point ¢er, float radius, const Color &from, const Color &to) noexcept
Işınsal gradient fırça.
Definition brush.h:69
const Color & GetColor() const noexcept
Dolgu rengini döndür.
Definition brush.h:102
const Point & GetStart() const noexcept
Doğrusal gradientte başlangıç, ışınsalda merkez.
Definition brush.h:93
Brush()=default
Varsayılan fırça: siyah, tam opak.
bool IsGradient() const noexcept
Gradient mi? (düz renk değil)
Definition brush.h:85
void SetColor(const Color &color) noexcept
Dolgu rengini ayarla.
Definition brush.h:105
Brush(const Color &color)
Renk ile fırça oluştur.
Definition brush.h:40
const Color & GetColor2() const noexcept
Gradient bitiş rengi (düz fırçada anlamsız).
Definition brush.h:90
static Brush NoBrush() noexcept
Şeffaf (dolgu yapmayan) fırça.
Definition brush.h:133
RGBA renk temsili. Her kanal [0, 255] aralığında.
Definition color.h:8
2B nokta — float koordinatlar.
Definition geometry.h:8