slint
slint copied to clipboard
`source-clip-x`, `source-clip-width`, etc. don't seem to be doing anything.
As simple as that, I have tried specifying those values with the proper coordinates in the image space (dependent on the resolution i think?) but they do not seem to be doing anything at all.
Image {
image-fit: cover;
source: banner;
height: parent.height;
width: 400px;
source-clip-x: 200;
Image {
source: logo;
width: 200px;
}
}
In that snippet of code, the source-clip-x does nothing. The banner image is 1920x620 in resolution.
I can reproduce the bug with the Qt backend (but the GL backend works fine)
In fact, it only work if all of source-clip-x, cource-clip-y, source-clip-width and source-clip-height are specified. The GL backend also shows some artifacts if the 4 properties are not specified.
@tronical when source-clip-width is not specified, it is the same as source-clip-width: 0.
Currently, when the size of the clip is 0, the Qt backend disable the clipping, and the GL backend then use the size of the image (which is too big if one does not start at 0)
We could make it that source-clip-width of 0 means, in fact, source.width - source-clip-x. That would fix the issue, but it is strange that if i specify source-clip-width:0; then there is no more cut (IMHO the image should be empty in that case).
There is still the problem that if i specify source-clip-width to a huge number bigger than the image, it will show artifacts.
You're right, source-clip-width defaulting to source.width - source-clip-x makes sense.
I also agree that 0 as source-clip-width should make the image invisible. That requires the above default though.
And indeed, source-clip-width should be internally restricted to the range 0..source.width.
And I guess meanwhile @Kirottu can work around it by specifying all four properties?
Yes I did that and now it works, but probably should be more intuitive like how height/width are automatically scales when the other one is specified.
Another thing that would make sense is that the implicit width of Image is reduces to source-clip-width when specified.
Same for height and source-clip-height of course.
We should add a default binding from source-clip-width to source.width - source-clip-x makes
And since this take some memory, we should make sure that Colorized image is not impacted
I assume the default width and height should be based on the source-clip-width / source-clip-height