The jagged gradient is most apparent when the opacity is less than 100%. The attached image displays the problem.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
LinearGradientBrush horizontal vs. vertical
Collapse
X
-
LinearGradientBrush horizontal vs. vertical
Experimenting with SharpDX.Direct2D1.LinearGradientBrush, as described in this thread http://ninjatrader.com/support/forum...ad.php?t=83447 I find that horizontal gradients make smooth transitions, whereas vertical ones do not.
The jagged gradient is most apparent when the opacity is less than 100%. The attached image displays the problem. -
Hello,
Thank you for the image.
I would be interested to see how the drawing is being done in this case.
Is this one rectangle being colored or multiple rectangles in this image?
If there are multiple rectangles, this may be able to be explained. If there is a single rectangle in both cases, I would like to see the code to draw one rectangle in the same manor to test. If you could provide a sample that simply draws a single rectangle with the gradient you are using for the image I would be happy to take a look into this.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Originally posted by NinjaTrader_Jesse View PostIs this one rectangle being colored or multiple rectangles in this image?
If there are multiple rectangles, this may be able to be explained.
I experimented with a single rectangle instead of two and the gradient is smooth. The attached image shows this.
So, is there a problem using gradients with more than one rectangle to fill?
Comment
-
Hello,
Thank you for the reply.
This is interesting, I was kind of expecting either one rectangle or a few for each notable rectangular gradient in the image.
Based on what you are currently doing, I am not certain on the outcome and would need to see the syntax being used to know what may be happening.
If using one rectangle works, where two does not and you are sharing a gradient:
So, is there a problem using gradients with more than one rectangle to fill?
Otherwise if you can provide a sample that draws a single rectangle with the gradient you are using that does not work, I could look further into that as well.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
I tried eliminating one of the rectangles entirely. Then, I tried using two separate LinearGradientBrush objects, one for each rectangle. The resulting gradients look identical to what I've been seeing: the jaggedness begins to appear when I reduce opacity to 10%. Above that, the gradients appear smooth. Then, however, the problem becomes one of obscuring that which I'm also rendering. See the attached image, which has opacity set to 25%.
Notice how the opacity decreases from left to right. My guess is that, with TickReplay true (and it needs to be true for this indicator), the gradient gets redrawn on top of itself again and again.
Is there any way to overcome these obstacles?
- Perhaps to prevent redrawing existing gradients?
- Perhaps to force a specific z-order for RenderTarget drawing objects created in the overridden OnRender method?
Originally posted by NinjaTrader_Jesse View PostThere may be a problem re-using the same gradient, but again this is just a guess based on what you have provided. You could test this by using a completely separate new gradient for the second rectangle.
Comment
-
Hello,
At this point I would need to see the syntax being used to be able to provide anything further.
I am not seeing anything apparent with what you are describing, and without testing further I could not really say what may be happening.
If you could provide a sample that demonstrates drawing a single rectangle along with 1 gradient that shows this would be sufficient. I would not need to see any other logic in the current script so a new sample with only the drawing would be suggested.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostIf you could provide a sample that demonstrates drawing a single rectangle along with 1 gradient that shows this would be sufficient. I would not need to see any other logic in the current script so a new sample with only the drawing would be suggested.
Comment
-
Hello,
Thank you for supplying the sample, unfortunately I am unable to see the same outcome using this sample in any of the ways I have tested so far.
I have attached an image of the result I am getting but I am not seeing any distortion of the gradient. I had tried various data series and scales but have not seen the same. The image was from a chart
Are you only able to see this while utilizing this full indicator or can you also see this if you draw a gradient on a single rectangle and apply opacity? If you have not yet, I would suggest to reduce the code to only creating a single gradient and creating a single rectangle. If it can not be reproduced using a single occurrence, this may have something to do with the logic of the script. Otherwise if you are still able to see this using a single rectangle, I could test that and compare results. This would better tell us where the problem is and why I am unable to see this.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
I get the same jaggedness with either one or two rectangles. I'm attaching modified code that lets you select the number of rectangles. Within the zip file, I am also including a workspace with two charts as shown in the screenshot.
Near as I can tell, this problem surfaces when TickReplay is true, and both OnMarketData and OnRender are overridden. This is why I chose your VolumeProfile indicator, since it appears to the the only built-in that covers all the bases.
Originally posted by NinjaTrader_Jesse View PostAre you only able to see this while utilizing this full indicator or can you also see this if you draw a gradient on a single rectangle and apply opacity? If you have not yet, I would suggest to reduce the code to only creating a single gradient and creating a single rectangle. If it can not be reproduced using a single occurrence, this may have something to do with the logic of the script. Otherwise if you are still able to see this using a single rectangle, I could test that and compare results. This would better tell us where the problem is and why I am unable to see this.
Comment
-
Hello,
Thank you for providing this sample.
While I can not recreate what you are seeing by just running the script, I do actually see the effect while I resize the window and then it is back to normal when i release the mouse. Outside of resizing I do not see the same effect.
Based on seeing the effect happening during the resize. I will submit this to development for further review.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostWhile I can not recreate what you are seeing by just running the script, I do actually see the effect while I resize the window and then it is back to normal when i release the mouse. Outside of resizing I do not see the same effect. Based on seeing the effect happening during the resize. I will submit this to development for further review.
Comment
-
Hello,
Honestly I'm not too sure at this point as you said the result is different which is confusing. Because this deals with Rendering, it could be related to hardware /differences in graphics cards/versions of windows etc. Or it could be related to logic used/internal logic. I will need to explore this further to find a more specific cause of the blocky rendering on the gradient.
Once I have further details on this, I will post my findings back here.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostHonestly I'm not too sure at this point as you said the result is different which is confusing. Because this deals with Rendering, it could be related to hardware /differences in graphics cards/versions of windows etc. Or it could be related to logic used/internal logic. I will need to explore this further to find a more specific cause of the blocky rendering on the gradient.
Comment
-
Hello,
Thank you for the additional details.
After looking at the sample further, it seems this is related to the logic being used.
I had tried testing using a single rectangle with a gradient first and could not produce the effect.
Next I had tried a loop with multiple rectangles being offset and overlapped, I can still not see the effect.
Next using the loop and also adjusting the StartPoint and EndPoint locations I am able to see some results or blocky gradient while I resize the window.
I will need to continue looking into this to understand what specifically may be happening, but it does seem to be related to drawing multiple gradients over eachother and then adjusting the Start and End points seem to play a role in causing the effect.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
What operating system are you using? Win10? Win7?
Originally posted by NinjaTrader_Jesse View PostNext using the loop and also adjusting the StartPoint and EndPoint locations I am able to see some results or blocky gradient while I resize the window.
I will need to continue looking into this to understand what specifically may be happening, but it does seem to be related to drawing multiple gradients over each other and then adjusting the Start and End points seem to play a role in causing the effect.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by RDTrader16, Today, 10:19 PM
|
0 responses
5 views
0 likes
|
Last Post
by RDTrader16
Today, 10:19 PM
|
||
Started by gemify, 03-08-2023, 08:02 AM
|
9 responses
148 views
0 likes
|
Last Post
by culpepper
Today, 10:14 PM
|
||
Started by elirion, Today, 10:03 PM
|
0 responses
2 views
0 likes
|
Last Post
by elirion
Today, 10:03 PM
|
||
Started by RaddiFX, Today, 09:55 PM
|
0 responses
10 views
0 likes
|
Last Post
by RaddiFX
Today, 09:55 PM
|
||
Started by Trader146, 03-29-2024, 01:22 PM
|
4 responses
27 views
0 likes
|
Last Post
by Trader146
Today, 09:53 PM
|
Comment