From 3762a6b87bc869f4c5139963c6c995daee84ca0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sat, 27 Apr 2024 00:59:04 -0300 Subject: [PATCH] Visual improvements. --- bin/assets/ui/breeze.css | 14 +++++++------- docs/articles/cssspecification.md | 4 ++-- src/eepp/ui/css/drawableimageparser.cpp | 12 ++++++++++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/bin/assets/ui/breeze.css b/bin/assets/ui/breeze.css index 2b51be6d8..88b2922fe 100644 --- a/bin/assets/ui/breeze.css +++ b/bin/assets/ui/breeze.css @@ -644,14 +644,14 @@ Window::maximize { height: 12dp; border-radius: 6dp; background-color: transparent; - foreground-image: poly(line, var(--win-icon), "0dp 4dp, 4dp 0dp"), poly(line, var(--win-icon), "4dp 0dp, 8dp 4dp"); + foreground-image: poly(line, var(--win-icon), "0dp 4dp, 4dp 0dp", 1dp), poly(line, var(--win-icon), "4dp 0dp, 8dp 4dp", 1dp); foreground-position: 2dp 4dp, 2dp 4dp; transition: all 0.15s; } Window::maximize:hover { background-color: var(--icon-back-hover); - foreground-image: poly(line, var(--icon-line-hover), "0dp 4dp, 4dp 0dp"), poly(line, var(--icon-line-hover), "4dp 0dp, 8dp 4dp"); + foreground-image: poly(line, var(--icon-line-hover), "0dp 4dp, 4dp 0dp", 1dp), poly(line, var(--icon-line-hover), "4dp 0dp, 8dp 4dp", 1dp); } Window::minimize { @@ -659,14 +659,14 @@ Window::minimize { height: 12dp; border-radius: 6dp; background-color: transparent; - foreground-image: poly(line, var(--win-icon), "0dp 0dp, 4dp 4dp"), poly(line, var(--win-icon), "4dp 4dp, 8dp 0dp"); + foreground-image: poly(line, var(--win-icon), "0dp 0dp, 4dp 4dp", 1dp), poly(line, var(--win-icon), "4dp 4dp, 8dp 0dp", 1dp); foreground-position: 2dp 4dp, 2dp 4dp; transition: all 0.15s; } Window::minimize:hover { background-color: var(--icon-back-hover); - foreground-image: poly(line, var(--icon-line-hover), "0dp 0dp, 4dp 4dp"), poly(line, var(--icon-line-hover), "4dp 4dp, 8dp 0dp"); + foreground-image: poly(line, var(--icon-line-hover), "0dp 0dp, 4dp 4dp", 1dp), poly(line, var(--icon-line-hover), "4dp 4dp, 8dp 0dp", 1dp); } Window { @@ -833,7 +833,7 @@ Menu::SubMenu::Arrow { width: 16dp; height: 16dp; margin-right: 1dp; - foreground-image: poly(line, var(--icon), "5dp 3dp, 10dp 8dp"), poly(line, var(--icon), "5dp 13dp, 10dp 8dp"); + foreground-image: poly(line, var(--icon), "5dp 3dp, 10dp 8dp", 1dp), poly(line, var(--icon), "5dp 13dp, 10dp 8dp", 1dp); } Menu::Item::icon, @@ -997,7 +997,7 @@ treeview::header::column::arrow-up, listview::header::column::arrow-up { width: 16dp; height: 12dp; - foreground-image: poly(line, var(--icon), "1dp 4dp, 5dp 7dp"), poly(line, var(--icon), "5dp 7dp, 9dp 4dp"); + foreground-image: poly(line, var(--icon), "1dp 4dp, 5dp 7dp", 1dp), poly(line, var(--icon), "5dp 7dp, 9dp 4dp", 1dp); } tableview::header::column::arrow-down, @@ -1005,7 +1005,7 @@ treeview::header::column::arrow-down, listview::header::column::arrow-down { width: 16dp; height: 12dp; - foreground-image: poly(line, var(--icon), "1dp 7dp, 5dp 4dp"), poly(line, var(--icon), "5dp 4dp, 9dp 7dp"); + foreground-image: poly(line, var(--icon), "1dp 7dp, 5dp 4dp", 1dp), poly(line, var(--icon), "5dp 4dp, 9dp 7dp", 1dp); } ScrollBarMini { diff --git a/docs/articles/cssspecification.md b/docs/articles/cssspecification.md index c6a7c9c17..7761b05ce 100644 --- a/docs/articles/cssspecification.md +++ b/docs/articles/cssspecification.md @@ -2582,8 +2582,8 @@ linear-gradient(from_color, to_color); linear-gradient(direction, from_color, to_color); /** valid directions are (without quotes): "to bottom", "to left", "to right", "to top". */ circle(radius, color, type); /** type (optional) can be (without quotes): "fill" or "solid" (filled), or "line" (lined). */ rectangle(type, color, rotation, radius); /** type (optional) can be (without quotes): "fill" or "solid" (filled), or "line" (lined). rotation (optional) is a number in degress: "0ยบ" (without quotes). radius (optional), must be the last parameter. */ -triangle(type, color, "point_1.x point1.y, point_2.x point2.y, point_3.x point3.y") /** type can be (without quotes): "fill" or "solid" (filled), or "line" (lined). */ -poly(type, color, "point_1.x point1.y, point_2.x point2.y, ...", lineWidth) /** polygon. type (optional) can be (without quotes): "fill" or "solid" (filled), or "line" (lined). */ +triangle(type, color, "point_1.x point1.y, point_2.x point2.y, point_3.x point3.y", lineWidth) /** type can be (without quotes): "fill" or "solid" (filled), or "line" (lined). lineWidth (optional, default 1dp): the length or width of the lines when type is "fill"- */ +poly(type, color, "point_1.x point1.y, point_2.x point2.y, ...", lineWidth) /** polygon. type (optional) can be (without quotes): "fill" or "solid" (filled), or "line" (lined). lineWidth (optional, default 1dp): the length or width of the lines when type is "fill"- */ icon(name, size) /** icons usually come from font glyphs, size is the font glyph size. For example: icon("quit", 24dp) */ glyph(font_family, font_size, codepoint) /** codepoint can be an integer value, an hex value (hex values start with 0x), or a 1 codepoint string representing glyph character. For example: glyph("monospace", 24dp, "@") */ ``` diff --git a/src/eepp/ui/css/drawableimageparser.cpp b/src/eepp/ui/css/drawableimageparser.cpp index aa4f37898..7422c7328 100644 --- a/src/eepp/ui/css/drawableimageparser.cpp +++ b/src/eepp/ui/css/drawableimageparser.cpp @@ -208,6 +208,7 @@ void DrawableImageParser::registerBaseParsers() { std::vector vertices; const std::vector& params( functionType.getParameters() ); + Float lineWidth = PixelDensity::dpToPx( 1.f ); for ( size_t i = 0; i < params.size(); i++ ) { std::string param( String::toLower( params[i] ) ); @@ -218,6 +219,9 @@ void DrawableImageParser::registerBaseParsers() { drawable->setFillMode( DRAW_LINE ); } else if ( Color::isColorString( param ) ) { colors.push_back( Color::fromString( param ) ); + } else if ( !functionType.parameterWasString( i ) && + StyleSheetLength::isLength( param ) ) { + lineWidth = node->convertLength( StyleSheetLength( param ), size.getWidth() ); } else { std::vector vertex( String::split( param, ',' ) ); @@ -239,6 +243,8 @@ void DrawableImageParser::registerBaseParsers() { } if ( vertices.size() == 3 && !colors.empty() ) { + drawable->setLineWidth( lineWidth ); + Triangle2f triangle; for ( size_t i = 0; i < 3; i++ ) { @@ -272,6 +278,7 @@ void DrawableImageParser::registerBaseParsers() { std::vector vertices; const std::vector& params( functionType.getParameters() ); + Float lineWidth = PixelDensity::dpToPx( 1.f ); for ( size_t i = 0; i < params.size(); i++ ) { std::string param( String::toLower( params[i] ) ); @@ -284,8 +291,7 @@ void DrawableImageParser::registerBaseParsers() { colors.push_back( Color::fromString( param ) ); } else if ( !functionType.parameterWasString( i ) && StyleSheetLength::isLength( param ) ) { - drawable->setLineWidth( - node->convertLength( StyleSheetLength( param ), size.getWidth() ) ); + lineWidth = node->convertLength( StyleSheetLength( param ), size.getWidth() ); } else { std::vector vertex( String::split( param, ',' ) ); @@ -305,6 +311,8 @@ void DrawableImageParser::registerBaseParsers() { } if ( vertices.size() >= 2 && !colors.empty() ) { + drawable->setLineWidth( lineWidth ); + for ( size_t i = 0; i < vertices.size(); i++ ) { drawable->addPoint( vertices[i], colors[i % colors.size()] ); }