颜色
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
- 所属包
- 图像处理