#include "blobinvertedrect2.hpp" #include "blobgroup2.hpp" #include BlobInvertedRect2::BlobInvertedRect2(QQuickItem* parent) : BlobShape2(parent) {} BlobInvertedRect2::~BlobInvertedRect2() { if (m_group) m_group->clearInvertedRect(this); } void BlobInvertedRect2::setBorderLeft(qreal v) { if (qFuzzyCompare(m_borderLeft, v)) return; m_borderLeft = v; emit borderLeftChanged(); if (m_group) m_group->markDirty(); } void BlobInvertedRect2::setBorderRight(qreal v) { if (qFuzzyCompare(m_borderRight, v)) return; m_borderRight = v; emit borderRightChanged(); if (m_group) m_group->markDirty(); } void BlobInvertedRect2::setBorderTop(qreal v) { if (qFuzzyCompare(m_borderTop, v)) return; m_borderTop = v; emit borderTopChanged(); if (m_group) m_group->markDirty(); } void BlobInvertedRect2::setBorderBottom(qreal v) { if (qFuzzyCompare(m_borderBottom, v)) return; m_borderBottom = v; emit borderBottomChanged(); if (m_group) m_group->markDirty(); } void BlobInvertedRect2::setOuterRadius(qreal v) { if (qFuzzyCompare(m_outerRadius, v)) return; m_outerRadius = v; emit outerRadiusChanged(); if (m_group) m_group->markDirty(); } void BlobInvertedRect2::setOuterTopLeftRadius(qreal v) { if (qFuzzyCompare(m_outerTopLeftRadius, v)) return; m_outerTopLeftRadius = v; emit outerTopLeftRadiusChanged(); if (m_group) m_group->markDirty(); } void BlobInvertedRect2::setOuterTopRightRadius(qreal v) { if (qFuzzyCompare(m_outerTopRightRadius, v)) return; m_outerTopRightRadius = v; emit outerTopRightRadiusChanged(); if (m_group) m_group->markDirty(); } void BlobInvertedRect2::setOuterBottomLeftRadius(qreal v) { if (qFuzzyCompare(m_outerBottomLeftRadius, v)) return; m_outerBottomLeftRadius = v; emit outerBottomLeftRadiusChanged(); if (m_group) m_group->markDirty(); } void BlobInvertedRect2::setOuterBottomRightRadius(qreal v) { if (qFuzzyCompare(m_outerBottomRightRadius, v)) return; m_outerBottomRightRadius = v; emit outerBottomRightRadiusChanged(); if (m_group) m_group->markDirty(); } void BlobInvertedRect2::outerCornerRadii(float out[4]) const { const auto maxR = static_cast(std::min(width(), height())) * 0.5f; const auto base = std::min(static_cast(m_outerRadius), maxR); out[0] = std::min( m_outerTopRightRadius >= 0 ? static_cast(m_outerTopRightRadius) : base, maxR); out[1] = std::min( m_outerBottomRightRadius >= 0 ? static_cast(m_outerBottomRightRadius) : base, maxR); out[2] = std::min( m_outerBottomLeftRadius >= 0 ? static_cast(m_outerBottomLeftRadius) : base, maxR); out[3] = std::min( m_outerTopLeftRadius >= 0 ? static_cast(m_outerTopLeftRadius) : base, maxR); } void BlobInvertedRect2::registerWithGroup() { if (m_group) m_group->setInvertedRect(this); } void BlobInvertedRect2::unregisterFromGroup() { if (m_group) m_group->clearInvertedRect(this); }