fix input highlight. render multiline text. remove default theme singleton. scrollable area texture alignment.
42 lines
1.5 KiB
C++
42 lines
1.5 KiB
C++
#ifndef BWIDGETS_DRAW_HPP
|
||
#define BWIDGETS_DRAW_HPP
|
||
|
||
#include <functional>
|
||
#include <memory>
|
||
#include <string>
|
||
#include <vector>
|
||
|
||
struct SDL_PixelFormat;
|
||
struct SDL_Point;
|
||
struct SDL_Rect;
|
||
|
||
namespace bwidgets
|
||
{
|
||
class Color;
|
||
class Font;
|
||
class Renderer;
|
||
class Texture;
|
||
|
||
// Add transparency to color base_color relative to the distance d from
|
||
// a limit to produce an AntiAliasing effect.
|
||
// d >= 0 → full transparency;
|
||
// −(aa_pixels) <= d < 0 → smoothsteped transparency gradient;
|
||
// d < −(aa_pixels) → fully opaque.
|
||
[[nodiscard]] auto aa(Color base_color, int aa_pixels, float d) noexcept -> Color;
|
||
void fill_rect_gradient(Renderer&, const SDL_Rect& r, Color start, Color end,
|
||
int steps = 4);
|
||
// Render a filled circle texture of color c and diameter resolution with
|
||
// aa_pixels used for antialiasing.
|
||
[[nodiscard]] auto filled_circle(Color c, int resolution, const Renderer&,
|
||
int aa_pixels = 3) -> std::shared_ptr<Texture>;
|
||
[[nodiscard]] auto render_text(const std::vector<std::string>&, const Color&, Font&,
|
||
const Renderer&) -> std::shared_ptr<Texture>;
|
||
// Set the color of every pixels of a Texture using the passed function to compute
|
||
// pixel color.
|
||
void
|
||
set_pixels_color(Texture*,
|
||
const std::function<uint32_t(SDL_Point, const SDL_PixelFormat&)>&);
|
||
}
|
||
|
||
#endif
|