2017-01-18 23:38:42 -05:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-25 17:30:41 -05:00
|
|
|
#include <cairo/cairo-ft.h>
|
2023-05-10 06:30:32 -04:00
|
|
|
|
2017-01-18 23:38:42 -05:00
|
|
|
#include "common.hpp"
|
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
namespace cairo {
|
2023-05-10 06:30:32 -04:00
|
|
|
namespace utils {
|
|
|
|
/**
|
|
|
|
* @brief RAII wrapper used acquire cairo_device_t
|
|
|
|
*/
|
|
|
|
class device_lock {
|
|
|
|
public:
|
|
|
|
explicit device_lock(cairo_device_t* device);
|
|
|
|
~device_lock();
|
|
|
|
operator bool() const;
|
|
|
|
operator cairo_device_t*() const;
|
2017-01-24 00:59:58 -05:00
|
|
|
|
2023-05-10 06:30:32 -04:00
|
|
|
private:
|
|
|
|
cairo_device_t* m_device{nullptr};
|
|
|
|
};
|
2017-01-24 00:59:58 -05:00
|
|
|
|
2023-05-10 06:30:32 -04:00
|
|
|
/**
|
|
|
|
* @brief RAII wrapper used to access the underlying
|
|
|
|
* FT_Face of a scaled font face
|
|
|
|
*/
|
|
|
|
class ft_face_lock {
|
|
|
|
public:
|
|
|
|
explicit ft_face_lock(cairo_scaled_font_t* font);
|
|
|
|
~ft_face_lock();
|
|
|
|
operator FT_Face() const;
|
2017-01-24 00:59:58 -05:00
|
|
|
|
2023-05-10 06:30:32 -04:00
|
|
|
private:
|
|
|
|
cairo_scaled_font_t* m_font;
|
|
|
|
FT_Face m_face;
|
|
|
|
};
|
2017-01-24 00:59:58 -05:00
|
|
|
|
2023-05-10 06:30:32 -04:00
|
|
|
/**
|
|
|
|
* @see <cairo/cairo.h>
|
|
|
|
*/
|
|
|
|
cairo_operator_t str2operator(const string& mode, cairo_operator_t fallback);
|
|
|
|
} // namespace utils
|
|
|
|
} // namespace cairo
|
2017-01-18 23:38:42 -05:00
|
|
|
|
|
|
|
POLYBAR_NS_END
|