Stride to skia transform

hellllo,

I’ve just created this little operation to align skia and stride transformation. it just inverts the y-axis transform.

Two questions emerged from there:

  1. Is there anything wrong with that approach that i’m not aware of? (i have just a simple 2d usecase here)
  2. Can such a thing be built into SkiaRenderer somehow?

Interesting discussion you’re kicking off here… I tried this also once, and remember that Text was the best use case to try this, because simply inverting the y translation did not do the trick. Can not test right now, but I think also scale and rotation were inverted.

the patch above should only invert the y translation and the rest stays the same. it’s working for text - at least in my usecase here.

But does it behave exactly the same when using the same transformation for a Text Layer in a Skia Renderer and a QuadRenderer rendering text using a SkiaTexture in a Stride RenderWindow?

yes, i think so, but am not 100% sure. i’m rendering things in a skiarenderer besides some e.g. quadrendeers and they align.

i’m not sure, because it looks too simple and someone must have tried smth. like that before.

skiatransform.vl (33.4 KB)
little playground

1 Like

When changing from a Circle to a Rectangle, it seems like the rotation is still inverted in your example.

but that is also the case when the ToSkia op isn’t in place. no idea why the rotation is in the other direction

here’s a fix for the rotation


skiatransform.vl (37.0 KB)

1 Like

Well… pretty acurate, no? Would be cool to have a boolean on a Renderer, SkiaRenderer or SkiaTexture with which one could switch to Stride transformation if needed.

1 Like

Thought about adding this to VL.Addons but stumbled upon the naming. Since it is in Skia.Transform shouldn’t it rather be FromStride?

3 Likes

I prefer having both in the name, it ends all guessing and it doesn’t matter where it’s defined.

1 Like

So FromStrideToSkia or ToSkiaFromStride?

Or just StrideToSkia

2 Likes