Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 SuperDom column - cache rectangles to bitmapimage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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!

    Thanks

    #2
    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 Files

    Comment


      #3
      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


        #4
        Hi, thanks for your reply. Both types of scripts can override OnRender. We have a few default SuperDOM column examples that you can study through NinjaScript Editor>SuperDomColumns. The concept of the bitmap would be the same.

        Best regards,
        -ChrisL

        Comment


          #5
          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


            #6
            Hi, Ill have a look and let you know what I found out.

            Thanks in advance.

            Comment


              #7
              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,
              -ChrisL

              Comment


                #8
                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


                  #9
                  Hi, I made an example of drawing a bitmap image to the render rectangle. The image is loaded from the disk, so you will have to get an image you want to show and change the path name on line 55 to test the example.

                  Kind regards,
                  -ChrisL
                  Attached Files

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  633 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  364 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  105 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  567 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  568 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X