mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-12-22 05:19:48 +01:00
widgets: render frambuffers with alpha 1.0 (#554)
* helpers: update CColor yoinked from Hyprland * image: fix border alpha * shape: fix border alpha
This commit is contained in:
parent
c3c28feb4c
commit
2775ab2868
4 changed files with 7 additions and 6 deletions
|
@ -21,6 +21,6 @@ CColor::CColor(uint64_t hex) {
|
|||
this->a = ALPHA(hex);
|
||||
}
|
||||
|
||||
uint64_t CColor::getAsHex() {
|
||||
return ((int)a) * 0x1000000 + ((int)r) * 0x10000 + ((int)g) * 0x100 + ((int)b) * 0x1;
|
||||
uint32_t CColor::getAsHex() const {
|
||||
return (uint32_t)(a * 255.f) * 0x1000000 + (uint32_t)(r * 255.f) * 0x10000 + (uint32_t)(g * 255.f) * 0x100 + (uint32_t)(b * 255.f) * 0x1;
|
||||
}
|
|
@ -10,7 +10,8 @@ class CColor {
|
|||
|
||||
float r = 0, g = 0, b = 0, a = 1.f;
|
||||
|
||||
uint64_t getAsHex();
|
||||
// AR32
|
||||
uint32_t getAsHex() const;
|
||||
|
||||
CColor operator-(const CColor& c2) const {
|
||||
return CColor(r - c2.r, g - c2.g, b - c2.b, a - c2.a);
|
||||
|
|
|
@ -157,7 +157,7 @@ bool CImage::draw(const SRenderData& data) {
|
|||
|
||||
if (border > 0)
|
||||
g_pRenderer->renderBorder(borderBox, color, border, ALLOWROUND ? (rounding == 0 ? 0 : rounding + std::round(border / M_PI)) : std::min(borderBox.w, borderBox.h) / 2.0,
|
||||
data.opacity);
|
||||
1.0);
|
||||
|
||||
texbox.round();
|
||||
g_pRenderer->renderTexture(texbox, asset->texture, 1.0, ALLOWROUND ? rounding : std::min(texbox.w, texbox.h) / 2.0, HYPRUTILS_TRANSFORM_NORMAL);
|
||||
|
|
|
@ -77,7 +77,7 @@ bool CShape::draw(const SRenderData& data) {
|
|||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
if (border > 0)
|
||||
g_pRenderer->renderBorder(borderBox, borderGrad, border, ALLOWROUND ? (rounding == 0 ? 0 : rounding + std::round(border / M_PI)) : MINHALFBORDER, data.opacity);
|
||||
g_pRenderer->renderBorder(borderBox, borderGrad, border, ALLOWROUND ? (rounding == 0 ? 0 : rounding + std::round(border / M_PI)) : MINHALFBORDER, 1.0);
|
||||
|
||||
g_pRenderer->renderRect(shapeBox, color, ALLOWROUND ? rounding : MINHALFSHAPE);
|
||||
g_pRenderer->popFb();
|
||||
|
|
Loading…
Reference in a new issue