3#include "sdl_painter/color.h"
4#include "sdl_painter/geometry.h"
12enum class BrushType : uint8_t {
55 const Color& to)
noexcept {
57 b.mType = BrushType::kLinear;
73 const Color& to)
noexcept {
75 b.mType = BrushType::kRadial;
84 [[nodiscard]] BrushType
GetType() const noexcept {
return mType; }
88 return mType != BrushType::kSolid;
98 [[nodiscard]]
const Point&
GetEnd() const noexcept {
return mEnd; }
101 [[nodiscard]]
float GetRadius() const noexcept {
return mRadius; }
116 return mColor.a > 0 || (
IsGradient() && mColor2.a > 0);
119 [[nodiscard]]
bool operator==(
const Brush& other)
const noexcept {
120 if (mColor != other.mColor || mType != other.mType) {
123 if (mType == BrushType::kSolid) {
126 return mColor2 == other.mColor2 && mStart.x == other.mStart.x &&
127 mStart.y == other.mStart.y && mEnd.x == other.mEnd.x &&
128 mEnd.y == other.mEnd.y && mRadius == other.mRadius;
130 [[nodiscard]]
bool operator!=(
const Brush& other)
const noexcept {
131 return !(*
this == other);
136 return Brush(Color::Transparent());
141 Color mColor2{Color::White()};
145 BrushType mType{BrushType::kSolid};
Dolgu stili — düz renk veya gradient.
Definition brush.h:36
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:53
bool IsVisible() const noexcept
Fırça görünür mü? (alpha > 0).
Definition brush.h:115
const Point & GetEnd() const noexcept
Doğrusal gradientte bitiş noktası.
Definition brush.h:98
BrushType GetType() const noexcept
Fırçanın dolgu türü.
Definition brush.h:84
float GetRadius() const noexcept
Işınsal gradientte yarıçap.
Definition brush.h:101
static Brush RadialGradient(const Point ¢er, float radius, const Color &from, const Color &to) noexcept
Işınsal gradient fırça.
Definition brush.h:71
const Color & GetColor() const noexcept
Dolgu rengini döndür.
Definition brush.h:104
const Point & GetStart() const noexcept
Doğrusal gradientte başlangıç, ışınsalda merkez.
Definition brush.h:95
Brush()=default
Varsayılan fırça: siyah, tam opak.
bool IsGradient() const noexcept
Gradient mi? (düz renk değil).
Definition brush.h:87
void SetColor(const Color &color) noexcept
Dolgu rengini ayarla.
Definition brush.h:107
Brush(const Color &color)
Renk ile fırça oluştur.
Definition brush.h:42
const Color & GetColor2() const noexcept
Gradient bitiş rengi (düz fırçada anlamsız).
Definition brush.h:92
static Brush NoBrush() noexcept
Şeffaf (dolgu yapmayan) fırça.
Definition brush.h:135
RGBA renk temsili. Her kanal [0, 255] aralığında.
Definition color.h:8
static constexpr Color Black() noexcept
Definition color.h:44
2B nokta — float koordinatlar.
Definition geometry.h:8