Thanks
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
NT8 SuperDom column - cache rectangles to bitmapimage
Collapse
X
-
NT8 SuperDom column - cache rectangles to bitmapimage
I am developing a superdom column that draws thousands of rectangles, but this approach is too slow. Instead of drawing each rectangle to the columns drawingcontext individually in OnRender, how can I create a bitmap outside of on render, paint the necessary rectangles, save the bitmap, and draw the bitmap once in OnRender? I know this is possible using the DirectX controls that charts/indicators use, but I'm confused how to implement this using WPF in a superdom column. Any help would be greatly appreciated!
ThanksTags: None
-
Hi, thanks for posting.
We have an example of rendering a bitmap using SharpDX (attached). I do not know of an existing NinjaScript example of generating a bitmap at run time, but Microsoft has a page on the subject:
https://docs.microsoft.com/en-us/dot...orkdesktop-4.8 (publicly available)
Best regards,
-ChrisL
Attached FilesChris L.NinjaTrader Customer Service
-
Hi Chris,
This partially addresses my issue, but I need this functionality in a SuperDom column (that uses WPF), NOT an Indicator (that uses DirectX). This is the aspect that I am unable to solve on my own.
Thanks again
Comment
-
The SuperDom column OnRender override is "OnRender(DrawingContext dc, double renderWidth)"
The Indicator OnRender override is "OnRender(ChartControl chartControl, ChartScale chartScale)"
My issue is using the superdom column DrawingContext dc "dc.DrawImage(ImageSource, Rect)"...converting a SharpDX.Direct2D1.Bitmap to an ImageSource that I can render in the SuperDom column. Does this make sense? Both namespaces use different rendering engines, and my understanding of both is not complete. I see that I am able to instantiate and modify SharpDX objects in the superdom column with WPF, but this is of no use if I can't convert them to ImageSource objects for dc.DrawImage()
Thanks
Comment
-
Hi, I looked into converting a System.Drawing.Bitmap to an ImageSource and found this page:
https://stackoverflow.com/questions/...to-imagesource (publicly available)
I do not have any examples written from within our library for generating this image, that would need to be researched further. As far as the OnRender method from the DOM column, this only needs to render the ImageSource using code similar to the example in the DrawingContext page.
Kind regards,
-ChrisLChris L.NinjaTrader Customer Service
Comment
-
Do you guys have any sample code for actually loading and displaying an image in a SuperDOM column? This would be the most helpful
Thanks
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,403 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
94 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
6 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
158 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment