How to draw image rotated on JavaFX Canvas?

后端 未结 4 897
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-06 20:21

I want to draw image on canvas rotated. with drawImage(image, 0, 0) I can draw image but how can I rotate that image for example 45 degrees and draw it, then dr

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 20:25

    I was running into similar problems with ImageViews, after rotating and scaling an image it was not sized correctly by the layout managers of parent containers.

    According to the ideas presented here I created an ImageCanvas that reflects the dimension of the rendered image whether it is rotated or scaled.

    See https://github.com/treimers/JfxImageCanvas

    Enjoy Thorsten

提交回复
热议问题