元編程參考文件

像素影像

61 個節點

本頁內容 61

像素影像

函數

過載 1/4

簽名
像素影像() -> Pixel Image
PixelImage PixelImage()

此節點沒有文件說明。

返回

像素影像Pixel Image

備註

We must have this empty constructor because PixelImage is deserializable as instance.

過載 2/4

簽名
像素影像(寬度: 整數, 高度: 整數) -> Pixel Image
PixelImage PixelImage(int width, int height)

Creates a blank image of the given size, with every pixel transparent black (all channels 0).

參數

名稱型別預設值說明
寬度整數—Number of columns, in pixels.
高度整數—Number of rows, in pixels.

返回

像素影像Pixel Image

過載 3/4

簽名
像素影像 -> Pixel Image
    寬度: 整數
    高度: 整數
    平面值: 顏色陣列
PixelImage PixelImage(
    int width,
    int height,
    ColorElement[] flat)

Creates an image from a single flat run of pixels, read row by row from the top-left corner.

參數

名稱型別預設值說明
寬度整數—Number of columns, in pixels.
高度整數—Number of rows, in pixels.
平面值顏色陣列—The pixels in row-major order: the first Width entries are the top row.

返回

像素影像Pixel Image

備註

The pixels are copied, so later changes to Flat do not affect the image. Any pixels beyond Width times Height are ignored.

過載 4/4

簽名
像素影像(像素: 顏色陣列陣列) -> Pixel Image
PixelImage PixelImage(ColorElement[][] pixels)

此節點沒有文件說明。

參數

名稱型別預設值說明
像素顏色陣列陣列—Direct reference without copy.

返回

像素影像Pixel Image

備註

A zero-row array is a legitimate empty image and yields a 0x0 one. Reading
pixels[0].Length unconditionally used to throw here, which made
PixelImage.Clone throw on any empty image — so callers that could legitimately hold one
had to route around cloning rather than the constructor simply answering zero.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

複製影像

函數

Makes an independent copy of the image, so editing the copy leaves the original untouched.

簽名
複製影像(Pixel Image: Pixel Image) -> Pixel Image
PixelImage Clone(PixelImage Pixel Image)

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果Pixel Image

備註

Each row is copied up to PixelImage.Columns pixels. An empty image clones to an empty image.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

列數

函數

Width of the image in pixels, that is, the number of pixels in each row.

簽名
列數(Pixel Image: Pixel Image) -> 整數
int Columns(PixelImage Pixel Image)

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果整數

備註

Setting this does not resize PixelImage.Pixels; it only changes how much of each row the image reports and reads, so it should match the pixel data.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

像素

函數

過載 1/2

簽名
像素(Pixel Image: Pixel Image, 索引: 整數) -> 顏色
ColorElement Item(PixelImage Pixel Image, int index)

Reads or writes a pixel by its position in row-major order, counting from 0 at the top-left corner along each row in turn, so index y * Columns + x is the pixel at column x of row y.

參數

名稱型別預設值說明
Pixel ImagePixel Image—
索引整數—The pixel's position, from 0 to PixelImage.Columns × PixelImage.Rows - 1.

返回

結果顏色

過載 2/2

簽名
像素(Pixel Image: Pixel Image, X: 整數, Y: 整數) -> 顏色
ColorElement Item(PixelImage Pixel Image, int x, int y)

Reads or writes the pixel at a column and row, the same as PixelImage.GetPixel and PixelImage.SetPixel.

參數

名稱型別預設值說明
Pixel ImagePixel Image—
X整數—Column, counted from 0 at the left edge.
Y整數—Row, counted from 0 at the top edge.

返回

結果顏色
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

像素

函數

此節點沒有文件說明。

簽名
像素(Pixel Image: Pixel Image) -> 顏色陣列陣列
ColorElement[][] Pixels(PixelImage Pixel Image)

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果顏色陣列陣列

備註

Row-major, aka. Pixels[Row][Col] or Pixels[Height][Width]

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

原始資料

函數

The whole image as tightly packed RGBA bytes, four per pixel, row by row from the top-left corner; see PixelImage.ToTightlyPackedRgbaBytes.

簽名
原始資料(Pixel Image: Pixel Image) -> 位元組陣列
byte[] Raw(PixelImage Pixel Image)

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果位元組陣列

備註

Every read builds a new copy of the pixel data, so read it once and keep the result rather than reading it inside a loop.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

行數

函數

Height of the image in pixels, that is, the number of rows.

簽名
行數(Pixel Image: Pixel Image) -> 整數
int Rows(PixelImage Pixel Image)

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果整數

備註

Setting this does not resize PixelImage.Pixels; it should match the number of rows in the pixel data.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

取得顏色

函數

The color of one pixel, exactly as stored.

簽名
取得顏色(Pixel Image: Pixel Image, X: 整數, Y: 整數) -> 顏色
ColorElement GetColor(PixelImage Pixel Image, int x, int y)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
X整數—Column, counted from 0 at the left edge.
Y整數—Row, counted from 0 at the top edge.

返回

結果顏色
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

取得浮點值

函數

The pixel's value read as a single number from 0 to 1, taken from its red channel alone; useful for heightmaps, masks and other grayscale data.

簽名
取得浮點值 -> 低精度數字
    Pixel Image: Pixel Image
    X: 整數
    Y: 整數
float GetFloatValue(PixelImage Pixel Image, int x, int y)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
X整數—Column, counted from 0 at the left edge.
Y整數—Row, counted from 0 at the top edge.

返回

結果低精度數字
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

取得灰度位元組

函數

The pixel's value read as grayscale, which for this image is its red channel alone (green, blue and alpha are ignored).

簽名
取得灰度位元組 -> 位元組
    Pixel Image: Pixel Image
    X: 整數
    Y: 整數
byte GetGrayByte(PixelImage Pixel Image, int x, int y)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
X整數—Column, counted from 0 at the left edge.
Y整數—Row, counted from 0 at the top edge.

返回

結果位元組
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

取得像素

函數

The color of one pixel.

簽名
取得像素(Pixel Image: Pixel Image, X: 整數, Y: 整數) -> 顏色
ColorElement GetPixel(PixelImage Pixel Image, int x, int y)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
X整數—Column, counted from 0 at the left edge.
Y整數—Row, counted from 0 at the top edge.

返回

結果顏色
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

取得 PNG 緩衝區

函數

過載 1/2

簽名
取得 PNG 緩衝區(Pixel Image: Pixel Image) -> 位元組陣列
byte[] GetPngBuffer(PixelImage Pixel Image)

Serialize image as raw PNG file buffer. Supports large images.

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果位元組陣列

過載 2/2

簽名
取得 PNG 緩衝區 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Png Image Writer Options
byte[] GetPngBuffer(
    PixelImage Pixel Image,
    PngImageWriterOptions options)

Serialize image as raw PNG file buffer, with explicit encoder options. Supports large images.

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Png Image Writer Options—

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存

函數

過載 1/3

簽名
儲存(Pixel Image: Pixel Image, 路徑: 文字)
void Save(PixelImage Pixel Image, string path)

Writes image as PNG to target file path.
This supports large pngs.

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—

備註

Encoding is delegated to BuiltinIO.PngImageWriter, which streams row by row and picks
the smallest lossless colour type for the pixel data.

過載 2/3

簽名
儲存
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Png Image Writer Options
void Save(
    PixelImage Pixel Image,
    string path,
    PngImageWriterOptions options)

Writes image as PNG to target file path, with explicit encoder options.

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Png Image Writer Options—

過載 3/3

簽名
儲存(Pixel Image: Pixel Image, 流式輸出: Stream)
void Save(PixelImage Pixel Image, Stream stream)

Writes this image as PNG to a stream.

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為 BMP

函數

Writes the image as a Windows bitmap (.bmp).

簽名
儲存為 BMP
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Bmp Image Writer Options
void SaveAsBmp(
    PixelImage Pixel Image,
    string path,
    BmpImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Bmp Image Writer Options—
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為 GIF

函數

Writes the image as GIF. Alpha collapses to the format's single transparent index.

簽名
儲存為 GIF
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Gif Image Writer Options
void SaveAsGif(
    PixelImage Pixel Image,
    string path,
    GifImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Gif Image Writer Options—
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為 ICO

函數

Writes the image as a Windows icon (.ico).

簽名
儲存為 ICO
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Ico Image Writer Options
void SaveAsIco(
    PixelImage Pixel Image,
    string path,
    IcoImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Ico Image Writer Options—
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為 JPEG

函數

Writes the image as baseline JPEG (.jpg). Lossy, and transparency is composited away.

簽名
儲存為 JPEG
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Jpeg Image Writer Options
void SaveAsJpeg(
    PixelImage Pixel Image,
    string path,
    JpegImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Jpeg Image Writer Options—
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為 PNM

函數

Writes the image as Netpbm (.ppm/.pgm/.pbm). Alpha is discarded.

簽名
儲存為 PNM
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Portable Any Map Image Writer Options
void SaveAsPortableAnyMap(
    PixelImage Pixel Image,
    string path,
    PortableAnyMapImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Portable Any Map Image Writer Options—
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為 PFM

函數

Writes the image as Portable FloatMap (.pfm), converting channels to 32-bit float.

簽名
儲存為 PFM
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Portable Float Map Image Writer Options
void SaveAsPortableFloatMap(
    PixelImage Pixel Image,
    string path,
    PortableFloatMapImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Portable Float Map Image Writer Options—

備註

PFM is a linear format, so by default the sRGB curve is decoded on the way in. Set
PortableFloatMapImageWriterOptions.SourceTransferFunction to
ColorTransferFunction.Linear for data that is already linear, such as a
depth buffer or heightmap - it is also considerably faster.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為 QOI

函數

Writes the image as Quite OK Image (.qoi) - lossless, and much faster to encode than PNG.

簽名
儲存為 QOI
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Qoi Image Writer Options
void SaveAsQoi(
    PixelImage Pixel Image,
    string path,
    QoiImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Qoi Image Writer Options—
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為文字

函數

The image as Base64 text, encoding the same bytes as PixelImage.SerializeIntoBytes, for storing an image inside a text document.

簽名
儲存為文字(Pixel Image: Pixel Image) -> 文字
string SaveAsText(PixelImage Pixel Image)

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果文字
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為 TGA

函數

Writes the image as Truevision TGA (.tga), run-length encoded by default.

簽名
儲存為 TGA
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Tga Image Writer Options
void SaveAsTga(
    PixelImage Pixel Image,
    string path,
    TgaImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Tga Image Writer Options—
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存為 WebP

函數

Writes the image as WebP (.webp): lossless, with alpha stored natively, unless WebPImageWriterOptions.Lossy asks for libwebp's lossy form.

簽名
儲存為 WebP
    Pixel Image: Pixel Image
    路徑: 文字
    選項: Web P Image Writer Options
void SaveAsWebP(
    PixelImage Pixel Image,
    string path,
    WebPImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
路徑文字—
選項Web P Image Writer Options—
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

序列化為位元組

函數

Serializes the image into Divooka's own binary form, as written by PixelImage.WriteToStream.

簽名
序列化為位元組(Pixel Image: Pixel Image) -> 位元組陣列
byte[] SerializeIntoBytes(PixelImage Pixel Image)

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

設定像素

函數

Replaces the color of one pixel, changing the image in place.

簽名
設定像素(Pixel Image: Pixel Image, X: 整數, Y: 整數, 顏色: 顏色)
void SetPixel(
    PixelImage Pixel Image,
    int x,
    int y,
    ColorElement color)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
X整數—Column, counted from 0 at the left edge.
Y整數—Row, counted from 0 at the top edge.
顏色顏色—The new color.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為 BMP 位元組

函數

Encodes the image as a Windows bitmap (.bmp) file in memory, producing the same bytes PixelImage.SaveAsBmp writes to disk.

簽名
轉為 BMP 位元組 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Bmp Image Writer Options
byte[] ToBmpBytes(
    PixelImage Pixel Image,
    BmpImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Bmp Image Writer Options—Encoder settings; null uses the defaults.

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為平鋪陣列

函數

Copies all pixels into a single array, row by row from the top-left corner, so pixel (x, y) is at index y * Columns + x.

簽名
轉為平鋪陣列(Pixel Image: Pixel Image) -> 顏色陣列
ColorElement[] ToFlatArray(PixelImage Pixel Image)

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果顏色陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為 GIF 位元組

函數

Encodes the image as a GIF file in memory, producing the same bytes PixelImage.SaveAsGif writes to disk.

簽名
轉為 GIF 位元組 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Gif Image Writer Options
byte[] ToGifBytes(
    PixelImage Pixel Image,
    GifImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Gif Image Writer Options—Encoder settings; null uses the defaults.

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為 ICO 位元組

函數

Encodes the image as a Windows icon (.ico) file in memory, producing the same bytes PixelImage.SaveAsIco writes to disk.

簽名
轉為 ICO 位元組 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Ico Image Writer Options
byte[] ToIcoBytes(
    PixelImage Pixel Image,
    IcoImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Ico Image Writer Options—Encoder settings; null uses the defaults.

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為 JPEG 位元組

函數

Encodes the image as a baseline JPEG (.jpg) file in memory, producing the same bytes PixelImage.SaveAsJpeg writes to disk.

簽名
轉為 JPEG 位元組 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Jpeg Image Writer Options
byte[] ToJpegBytes(
    PixelImage Pixel Image,
    JpegImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Jpeg Image Writer Options—Encoder settings; null uses the defaults.

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為 PNM 位元組

函數

Encodes the image as a Netpbm (.ppm/.pgm/.pbm) file in memory, producing the same bytes PixelImage.SaveAsPortableAnyMap writes to disk.

簽名
轉為 PNM 位元組 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Portable Any Map Image Writer Options
byte[] ToPortableAnyMapBytes(
    PixelImage Pixel Image,
    PortableAnyMapImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Portable Any Map Image Writer Options—Encoder settings; null uses the defaults.

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為 PFM 位元組

函數

Encodes the image as a Portable FloatMap (.pfm) file in memory, producing the same bytes PixelImage.SaveAsPortableFloatMap writes to disk.

簽名
轉為 PFM 位元組 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Portable Float Map Image Writer Options
byte[] ToPortableFloatMapBytes(
    PixelImage Pixel Image,
    PortableFloatMapImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Portable Float Map Image Writer Options—Encoder settings; null uses the defaults.

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為 QOI 位元組

函數

Encodes the image as a Quite OK Image (.qoi) file in memory, producing the same bytes PixelImage.SaveAsQoi writes to disk.

簽名
轉為 QOI 位元組 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Qoi Image Writer Options
byte[] ToQoiBytes(
    PixelImage Pixel Image,
    QoiImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Qoi Image Writer Options—Encoder settings; null uses the defaults.

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為 TGA 位元組

函數

Encodes the image as a Truevision TGA (.tga) file in memory, producing the same bytes PixelImage.SaveAsTga writes to disk.

簽名
轉為 TGA 位元組 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Tga Image Writer Options
byte[] ToTgaBytes(
    PixelImage Pixel Image,
    TgaImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Tga Image Writer Options—Encoder settings; null uses the defaults.

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為緊湊 RGBA 位元組

函數

Low-level interop conversion.

簽名
轉為緊湊 RGBA 位元組(Pixel Image: Pixel Image) -> 位元組陣列
byte[] ToTightlyPackedRgbaBytes(PixelImage Pixel Image)

參數

名稱型別預設值說明
Pixel ImagePixel Image—

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

轉為 WebP 位元組

函數

Encodes the image as a WebP (.webp) file in memory, producing the same bytes PixelImage.SaveAsWebP writes to disk.

簽名
轉為 WebP 位元組 -> 位元組陣列
    Pixel Image: Pixel Image
    選項: Web P Image Writer Options
byte[] ToWebPBytes(
    PixelImage Pixel Image,
    WebPImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
選項Web P Image Writer Options—Encoder settings; null uses the defaults.

返回

結果位元組陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

更新顏色資料

函數

Replaces the image's pixel rows with whatever the updater returns, given the current rows.

簽名
更新顏色資料
    Pixel Image: Pixel Image
    更新函數: Func<顏色陣列陣列, 顏色陣列陣列>
void UpdateColorData(
    PixelImage Pixel Image,
    Func<ColorElement[][], ColorElement[][]> updater)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
更新函數Func<顏色陣列陣列, 顏色陣列陣列>—A function from the current [row][column] pixel grid to the new one.

備註

The updater receives the live pixel array, not a copy, so it may edit it in place and return it. PixelImage.Columns and PixelImage.Rows are not changed, so the returned grid should keep the same size.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入 BMP

函數

Encodes the image as a Windows bitmap (.bmp) file into a stream, starting at its current position; the stream is left open.

簽名
寫入 BMP
    Pixel Image: Pixel Image
    流式輸出: Stream
    選項: Bmp Image Writer Options
void WriteBmp(
    PixelImage Pixel Image,
    Stream stream,
    BmpImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—A writable stream to receive the file.
選項Bmp Image Writer Options—Encoder settings; null uses the defaults.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入 GIF

函數

Encodes the image as a GIF file into a stream, starting at its current position; the stream is left open.

簽名
寫入 GIF
    Pixel Image: Pixel Image
    流式輸出: Stream
    選項: Gif Image Writer Options
void WriteGif(
    PixelImage Pixel Image,
    Stream stream,
    GifImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—A writable stream to receive the file.
選項Gif Image Writer Options—Encoder settings; null uses the defaults.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入 ICO

函數

Encodes the image as a Windows icon (.ico) file into a stream, starting at its current position; the stream is left open.

簽名
寫入 ICO
    Pixel Image: Pixel Image
    流式輸出: Stream
    選項: Ico Image Writer Options
void WriteIco(
    PixelImage Pixel Image,
    Stream stream,
    IcoImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—A writable stream to receive the file.
選項Ico Image Writer Options—Encoder settings; null uses the defaults.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入 JPEG

函數

Encodes the image as a baseline JPEG (.jpg) file into a stream, starting at its current position; the stream is left open.

簽名
寫入 JPEG
    Pixel Image: Pixel Image
    流式輸出: Stream
    選項: Jpeg Image Writer Options
void WriteJpeg(
    PixelImage Pixel Image,
    Stream stream,
    JpegImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—A writable stream to receive the file.
選項Jpeg Image Writer Options—Encoder settings; null uses the defaults.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入 PNM

函數

Encodes the image as a Netpbm (.ppm/.pgm/.pbm) file into a stream, starting at its current position; the stream is left open.

簽名
寫入 PNM
    Pixel Image: Pixel Image
    流式輸出: Stream
    選項: Portable Any Map Image Writer Options
void WritePortableAnyMap(
    PixelImage Pixel Image,
    Stream stream,
    PortableAnyMapImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—A writable stream to receive the file.
選項Portable Any Map Image Writer Options—Encoder settings; null uses the defaults.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入 PFM

函數

Encodes the image as a Portable FloatMap (.pfm) file into a stream, starting at its current position; the stream is left open.

簽名
寫入 PFM
    Pixel Image: Pixel Image
    流式輸出: Stream
    選項: Portable Float Map Image Writer Options
void WritePortableFloatMap(
    PixelImage Pixel Image,
    Stream stream,
    PortableFloatMapImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—A writable stream to receive the file.
選項Portable Float Map Image Writer Options—Encoder settings; null uses the defaults.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入 QOI

函數

Encodes the image as a Quite OK Image (.qoi) file into a stream, starting at its current position; the stream is left open.

簽名
寫入 QOI
    Pixel Image: Pixel Image
    流式輸出: Stream
    選項: Qoi Image Writer Options
void WriteQoi(
    PixelImage Pixel Image,
    Stream stream,
    QoiImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—A writable stream to receive the file.
選項Qoi Image Writer Options—Encoder settings; null uses the defaults.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入 TGA

函數

Encodes the image as a Truevision TGA (.tga) file into a stream, starting at its current position; the stream is left open.

簽名
寫入 TGA
    Pixel Image: Pixel Image
    流式輸出: Stream
    選項: Tga Image Writer Options
void WriteTga(
    PixelImage Pixel Image,
    Stream stream,
    TgaImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—A writable stream to receive the file.
選項Tga Image Writer Options—Encoder settings; null uses the defaults.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入流

函數

Writes the image in Divooka's binary form: four 32-bit integers (format version 1, width, height, payload length in bytes) followed by the tightly packed RGBA pixels, row by row from the top.

簽名
寫入流(Pixel Image: Pixel Image, 寫入器: BinaryWriter) -> 大整數
long WriteToStream(PixelImage Pixel Image, BinaryWriter writer)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
寫入器BinaryWriter—The writer to append to.

返回

結果大整數
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

寫入 WebP

函數

Encodes the image as a WebP (.webp) file into a stream, starting at its current position; the stream is left open.

簽名
寫入 WebP
    Pixel Image: Pixel Image
    流式輸出: Stream
    選項: Web P Image Writer Options
void WriteWebP(
    PixelImage Pixel Image,
    Stream stream,
    WebPImageWriterOptions options)

參數

名稱型別預設值說明
Pixel ImagePixel Image—
流式輸出Stream—A writable stream to receive the file.
選項Web P Image Writer Options—Encoder settings; null uses the defaults.
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

分配像素

函數

Allocates a new [row][column] pixel grid of the given size, filled with one color.

簽名
分配像素(寬度: 整數, 高度: 整數, 顏色: 可選顏色) -> 顏色陣列陣列
ColorElement[][] AllocatePixels(
    int width,
    int height,
    ColorElement? color)

參數

名稱型別預設值說明
寬度整數—Number of pixels in each row.
高度整數—Number of rows.
顏色可選顏色—The fill color; null leaves every pixel transparent black (all channels 0).

返回

結果顏色陣列陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從平鋪陣列生成

函數

Creates an image from a single array of pixels laid out row by row from the top-left corner, the inverse of PixelImage.ToFlatArray.

簽名
從平鋪陣列生成 -> Pixel Image
    寬度: 整數
    高度: 整數
    平面值: 顏色陣列
PixelImage FromFlatArray(
    int width,
    int height,
    ColorElement[] flat)

參數

名稱型別預設值說明
寬度整數—Number of columns, in pixels.
高度整數—Number of rows, in pixels.
平面值顏色陣列—Exactly Width × Height pixels; the first Width are the top row.

返回

結果Pixel Image

備註

The pixels are copied, so later changes to Flat do not affect the image.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從打包整數像素生成

函數

Creates an image from rows of 32-bit packed pixels, one uint per pixel, indexed [row][column].

簽名
從打包整數像素生成(打包像素: 正整數陣列陣列) -> Pixel Image
PixelImage FromPackedIntPixels(uint[][] packedPixels)

參數

名稱型別預設值說明
打包像素正整數陣列陣列—The packed pixels, row-major, every row as long as the first.

返回

結果Pixel Image

備註

Each value is split into bytes in the machine's byte order and read as red, green, blue, alpha, so on little-endian hardware the lowest byte is red and the highest is alpha (0xAABBGGRR). The width is taken from the first row, and the values are copied into a new pixel grid.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從打包 RGBA 位元組生成

函數

過載 1/2

簽名
從打包 RGBA 位元組生成 -> Pixel Image
    寬度: 整數
    高度: 整數
    原始位元組: 位元組陣列
PixelImage FromPackedRGBABytes(
    int width,
    int height,
    byte[] rawBytes)

Creates an image from tightly packed RGBA bytes, four per pixel (red, green, blue, alpha), row by row from the top-left corner with no padding.

參數

名稱型別預設值說明
寬度整數—Number of columns, in pixels.
高度整數—Number of rows, in pixels.
原始位元組位元組陣列—Exactly Width × Height × 4 bytes.

返回

結果Pixel Image

備註

The bytes are copied, so later changes to Raw Bytes do not affect the image. A height of 0 gives an empty image.

過載 2/2

簽名
從打包 RGBA 位元組生成 -> Pixel Image
    RGBA: 位元組陣列
    寬度: 整數
    高度: 整數
PixelImage FromPackedRGBABytes(
    byte[] rgba,
    int width,
    int height)

Legacy overload; Pending consolidation.

參數

名稱型別預設值說明
RGBA位元組陣列—
寬度整數—
高度整數—

返回

結果Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從 URI 載入

函數

Loads an image from a file path or a web address, in any format PixelImage.LoadFromFile accepts.

簽名
從 URI 載入(URI: Uri) -> Pixel Image
PixelImage FromUri(Uri uri)

參數

名稱型別預設值說明
URIUri—A relative path, a file URI, or an http/https URL.

返回

結果Pixel Image

備註

A relative URI is resolved against the current working directory and a file URI is read from disk. An http or https URI is downloaded in full, synchronously, before decoding.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

取得臨時影像路徑

函數

此節點沒有文件說明。

簽名
取得臨時影像路徑() -> 文字
string GetTempImagePath()

返回

結果文字

備註

Should only be used for really getting a temp image path and no longer used for conversion.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

初始化黑色影像

函數

Initialize image with some color

簽名
初始化黑色影像 -> Pixel Image
    寬度: 整數
    高度: 整數
    顏色: 可選顏色
PixelImage InitializeBlackImage(
    int width,
    int height,
    ColorElement? color)

參數

名稱型別預設值說明
寬度整數—
高度整數—
顏色可選顏色—

返回

結果Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從位元組初始化

函數

Rebuilds an image from bytes produced by PixelImage.SerializeIntoBytes.

簽名
從位元組初始化(資料: 位元組陣列) -> Pixel Image
PixelImage InitializeFromBytes(byte[] data)

參數

名稱型別預設值說明
資料位元組陣列—The serialized image.

返回

結果Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從檔案載入

函數

Load from PNG file.
In reality, supports wider range of input options than PixelImage.LoadFromFile.

簽名
從檔案載入(路徑: 文字) -> Pixel Image
PixelImage LoadFromFile(string path)

參數

名稱型別預設值說明
路徑文字—

返回

結果Pixel Image

備註

Though officially we support only PNG file on Image.PixelImage; In practice this can load more than that.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從檔案緩衝區載入

函數

此節點沒有文件說明。

簽名
從檔案緩衝區載入(檔案資料: 位元組陣列) -> Pixel Image
PixelImage LoadFromFileBuffer(byte[] fileData)

參數

名稱型別預設值說明
檔案資料位元組陣列—Png, jpg, bmp, webp... Anything you like!

返回

結果Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從文字載入

函數

Rebuilds an image from Base64 text produced by PixelImage.SaveAsText.

簽名
從文字載入(文字: 文字) -> Pixel Image
PixelImage LoadFromText(string text)

參數

名稱型別預設值說明
文字文字—The Base64 text.

返回

結果Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從檔案緩衝區載入打包 RGBA

函數

Decodes an image straight to tightly packed RGBA bytes, row zero first, without building
a Image.PixelImage on the way.

簽名
從檔案緩衝區載入打包 RGBA(檔案資料: 位元組陣列) -> (結果: 位元組陣列, 寬度: 整數, 高度: 整數)
byte[] LoadPackedRgbaFromFileBuffer(
    byte[] fileData,
    out int width,
    out int height)

參數

名稱型別預設值說明
檔案資料位元組陣列—Png, jpg, bmp, webp... Anything PixelImage.LoadFromFileBuffer takes.

返回

結果位元組陣列
寬度整數
高度整數
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

從流讀取

函數

Reads an image written by PixelImage.WriteToStream, leaving the reader just past it.

簽名
從流讀取(讀取器: BinaryReader) -> (結果: 大整數, 值: Pixel Image)
long ReadFromStream(BinaryReader reader, out PixelImage value)

參數

名稱型別預設值說明
讀取器BinaryReader—The reader positioned at the image.

返回

結果大整數
值Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理

儲存原始資料

函數

Compact fast raw data dump that writes a tiny header (magic + version + width + height) followed by tightly packed RGBA bytes for every pixel in row-major order.

簽名
儲存原始資料
    路徑: 文字
    像素: 顏色陣列陣列
    寬度: 整數
    高度: 整數
void SaveRaw(
    string path,
    ColorElement[][] pixels,
    int width,
    int height)

參數

名稱型別預設值說明
路徑文字—
像素顏色陣列陣列—
寬度整數—
高度整數—

備註

It uses MemoryMarshal.AsBytes so we avoid per-pixel copying.

### Format summary

**Header (9 bytes total):**
* `PXLR` (ASCII)
* `1` (byte: format version)
* `width` (Int32, little-endian)
* `height` (Int32, little-endian)

**Data:** `height` rows × `width` pixels × **4 bytes per pixel** (R, G, B, A), no padding.

所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
像素影像
所屬包
影像處理