ColorScale with displayConduit

Hi,

I’m trying to create a color scale. Something like this:
image
That would be displayed in each viewport that an user has open. My initial idea was to use the displayConduit class and draw the scale in the “drawforeground” event. However, then I noticed that ofcourse all the elements are drawn in the “model space” so when i move the the point where i’m looking the color scale will ofcourse move too, which is not the effect I was looking for. So then my idea was that maybe I could use some method in the view class to determine always the position the camera is looking to and move the the color scale every time I’m moving the camera which would maybe create a false feeling that the color scale is staying at the same point in the screen all the time.

So before trying to implement this I just wanted to ask that am I on the right track or is there an easier way of doing this?

With best regards
Matti Pirinen

You could draw a DisplayBitmap bitmap in screen coordinates. Still use the DrawForeground event, but create a bitmap that you draw. See this document and example:

Rhino.Display.DisplayPipeline.DrawBitmap

Thanks @nathanletwory!

Now I’m just wondering how to go with changing the color scale. If I understand correctly every time I want to change lets say the range of the numbers next to the color scale I need to create a new bitmap. I guess I can do this if it is not going to be too resource consuming for the computer?

I doubt that is going to be a problem for the computer, unless you decide to change it thousands of times per second on a huge resolution :slight_smile:

So yes, recreate the bitmap whenever you need to have a different legend.

@nathanletwory Thanks I’ll get to work :slight_smile: