// // Skembo.cpp // screensaver // // Created by Bob Polis at 2020-10-26 // Copyright (c) 2020 SwiftCoder. All rights reserved. // #include "Skembo.hpp" #include class Skembo : public ScreensaverPlugin { public: Skembo() = default; ~Skembo() = default; void setup(cairo_t* context, const cairo_rectangle_t& rect) override; void draw_frame() override; int fps() const override; private: double _hue {0}; }; ScreensaverPlugin* create_instance() { return new Skembo; } void Skembo::setup(cairo_t* context, const cairo_rectangle_t& rect) { ScreensaverPlugin::setup(context, rect); make_black(); } int Skembo::fps() const { return 20; } void Skembo::draw_frame() { // std::uniform_real_distribution dist {}; HSB hsb; hsb.h = _hue; hsb.s = 1;//dist(_eng); hsb.b = 0.4;//dist(_eng); Color color {hsb}; RGB rgb {RGB(color)}; cairo_set_source_rgb(_c, rgb.r, rgb.g, rgb.b); cairo_rectangle(_c, _r.x, _r.y, _r.width, _r.height); cairo_fill(_c); _hue += 1.0; if (_hue > 360.0) { _hue = 0.0; } }