Phase 11b: серые рамки 2px вокруг каждой cell

User: "ячейки не имеют границ, сделай их серым цветом". В Layout::apply()
для каждого Cell (CameraCell/BlankCell/WidgetCell) добавлен BorderDecoration:
  - thickness 2px
  - Y=180, U=128, V=128 (нейтральный серый в BT.709 limited)
  - alpha 220 (слегка полупрозрачный — видно контент за рамкой)

Decoration рисуется поверх content (после draw_content) — поверх любого
кадра/widget'а.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 09:30:11 +01:00
parent 858fe61b56
commit e8392dd5ff
+14 -1
View File
@@ -2,6 +2,7 @@
#include "../../include/cuframes_composer/cpp/layout.hpp"
#include "../../include/cuframes_composer/cpp/blank_cell.hpp"
#include "../../include/cuframes_composer/cpp/border_decoration.hpp"
#include "../../include/cuframes_composer/cpp/camera_cell.hpp"
#include "../../include/cuframes_composer/cpp/label_decoration.hpp"
#include "../../include/cuframes_composer/cpp/widget_cell.hpp"
@@ -32,11 +33,20 @@ void Layout::apply(const LayoutTemplate& tpl,
return a->order < b->order;
});
/* Серая рамка по умолчанию — отделяет ячейки друг от друга. */
BorderStyle border_style;
border_style.thickness = 2;
border_style.color_y = 180;
border_style.color_u = 128;
border_style.color_v = 128;
border_style.alpha = 220;
/* CameraCells */
for (std::size_t i = 0; i < camera_templates.size(); ++i) {
Rect r = to_pixels(*camera_templates[i], frame_w, frame_h);
if (i < active_sorted.size() && active_sorted[i] && active_sorted[i]->source) {
auto cell = std::make_unique<CameraCell>(r, active_sorted[i]->source);
cell->add_decoration(std::make_unique<BorderDecoration>(border_style));
/* Label с именем камеры и приоритетом. */
char label_buf[96];
std::snprintf(label_buf, sizeof(label_buf), "%s prio=%d",
@@ -46,7 +56,9 @@ void Layout::apply(const LayoutTemplate& tpl,
cells_.push_back(std::move(cell));
} else {
/* Нет active под этот слот → blank. */
cells_.push_back(std::make_unique<BlankCell>(r));
auto cell = std::make_unique<BlankCell>(r);
cell->add_decoration(std::make_unique<BorderDecoration>(border_style));
cells_.push_back(std::move(cell));
}
}
@@ -54,6 +66,7 @@ void Layout::apply(const LayoutTemplate& tpl,
for (auto* wt : widget_templates) {
Rect r = to_pixels(*wt, frame_w, frame_h);
auto cell = std::make_unique<WidgetCell>(r, wt->widget);
cell->add_decoration(std::make_unique<BorderDecoration>(border_style));
if (!wt->widget.empty()) {
cell->add_decoration(std::make_unique<LabelDecoration>(wt->widget, LabelStyle{}));
}