How to know the exact colour after a level of transparency being applied?

1 回表示 (過去 30 日間)
Salad Box
Salad Box 2022 年 9 月 27 日
コメント済み: Salad Box 2022 年 10 月 3 日
Hi,
I am filling an area with a specific colour, say [255 0 0 ], but with a level of transparency, say 0.5. So the actually colour that is going to fill the area is a lot weaker than a pure red 255 0 0.
If I use 'fill' to fill the area, then I
set(h, 'FaceAlpha', 0.5)
what colour do I get?
Is there anywhere I can find out this colour that actually being used to fill the area after 0.5 level of transparency being applied?

採用された回答

Jan
Jan 2022 年 9 月 27 日
編集済み: Jan 2022 年 9 月 27 日
The color you see through a semitransparent element depends on the background. The rule is simple:
alpha = rand; % Anything between 0 and 1
Background = rand(1, 3); % RGB
Foreground = rand(1, 3);
Visible = Foreground * alpha + Background * (1 - alpha); % resulting RGB color
  4 件のコメント
Jan
Jan 2022 年 9 月 29 日
I don't know. I even do not know the Yxy color space.
Salad Box
Salad Box 2022 年 10 月 3 日
Brilliant. Thank you for your answers!! Very much appreciated!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by