Transparency/Alpha Channel for add-in button icons

Transparency/Alpha Channel for add-in button icons

DRoam
Mentor Mentor
1,353 Views
7 Replies
Message 1 of 8

Transparency/Alpha Channel for add-in button icons

DRoam
Mentor
Mentor

Can someone explain to me how transparency works for the "StandardIcon" and "LargeIcon" for a ButtonDefinition? I thought I saw somewhere that Magenta is the alpha channel for Inventor button icons; however, I have a command that appears in a context menu, and its icon has some pure-white areas, and those areas are being made transparent (the same color as the context menu), and it looks bad.

 

I can work around this by setting them to slightly off-white, but I'd like to get a better understanding of why this is happening.

 

So two questions:

  1. Is there a way to have part of a ButtonDefinition icon be pure-white but not be made transparent?
  2. If I did want an area of my icon to be transparent, how would I go about doing that?

In case it matters, my icons are PNG image files that are being converted to IPictureDisp at run-time for usage by the ButtonDefinition.

 

@jason_hetu, I was hoping you would be willing to weigh in with your expertise here. Appreciate any assistance!

0 Likes
1,354 Views
7 Replies
Replies (7)
Message 2 of 8

JelteDeJong
Mentor
Mentor

its possible to make any area transparent. it does not matter what colour it is in any program.

There are some programs that i know of the can make any colour the transparent colour. its possible with Paint (from winows) you can google how to do it. But i found it difficult to do with paint. I downloaded IrfanView for my icons.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 8

DRoam
Mentor
Mentor

Thanks, @JelteDeJong. I think I deviated from my real question a bit by asking how to make something transparent. I'm somewhat familiar with doing that (I use Paint3D, which supports transparency in PNG files). What I'm confused by is why a pure white area becomes transparent in command button icons.

 

Do you know why this is and/or how to disable it for a particular command button or icon?

0 Likes
Message 4 of 8

jason_hetu
Autodesk
Autodesk

Hi Derek, 

 

A lot of icons in Inventor use a 1 bit alpha that is not actually saved into the image. As you say it uses a color to make transparent but only that 1 color will be transparent. I am not familiar with add-ins and how they differ but it seems like white is being used as the transparent color. I have a post on the beta that I sent you that goes over more details.

0 Likes
Message 5 of 8

Martin-Winkler-Consulting
Advisor
Advisor

@DRoam 

Did you try the .ico format?

I am using GreenFish Icon Editor (free) to create .ico

May be there is a possibilty for your needs.

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 6 of 8

_dscholtes_
Advocate
Advocate

For the custom icons of my macros, I use a bmp image with magenta (255,0,255) for transparent areas. I do not usually use pure white (255,255,255) in them, but when I have it is not 'rendered' transparent.

Message 7 of 8

Maxim-CADman77
Advisor
Advisor

I believe I've found the document that declares magenta color to be treated as transparent for Browser icons.
It is Inventor Icon Design Guidelines.pdf (it can be found at ...\SDK\DeveloperTools\Docs\Guidelines\ after SDK installation).


Regarding your questions:


1. I believe I do see Inventor makes pure-white (and 254,254,255) icon background color the transparent on ribbon (but not sure if this same to context menu). I wonder which is an easy way to add custom button to context menu (I do not wrap my custom command to transaction)?

 

2. I just create PNG with transparency and It works ... almost as expected (see the screenshot here - https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/addin-button-image/m-p/11440992#M143...).

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 8 of 8

thomas.fullerD3PYA
Explorer
Explorer

thomasfullerD3PYA_0-1669373295329.png

It looks like setting the background to magenta doesn't actually work though. Going on what the document, you mentioned outlines, anything magenta should be transparent.

0 Likes