Recent

Author Topic: [lamw] How to use JPaintShader with JDrawingView or JCanvas?  (Read 96 times)

dan57

  • Newbie
  • Posts: 4
[lamw] How to use JPaintShader with JDrawingView or JCanvas?
« on: November 09, 2022, 05:01:21 pm »
Hello,
I'm experimenting with the component JPaintShader, it should work with JDrawingView and JCanvas but I can't find any documentation or demos.

The ability to use JCanvas graphics functions and use color gradient fills is very interesting but I can't activate it.

1) I put in the project a JDrawingView or JCanvas and a JPaintShader.
2) in the respective property of JDrawingView I insert JPaintShader
3) in JPaintShader I create a shader with NewLinearGradient
4) in the code before starting the drawing I call JDrawingView.InitPaintShader
5) when I call one one the DrawRect funtions of JDrawingView I always see a solid color rectangle, the shader is always ignored
6) the same with jCanvas

I see that there is a ShadersCount property in the jPaintShader. So I suppose that it is possible in this component to create multiple shaders and call them as needed but how? There is nothing in jDrawingView to indicate to use one or another shader present in jPaintShader

Can somebody point me in the right direction?

Thanks.

 

TinyPortal © 2005-2018