Handle transparency to the best of our ability in wxImageList
Don't take the value of "mask" parameter of wxImageList constructor too prescriptively, it predates support for alpha in wxWidgets by many years and was never meant to actually suppress using it. Instead, do the best thing we can in all cases, i.e. use alpha if it's specified and supported and use mask otherwise. But only create the mask from light grey colour if we have nothing else if "mask" is true in wxImageList constructor, as this is a potentially destructive action that must not be performed if the user has explicitly decided to set this parameter to false. Incidentally fix handling of alpha with comctl32.dll v5 (which is used in the absence of any manifest) by converting it to a mask in this case: this is not ideal, but better than just using black background as it happened before, and restores pre-3.1.5 behaviour. Also simplify the generic version which just has to create the default mask if necessary and doesn't have to do anything at all in all the other cases. Note that these changes required relaxing some of the existing unit tests as wxMSW implementation now can add alpha channel to the bitmaps that didn't have it -- but this is a more useful behaviour, and so it makes more sense to adapt the tests to it rather than doing a less useful thing just to conform to the tests. This commit is best viewed with git --color-moved --color-moved-ws=ignore-all-spac options. Closes #22349.
This commit is contained in:
@@ -28,8 +28,8 @@ enum
|
||||
@class wxImageList
|
||||
|
||||
A wxImageList contains a list of images, which are stored in an unspecified
|
||||
form. Images can have masks for transparent drawing, and can be made from a
|
||||
variety of sources including bitmaps and icons.
|
||||
form. Images can use alpha channel or masks for transparent drawing, and
|
||||
can be made from a variety of sources including bitmaps and icons.
|
||||
|
||||
wxImageList is used principally in conjunction with wxTreeCtrl and
|
||||
wxListCtrl classes.
|
||||
@@ -62,7 +62,12 @@ public:
|
||||
@param height
|
||||
Height of the images in the list.
|
||||
@param mask
|
||||
@true if masks should be created for all images.
|
||||
If @true, all images will have masks, with the mask being created
|
||||
from the light grey pixels if not specified otherwise, i.e. if the
|
||||
image doesn't have neither alpha channel nor mask and no mask is
|
||||
explicitly specified when adding it. Note that if an image does
|
||||
have alpha channel or mask, it will always be used, whether this
|
||||
parameter is @true or @false.
|
||||
@param initialCount
|
||||
The initial size of the list.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user