顏色
46 個節點
本頁內容 46
透明度
函數Opacity (Transparency), higher value means more opaque.
透明度(顏色: 顏色) -> 位元組
byte Alpha(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 位元組 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
藍
函數Blue channel, from 0 (none) to 255 (full).
藍(顏色: 顏色) -> 位元組
byte Blue(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 位元組 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
綠
函數Green channel, from 0 (none) to 255 (full).
綠(顏色: 顏色) -> 位元組
byte Green(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 位元組 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
紅
函數Red channel, from 0 (none) to 255 (full).
紅(顏色: 顏色) -> 位元組
byte Red(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 位元組 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
建立顏色
函數過載 1/7
建立顏色() -> 顏色
ColorElement ColorElement()
Creates transparent black: every channel, alpha included, is 0.
返回
| 結果 | 顏色 |
過載 2/7
建立顏色(單一值: 位元組) -> 顏色
ColorElement ColorElement(byte singleValue)
Creates an opaque gray, with red, green and blue all set to the same value and alpha 255.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 單一值 | 位元組 | — | Gray level from 0 (black) to 255 (white). |
返回
| 結果 | 顏色 |
過載 3/7
建立顏色(單一值: 位元組, 透明度: 位元組) -> 顏色
ColorElement ColorElement(byte singleValue, byte alpha = 255)
Creates a gray, with red, green and blue all set to the same value, and the given opacity.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 單一值 | 位元組 | — | Gray level from 0 (black) to 255 (white). |
| 透明度 | 位元組 | 255 | Opacity from 0 (fully transparent) to 255 (fully opaque). |
返回
| 結果 | 顏色 |
過載 4/7
建立顏色 -> 顏色
紅: 位元組
綠: 位元組
藍: 位元組
透明度: 位元組ColorElement ColorElement(
byte red,
byte green,
byte blue,
byte alpha = 255)Creates a color from its red, green, blue and alpha channels, each from 0 to 255.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 紅 | 位元組 | — | Red channel, 0-255. |
| 綠 | 位元組 | — | Green channel, 0-255. |
| 藍 | 位元組 | — | Blue channel, 0-255. |
| 透明度 | 位元組 | 255 | Opacity, 0 (fully transparent) to 255 (fully opaque); opaque when omitted. |
返回
| 結果 | 顏色 |
過載 5/7
建立顏色(位元組: 位元組陣列) -> 顏色
ColorElement ColorElement(byte[] bytes)
Creates a color from the first four bytes of an array, read in red, green, blue, alpha order.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 位元組 | 位元組陣列 | — | At least four bytes; any beyond the fourth are ignored. Fewer than four throws System.IndexOutOfRangeException. |
返回
| 結果 | 顏色 |
過載 6/7
建立顏色(像素: Pixel) -> 顏色
ColorElement ColorElement(Pixel pixel)
Creates a color from a BigGustave PNG pixel, copying its red, green, blue and alpha bytes unchanged.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 像素 | Pixel | — | The PNG decoder's pixel. |
返回
| 結果 | 顏色 |
過載 7/7
建立顏色 -> 顏色
R: 低精度數字
克: 低精度數字
B: 低精度數字
A: 低精度數字ColorElement ColorElement(float r, float g, float b, float a)
Creates a color from fractional channels in the 0-1 range, each multiplied by 255 and truncated (not rounded) to a byte.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| R | 低精度數字 | — | Red channel, 0-1. |
| 克 | 低精度數字 | — | Green channel, 0-1. |
| B | 低精度數字 | — | Blue channel, 0-1. |
| A | 低精度數字 | — | Opacity, 0 (fully transparent) to 1 (fully opaque). |
返回
| 結果 | 顏色 |
備註
Inputs are not clamped before the conversion, so keep every channel within 0-1.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
相等
函數過載 1/2
相等(顏色: 顏色, 另一個: 顏色) -> 真否
bool Equals(ColorElement Color, ColorElement other)
Whether both colors have exactly the same red, green, blue and alpha bytes.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — | |
| 另一個 | 顏色 | — | The color to compare with. |
返回
| 結果 | 真否 |
過載 2/2
相等(顏色: 顏色, 物件: 任意) -> 真否
bool Equals(ColorElement Color, object obj)
Whether Obj is a Image.ColorElement with exactly the same four channels.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — | |
| 物件 | 任意 | — | The object to compare with. |
返回
| 結果 | 真否 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
透明度(浮點)
函數The opacity as a fraction from 0 (fully transparent) to 1 (fully opaque).
透明度(浮點)(顏色: 顏色) -> 低精度數字
float AlphaFloat(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 低精度數字 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
藍(浮點)
函數The blue channel as a fraction from 0 to 1 (the byte divided by 255).
藍(浮點)(顏色: 顏色) -> 低精度數字
float BlueFloat(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 低精度數字 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
綠(浮點)
函數The green channel as a fraction from 0 to 1 (the byte divided by 255).
綠(浮點)(顏色: 顏色) -> 低精度數字
float GreenFloat(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 低精度數字 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
紅(浮點)
函數The red channel as a fraction from 0 to 1 (the byte divided by 255).
紅(浮點)(顏色: 顏色) -> 低精度數字
float RedFloat(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 低精度數字 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
取得雜湊碼
函數A hash code built from all four channels, consistent with ColorElement.Equals.
取得雜湊碼(顏色: 顏色) -> 整數
int GetHashCode(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
儲存為文字
函數The color as text, in the same "#RRGGBBAA" hex form as ColorElement.ToString.
儲存為文字(顏色: 顏色) -> 文字
string SaveAsText(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 文字 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為主控台顏色
函數Converts this Color instance to the closest matching ConsoleColor.
The match is determined by the Euclidean distance between RGB components.
轉為主控台顏色(顏色: 顏色) -> ConsoleColor
ConsoleColor ToConsoleColor(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | ConsoleColor |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為灰度
函數A standard interpretation of (floating point) grayscale.
轉為灰度(顏色: 顏色) -> 低精度數字
float ToGrayscale(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 低精度數字 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為十六進位制
函數Convert color to RGB hex representation.
轉為十六進位制(顏色: 顏色, 透明度: 真否) -> 文字
string ToHex(ColorElement Color, bool alpha = false)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — | |
| 透明度 | 真否 | False |
返回
| 結果 | 文字 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為亮度
函數The perceived brightness of the color as a gray level, weighting red, green and blue as 0.299, 0.587 and 0.114 (Rec. 601) and rounding to the nearest byte.
轉為亮度(顏色: 顏色) -> 位元組
byte ToLuminance(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 位元組 |
備註
The weights are applied to the stored bytes directly, without converting from sRGB to linear light. Alpha is ignored.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為紅色通道灰度
函數Treats the color as a grayscale value by taking its red channel alone, the convention this library uses for single-channel images.
轉為紅色通道灰度(顏色: 顏色) -> 位元組
byte ToRedGray(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 位元組 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為文字
函數Returns a hexadecimal string representation of the Image.ColorElement.
轉為文字(顏色: 顏色) -> 文字
string ToString(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | 文字 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為三元組
函數The red, green and blue bytes (0-255) as a tuple, dropping alpha.
轉為三元組(顏色: 顏色) -> (位元組, 位元組, 位元組)
(byte, byte, byte) ToTuple3(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | (位元組, 位元組, 位元組) |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為四元組
函數The red, green, blue and alpha bytes (0-255) as a tuple.
轉為四元組(顏色: 顏色) -> (位元組, 位元組, 位元組, 位元組)
(byte, byte, byte, byte) ToTuple4(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | (位元組, 位元組, 位元組, 位元組) |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為三維向量
函數The red, green and blue channels as fractions from 0 to 1 in X, Y and Z, dropping alpha.
轉為三維向量(顏色: 顏色) -> Vector3
Vector3 ToVector3(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | Vector3 |
備註
The bytes are divided by 255 as stored; no sRGB-to-linear conversion is applied.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
轉為四維向量
函數The red, green, blue and alpha channels as fractions from 0 to 1 in X, Y, Z and W.
轉為四維向量(顏色: 顏色) -> Vector4
Vector4 ToVector4(ColorElement Color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — |
返回
| 結果 | Vector4 |
備註
The bytes are divided by 255 as stored; no sRGB-to-linear conversion is applied.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
設定透明度
函數Returns a copy of this color with the same red, green and blue but a different opacity.
設定透明度(顏色: 顏色, 透明度: 位元組) -> 顏色
ColorElement WithAlpha(ColorElement Color, byte alpha)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — | |
| 透明度 | 位元組 | — | The new opacity, 0 (fully transparent) to 255 (fully opaque). |
返回
| 結果 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
寫入流
函數Writes the color as four raw bytes, red, green, blue then alpha.
寫入流(顏色: 顏色, 寫入器: BinaryWriter) -> 大整數
long WriteToStream(ColorElement Color, BinaryWriter writer)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — | |
| 寫入器 | BinaryWriter | — | The writer to append to. |
返回
| 結果 | 大整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 事件 例程 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
由 ARGB 生成顏色
函數Creates a color from alpha, red, green and blue bytes, given alpha first.
由 ARGB 生成顏色 -> 顏色
A: 位元組
R: 位元組
克: 位元組
B: 位元組ColorElement FromArgb(byte a, byte r, byte g, byte b)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| A | 位元組 | — | Opacity, 0 (fully transparent) to 255 (fully opaque). |
| R | 位元組 | — | Red channel, 0-255. |
| 克 | 位元組 | — | Green channel, 0-255. |
| B | 位元組 | — | Blue channel, 0-255. |
返回
| 結果 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
由主控台顏色生成
函數Converts a ConsoleColor to a Color instance using a fixed mapping.
由主控台顏色生成(主控台顏色: ConsoleColor) -> 顏色
ColorElement FromConsoleColor(ConsoleColor consoleColor)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 主控台顏色 | ConsoleColor | — |
返回
| 結果 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
由 RGB 生成顏色
函數Creates a fully opaque color from red, green and blue bytes.
由 RGB 生成顏色(R: 位元組, 克: 位元組, B: 位元組) -> 顏色
ColorElement FromRgb(byte r, byte g, byte b)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| R | 位元組 | — | Red channel, 0-255. |
| 克 | 位元組 | — | Green channel, 0-255. |
| B | 位元組 | — | Blue channel, 0-255. |
返回
| 結果 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
由 scRGB 生成顏色
函數此節點沒有文件說明。
由 scRGB 生成顏色 -> 顏色
A: 整數
R: 低精度數字
克: 低精度數字
B: 低精度數字ColorElement FromScRgb(int a, float r, float g, float b)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| A | 整數 | — | |
| R | 低精度數字 | — | |
| 克 | 低精度數字 | — | |
| B | 低精度數字 | — |
返回
| 結果 | 顏色 |
備註
TODO: looks broken. this forwards to the all-float constructor, so a gets multiplied by 255 again — FromScRgb(255, ...). Look at usages and see how to/whether to fix this.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
由單位浮點值生成顏色
函數此節點沒有文件說明。
由單位浮點值生成顏色(值: 低精度數字) -> 顏色
ColorElement FromUnitFloat(float value)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 低精度數字 | — | Value between 0-1 |
返回
| 結果 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
取得可空顏色
函數Gets color from serialization.
取得可空顏色(位元組: 位元組陣列) -> 可選顏色
ColorElement? GetColorNullable(byte[] bytes)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 位元組 | 位元組陣列 | — |
返回
| 結果 | 可選顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
顏色插值
函數過載 1/3
顏色插值(顏色 1: 顏色, 顏色 2: 顏色, 透明度: 位元組) -> 顏色
ColorElement Interp(
ColorElement c1,
ColorElement c2,
byte alpha)此節點沒有文件說明。
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 1 | 顏色 | — | |
| 顏色 2 | 顏色 | — | |
| 透明度 | 位元組 | — |
返回
| 結果 | 顏色 |
備註
Ignores alpha, effectively assumping premultiplied.
過載 2/3
顏色插值(顏色 1: 顏色, 顏色 2: 顏色, 比例: 數字) -> 顏色
ColorElement Interp(
ColorElement c1,
ColorElement c2,
double ratio)此節點沒有文件說明。
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 1 | 顏色 | — | |
| 顏色 2 | 顏色 | — | |
| 比例 | 數字 | — |
返回
| 結果 | 顏色 |
備註
Ignores alpha, effectively assumping premultiplied.
過載 3/3
顏色插值 -> 顏色
起點: 顏色
終點: 顏色
混合係數: 低精度數字
使用目標的透明度: 真否ColorElement Interp(
ColorElement from,
ColorElement to,
float blend,
bool useAlphaFromTarget)Linear interpolate with proper alpha treatment.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 起點 | 顏色 | — | The color returned at a blend of 0. |
| 終點 | 顏色 | — | The color blended towards; reached at a blend of 1 (and, when Use Alpha From Target is set, only if it is fully opaque). |
| 混合係數 | 低精度數字 | — | Value between 0-1 |
| 使用目標的透明度 | 真否 | — |
返回
| 結果 | 顏色 |
備註
In general, this is a weird operation; Use with care at call site - likely we would want something more well defined.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
從文字載入
函數Reads a color from text, accepting the same hex codes and color names as ColorElement.Parse.
從文字載入(文字: 文字) -> 顏色
ColorElement LoadFromText(string text)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 文字 | 文字 | — | A hex code such as "#RRGGBBAA" or a Image.MediaColors name. |
返回
| 結果 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
RGB 相乘並保留透明度
函數Brightens or darkens a color by multiplying red, green and blue by a factor, keeping its alpha unchanged.
RGB 相乘並保留透明度(顏色: 顏色, 乘數: 數字) -> 顏色
ColorElement MultiplyRgbPreserveAlpha(
ColorElement color,
double multiplier)參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 顏色 | 顏色 | — | The color to scale. |
| 乘數 | 數字 | — | The factor applied to each of red, green and blue; 1 leaves the color unchanged. |
返回
| 結果 | 顏色 |
備註
Each channel is rounded and clamped to 0-255, so a large factor saturates at white rather than wrapping; a NaN or infinite product gives 0.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
加法運算
函數Adds two colors channel by channel for red, green and blue; the result is always opaque.
加法運算(A: 顏色, B: 顏色) -> 顏色
ColorElement op_Addition(ColorElement a, ColorElement b)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| A | 顏色 | — | The first color; its alpha is ignored. |
| B | 顏色 | — | The second color; its alpha is ignored. |
返回
| 結果 | 顏色 |
備註
The byte arithmetic wraps rather than clamps: a channel that would exceed 255 comes back near 0.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
相等運算
函數Whether two colors have exactly the same red, green, blue and alpha bytes.
相等運算(左側: 顏色, 右側: 顏色) -> 真否
bool op_Equality(ColorElement left, ColorElement right)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 左側 | 顏色 | — | The first color. |
| 右側 | 顏色 | — | The second color. |
返回
| 結果 | 真否 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
不等運算
函數Whether two colors differ in any of red, green, blue or alpha.
不等運算(左側: 顏色, 右側: 顏色) -> 真否
bool op_Inequality(ColorElement left, ColorElement right)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 左側 | 顏色 | — | The first color. |
| 右側 | 顏色 | — | The second color. |
返回
| 結果 | 真否 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
乘法運算
函數Scales red, green and blue by a factor, truncating each result to a byte; the result is always opaque.
乘法運算(A: 顏色, 矩陣: 數字) -> 顏色
ColorElement op_Multiply(ColorElement a, double m)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| A | 顏色 | — | The color to scale; its alpha is ignored. |
| 矩陣 | 數字 | — | The factor applied to each of red, green and blue. |
返回
| 結果 | 顏色 |
備註
Results are not clamped, so keep the factor small enough that no channel exceeds 255; ColorElement.MultiplyRgbPreserveAlpha clamps and keeps alpha.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
減法運算
函數Subtracts one color from another channel by channel for red, green and blue; the result is always opaque.
減法運算(A: 顏色, B: 顏色) -> 顏色
ColorElement op_Subtraction(ColorElement a, ColorElement b)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| A | 顏色 | — | The color subtracted from; its alpha is ignored. |
| B | 顏色 | — | The color subtracted; its alpha is ignored. |
返回
| 結果 | 顏色 |
備註
The byte arithmetic wraps rather than clamps: a channel that would go below 0 comes back near 255.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
解析顏色
函數Parses a string representation of a color and returns the corresponding Image.ColorElement instance.
解析顏色(文字顏色: 文字) -> 顏色
ColorElement Parse(string textColor)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 文字顏色 | 文字 | — | A string representing the color. This can either be a hexadecimal value (starting with '#') in the format "#RRGGBB" or "#RRGGBBAA" (with an optional alpha component) or the name of a predefined color in Image.MediaColors. |
返回
| 結果 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
解析十六進位制 ARGB
函數Parses a hexadecimal string representation of a color in ARGB order.
解析十六進位制 ARGB(十六進位制: 文字) -> 顏色
ColorElement ParseHexARGB(string hex)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 十六進位制 | 文字 | — | A hexadecimal string representing the color. The string may optionally start with '#' and must be in the format "AARRGGBB", where the alpha component comes first. |
返回
| 結果 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
解析十六進位制 RGBA
函數Parses a hexadecimal string representation of a color in RGBA order.
解析十六進位制 RGBA(十六進位制: 文字) -> 顏色
ColorElement ParseHexRGBA(string hex)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 十六進位制 | 文字 | — | A hexadecimal string representing the color. The string may optionally start with '#' and must be in the format "RRGGBB" or "RRGGBBAA", where the alpha component is optional and defaults to 255 if omitted. |
返回
| 結果 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
從流讀取
函數Reads a color written by ColorElement.WriteToStream: four bytes, red, green, blue then alpha.
從流讀取(讀取器: BinaryReader) -> (結果: 大整數, 值: 顏色)
long ReadFromStream(BinaryReader reader, out ColorElement value)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 讀取器 | BinaryReader | — | The reader positioned at the color. |
返回
| 結果 | 大整數 |
| 值 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
序列化
函數Nullable serialization helper.
序列化(值: 可選顏色) -> 位元組陣列
byte[] Serialize(ColorElement? value)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 可選顏色 | — | Can be null |
返回
| 結果 | 位元組陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
嘗試解析顏色
函數Tries to read a color from text, either a hex code starting with '#' or the name of a color in Image.MediaColors, without throwing on bad input.
嘗試解析顏色(文字顏色: 文字) -> (結果: 真否, 顏色: 顏色)
bool TryParse(string textColor, out ColorElement color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 文字顏色 | 文字 | — | The text to parse, such as "#FF8000", "#FF800080" or "Orange". |
返回
| 結果 | 真否 |
| 顏色 | 顏色 |
備註
Surrounding whitespace is ignored and color names are matched case-insensitively. A hex code is read as "#RRGGBB" or "#RRGGBBAA" (see ColorElement.TryParseHexRGBA).
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
嘗試解析十六進位制 ARGB
函數Tries to read a hex color in alpha, red, green, blue order (the order XAML color codes use), without throwing on bad input.
嘗試解析十六進位制 ARGB(十六進位制: 文字) -> (結果: 真否, 顏色: 顏色)
bool TryParseHexARGB(string hex, out ColorElement color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 十六進位制 | 文字 | — | Exactly eight hex digits, "AARRGGBB", optionally preceded by '#' and surrounded by whitespace. |
返回
| 結果 | 真否 |
| 顏色 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理
嘗試解析十六進位制 RGBA
函數Tries to read a hex color in red, green, blue, alpha order, without throwing on bad input.
嘗試解析十六進位制 RGBA(十六進位制: 文字) -> (結果: 真否, 顏色: 顏色)
bool TryParseHexRGBA(string hex, out ColorElement color)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 十六進位制 | 文字 | — | Six or eight hex digits, "RRGGBB" or "RRGGBBAA", optionally preceded by '#' and surrounded by whitespace. Alpha defaults to 255 (opaque) when only six digits are given. |
返回
| 結果 | 真否 |
| 顏色 | 顏色 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- Color
- 所屬包
- 影像處理