Temporary InCanvas Graphics Image Colors

Temporary InCanvas Graphics Image Colors

3dimdev
Enthusiast Enthusiast
2,956 Views
25 Replies
Message 1 of 26

Temporary InCanvas Graphics Image Colors

3dimdev
Enthusiast
Enthusiast

Hello all!

 

I was creating a video on the awesome new Temporary InCanvas Graphics API and had a question on the image colors.  As you can see, they are...off.  What are the rules the images, and colors, we can use in this feature?  Thanks!

 

3dimdev_0-1621174309323.png

 

3rd Dimension Developer
YouTube.com/@3DimDev
2,957 Views
25 Replies
Replies (25)
Message 21 of 26

jeremy_tammik
Alumni
Alumni

Since the thread above is long and many-sided, I do not really understand what you are trying to do or what your problem is from your short description. Please elaborate.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 22 of 26

Ramoon_Bandeira
Contributor
Contributor

Hello Jeremy,
I`ve been simply trying to add a temporary image to my canvas using the TemporaryGraphicsManager, for that purpose i tryed to create an image with a size of 32x32 pixels, with a background of (0,128,128) rgb code.
As the documentation  states that this matches the best image settings for the image that should be added to the InCanvasImageControl that will be added to the TemporaryGraphicsManager.

The issue that i have is that the image appears as a transparent control on the revit view. And i would like to simply display its contents properly.

0 Likes
Message 23 of 26

Ramoon_Bandeira
Contributor
Contributor

My mistake, after investigating a little bit and the information by the blog post of @julianwandzilak 

The solution was found. The image has to follow the following specifications: 

1 - Format must be BMP
2 - Bit depth must be 24
3 - Not mandatory but optimal results are attained for images with size 32x32 or 64x64
4 - Not mandatory but the background becomes transparent if it has an rgb value of 0,128,128

Here is the post of julian that solved the issue. Thank you Julian once again.

0 Likes
Message 24 of 26

ricaun
Advisor
Advisor

Are you sure the issue is resolved?

 

When a Canvas Theme is used the color changes. (Happens in Revit 2024)

TemporaryGraphics - 2024-03-04 18-27-33.gif

 

When 3D View is used the color changes. (Happens in Revit 2024 and 2023)

TemporaryGraphics - 2024-03-04 18-28-05.gif

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 25 of 26

Ramoon_Bandeira
Contributor
Contributor

You are correct.

However, i was only aiming to make it work somehow. For that purpose, i achieved my goal.

Thanks.

Message 26 of 26

alisa_wachs_M3
Contributor
Contributor

From my brief test, 32-bit bmp work, even supports transparency, but it has to be of format A8 R8 G8 B8.

screenshot 2025-03-11 16_00_05-Epic Pen Content Surface_ __._DISPLAY2.jpg

The alpha channel works in reverse, where white represents full transparency, and black represents 100% opaque, you can even achieve semi-transparency. With this you can avoid relying on 0,128,128 for background.

screenshot 2025-03-11 16_37_17-Epic Pen Content Surface_ __._DISPLAY1.png

As for color change - it occurs in my version of Revit 2024.3 upon adding/moving/removing of any element, change of visual style, change to CropBox, toggling Canvas Theme(I have made my own button to switch between Dark/Light mode and the change does not occur when using it) change does not occur if you simply pan/zoom/orbit around. I think it can be tied to anything that triggers DocumentChanged event. The exact degree by which the color changes depends on Dark/Light Mode, almost as if its utilizing two different hardcoded colors.