NSImageView Color + Background Color

I have a requirement

You have one NSIMageView and that will change frequently based on a timer. When resizing, it should maintain the aspect ratio, so the image may not occupy the entire frame of the image, in this case I need to display the background color black,

can someone help me how can i achieve this? One approach came up in googling - to have a SubClass from NSImageView, but I don’t know what will affect the performance, since the image changes often,

+6
source share
1 answer

Set the image size detection mode to Proportional. Turn it on in an NSBox set to user mode with a black background. No code is needed, just an example of thinking inside a box ...

+9
source

Source: https://habr.com/ru/post/893846/


All Articles