Bloc
Bloc copied to clipboard
Possible bug on border with linear gradient paint and outskirts centered or outside
Hello,
I was playing with the border and i discover strange behaviours with linear gradient on border. It is maybe not bugs.
Reproduction
In a playground do:
element := BlElement new
background: (BlLinearGradientPaint vertical
stops: {
(0.0 -> Color red muchDarker).
(1.0 -> Color green muchDarker) };
yourself) asBlBackground;
size: 300 asPoint;
position: 100 asPoint;
yourself.
element outskirts: BlOutskirts outside.
element border: (BlBorderBuilder new
paint: (BlLinearGradientPaint vertical
stops: {
(0.0 -> Color red).
(1.0 -> Color green) };
yourself);
width: 20;
build).
element openInSpace
I created an element with a BlLinearGradient as a background. I set the outskirt to outside. I added a BlLinearGradient as a paint for its border.
Bugs ?
Problem 1
When you add a border with a linear gradient, it does not adapt the value of the start and the end of the gradient like in the background. In the example,
- The border gradient start at
y=0px
and end aty=1px
. - The background gradient start at
y=0px
and end aty=300px
.
The problem 1 can be solved by setting manually the value start and end of the linear gradient to the width of the shape.
Should the value end
and start
of the border be automaticly calculated by Bloc to equals the size of the element ?
Problem 2
When the outskirt is centered or is outside, the origin of the border gradient is not on the top part of the border but on the origin of the element. In the example we can see a red line of 20 px on the top of the shape. If the gradient border start at the top of the border, we should only see a red line of 1 px on the top of the shape.
The problem 2 can be solved by setting manually the start of the gradient at y = 0 - width of the border
.
Should the y=0
of the linear gradient be on the most top part of the border, or should it be on the origin of the element ?
element := BlElement new
background: (BlLinearGradientPaint vertical
stops: {
(0.0 -> Color red muchDarker).
(1.0 -> Color green muchDarker) };
yourself) asBlBackground;
size: 300 asPoint;
position: 100 asPoint;
yourself.
element outskirts: BlOutskirts outside.
element border: (BlBorderBuilder new
paint: (BlLinearGradientPaint vertical
stops: {
(0.0 -> Color red).
(1.0 -> Color green) };
start: 0 @ -20;
end: 0 @ 1;
yourself);
width: 20;
build).
element openInSpace
other
Pharo 12.0.0 Build information: Pharo-12.0.0+SNAPSHOT.build.1510.sha.7efef560919a459de9e2fad384ee4614fdcb1691 (64 Bit)
Bloc (dev): 654832ce6f8ffeb60ebe553b00a77a661ca21017 24/05/11