名称优化

This commit is contained in:
2026-08-02 03:43:39 +08:00
parent d8e023cea7
commit 3d027967b9
109 changed files with 1699 additions and 3979 deletions
+3 -3
View File
@@ -18,11 +18,11 @@ std::uint8_t byte_from_normalized(double value) {
} // namespace
BLRgba Convert::to_bl(const Color& color) {
return BLRgba(normalized(color.red), normalized(color.green), normalized(color.blue), normalized(color.alpha));
return BLRgba(normalized(color.r), normalized(color.g), normalized(color.b), normalized(color.a));
}
BLRgba Convert::to_bl_premultiplied(const Color& color) {
auto alpha = normalized(color.alpha);
return BLRgba(normalized(color.red) * alpha, normalized(color.green) * alpha, normalized(color.blue) * alpha, alpha);
auto alpha = normalized(color.a);
return BLRgba(normalized(color.r) * alpha, normalized(color.g) * alpha, normalized(color.b) * alpha, alpha);
}
BLPoint Convert::to_bl(const PointF& point) {
return BLPoint(point.x, point.y);
+2 -2
View File
@@ -250,11 +250,11 @@ void Canvas::draw_text(const RectF& rect, Text_Align align, std::string_view tex
auto metrics = measure_text(text);
double x = rect.x;
double y = rect.y;
if ((align & Text_Align::HCenter) == Text_Align::HCenter)
if ((align & Text_Align::Horizontal_Center) == Text_Align::Horizontal_Center)
x += (rect.width - metrics.width) / 2.0;
else if ((align & Text_Align::Right) == Text_Align::Right)
x += rect.width - metrics.width;
if ((align & Text_Align::VCenter) == Text_Align::VCenter)
if ((align & Text_Align::Vertical_Center) == Text_Align::Vertical_Center)
y += (rect.height - metrics.height) / 2.0;
else if ((align & Text_Align::Bottom) == Text_Align::Bottom)
y += rect.height - metrics.height;
+1 -1
View File
@@ -45,7 +45,7 @@ bool Image::empty() const {
return impl_->image.is_empty();
}
std::size_t Image::size_bytes() const {
std::size_t Image::byte_size() const {
BLImageData d;
if (impl_->image.get_data(&d) != BL_SUCCESS)
return 0;
+1 -1
View File
@@ -19,7 +19,7 @@ public:
[[nodiscard]] int height() const;
[[nodiscard]] Size size() const;
[[nodiscard]] bool empty() const;
[[nodiscard]] std::size_t size_bytes() const;
[[nodiscard]] std::size_t byte_size() const;
void clear();
void resize(int width, int height);
void fill(Color color);