image.core\types\image_types.mbt
38.5% · 5 / 13 points · 532 linesBackground color reports the state of each line. Underlined characters mark exact instrumented byte offsets; hover them to inspect the visit count.
- 1
///| - 2
/// # 核心图像类型 Core Image Types - 3
/// - 4
/// 图像处理库的核心类型定义,提供 8-bit / 16-bit / float 三种像素精度的图像值对象、统一错误类型、格式枚举,以及安全算术函数的公开别名。 Core type definitions for the image processing library, providing 8-bit / 16-bit / float pixel precision image value objects, unified error type, format enum, and public aliases for safe arithmetic functions. - 5
- 6
/// - 7
/// 核心类型 Core types: - 8
/// - `Image` - 8-bit 无符号像素图像 8-bit unsigned pixel image - 9
/// - `Image16` - 16-bit 无符号像素图像 16-bit unsigned pixel image - 10
/// - `ImageF` - 32-bit IEEE float 像素图像 32-bit IEEE float pixel image - 11
/// - `ImageInfo` - 图像几何信息(无像素数据)Image geometry info (no pixel data) - 12
/// - `AnyImage` - 统一图像容器 Unified image container - 13
/// - `GifAnimation` - GIF 动画解码结果 GIF animation decode result - 14
/// - `PngAnimation` - APNG 动画解码结果 APNG animation decode result - 15
/// - `LoadError` - 加载/解码/编码错误 Load/decode/encode error - 16
/// - `ImageFormat` - 图像格式枚举 Image format enum - 17
/// - 18
/// 核心函数 Core functions: - 19
/// - `check_dims` - 校验图像维度安全 Validate image dimension safety - 20
/// - `dims_valid_check` - 纯函数维度校验 Pure function dimension validation - 21
/// - `safe_mul` / `safe_mul3` - 溢出安全乘法 Overflow-safe multiplication - 22
/// - `clamp_pixel_value` / `clamp_byte` / `clamp_coord` - 钳制函数 Clamp functions - 23
/// - 24
/// 依赖 Dependencies: - 25
/// - `walkzzz/image.core/safe_math` - 安全算术与形式化证明 Safe arithmetic with formal proofs - 26
- 27
///| - 28
/// 解码结果值对象,承载图像几何元信息与像素数据(8-bit 无符号像素) Decoded image value object carrying geometry metadata and pixel data (8-bit unsigned pixels) - 29
/// - 30
/// 像素数据存储在 `data` 字段中,按行优先排列,每像素 `channels` 个字节。典型通道数:1(灰度)、3(RGB)、4(RGBA)。 Pixel data is stored in the `data` field, row-major, with `channels` bytes per pixel. Typical channel counts: 1 (grayscale), 3 (RGB), 4 (RGBA). - 31
- 32
///| - 33
/// 字段 Fields: - 34
/// - `width` - 图像宽度(像素)Image width in pixels - 35
/// - `height` - 图像高度(像素)Image height in pixels - 36
/// - `channels` - 通道数(1/3/4)Number of channels (1/3/4) - 37
/// - `data` - 像素数据(长度 = width * height * channels)Pixel data (length = width * height * channels) - 38
#derive(Eq, @debug.Debug) - 39
pub(all) struct Image { - 40
width : Int32 - 41
height : Int32 - 42
channels : Int32 - 43
data : Bytes - 44
} - 45
- 46
///| - 47
pub extend Image with @debug.Debug::{to_repr} - 48
- 49
///| - 50
pub extend Image with Eq::{not_equal, equal} - 51
- 52
///| - 53
/// 16-bit 解码结果值对象,像素数据为 16-bit 无符号整数(little-endian,每像素 2 字节) 16-bit decoded image value object, pixel data as 16-bit unsigned integers (little-endian, 2 bytes per pixel) - 54
/// - 55
/// 字段 Fields: - 56
/// - `width` - 图像宽度(像素)Image width in pixels - 57
/// - `height` - 图像高度(像素)Image height in pixels - 58
/// - `channels` - 通道数(1/3/4)Number of channels (1/3/4) - 59
/// - `data` - 像素数据(长度 = width * height * channels * 2)Pixel data (length = width * height * channels * 2) - 60
#derive(Eq, @debug.Debug) - 61
pub(all) struct Image16 { - 62
width : Int32 - 63
height : Int32 - 64
channels : Int32 - 65
data : Bytes - 66
} - 67
- 68
///| - 69
pub extend Image16 with @debug.Debug::{to_repr} - 70
- 71
///| - 72
pub extend Image16 with Eq::{not_equal, equal} - 73
- 74
///| - 75
/// HDR float 解码结果值对象,像素数据为 32-bit IEEE float(little-endian,每像素 4 字节) HDR float decoded image value object, pixel data as 32-bit IEEE float (little-endian, 4 bytes per pixel) - 76
/// - 77
/// 字段 Fields: - 78
/// - `width` - 图像宽度(像素)Image width in pixels - 79
/// - `height` - 图像高度(像素)Image height in pixels - 80
/// - `channels` - 通道数(1/3/4)Number of channels (1/3/4) - 81
/// - `data` - 像素数据(长度 = width * height * channels * 4)Pixel data (length = width * height * channels * 4) - 82
#derive(Eq, @debug.Debug) - 83
pub(all) struct ImageF { - 84
width : Int32 - 85
height : Int32 - 86
channels : Int32 - 87
data : Bytes - 88
} - 89
- 90
///| - 91
pub extend ImageF with @debug.Debug::{to_repr} - 92
- 93
///| - 94
pub extend ImageF with Eq::{not_equal, equal} - 95
- 96
///| - 97
/// 图像信息查询结果,仅含几何元信息,不加载像素数据 Image info query result, geometry metadata only, no pixel data loaded - 98
/// - 99
/// 字段 Fields: - 100
/// - `width` - 图像宽度(像素)Image width in pixels - 101
/// - `height` - 图像高度(像素)Image height in pixels - 102
/// - `channels` - 通道数(1/3/4)Number of channels (1/3/4) - 103
#derive(Eq, @debug.Debug) - 104
pub(all) struct ImageInfo { - 105
width : Int32 - 106
height : Int32 - 107
channels : Int32 - 108
} - 109
- 110
///| - 111
pub extend ImageInfo with @debug.Debug::{to_repr} - 112
- 113
///| - 114
pub extend ImageInfo with Eq::{not_equal, equal} - 115
- 116
///| - 117
/// 动画 GIF 解码结果,包含多帧图像和每帧延迟(毫秒) Animated GIF decode result, containing multiple frames and per-frame delays (milliseconds) - 118
/// - 119
/// 字段 Fields: - 120
/// - `frames` - 帧图像数组 Array of frame images - 121
/// - `delays` - 每帧延迟时间(毫秒)Per-frame delay in milliseconds - 122
#derive(Eq, @debug.Debug) - 123
pub(all) struct GifAnimation { - 124
frames : Array[Image] - 125
delays : Array[Int32] - 126
} - 127
- 128
///| - 129
pub extend GifAnimation with @debug.Debug::{to_repr} - 130
- 131
///| - 132
pub extend GifAnimation with Eq::{not_equal, equal} - 133
- 134
///| - 135
/// 加载失败领域错误 Load error domain type - 136
/// - 137
/// 变体 Variants: - 138
/// - `FileIO(String)` - 文件 I/O 错误 File I/O error - 139
/// - `UnsupportedFormat(String)` - 不支持的图像格式 Unsupported image format - 140
/// - `DecodeFailed(String)` - 解码失败 Decode failure - 141
/// - `EncodeFailed(String)` - 编码失败 Encode failure - 142
pub(all) suberror LoadError { - 143
FileIO(String) - 144
UnsupportedFormat(String) - 145
DecodeFailed(String) - 146
EncodeFailed(String) - 147
} - 148
- 149
///| - 150
/// `LoadError` 实现 `Show` — 分类前缀 + 消息,使 `"\{err}"` 插值与 `inspect` 开箱可用(下游调试体验)。 - 151
/// `LoadError` implements `Show` — category prefix + message, making interpolation and `inspect` work out of the box. - 152
pub impl Show for LoadError with fn output(self, logger) { - 153○
logger.write_string( - 154○
match self { - 155○
FileIO(msg) => "FileIO: \{msg}" - 156○
UnsupportedFormat(msg) => "UnsupportedFormat: \{msg}" - 157○
DecodeFailed(msg) => "DecodeFailed: \{msg}" - 158○
EncodeFailed(msg) => "EncodeFailed: \{msg}" - 159
}, - 160
) - 161
} - 162
- 163
///| - 164
/// 补齐 `Show` 的 `to_string` 派生方法。Add the derived `to_string` from `Show`. - 165
pub extend LoadError with Show::{output, to_string} - 166
- 167
///| - 168
/// 图像格式枚举 Image format enum - 169
/// - 170
/// 标识支持的图像编解码格式。`#non_exhaustive` 表示未来可能添加新格式。 - 171
/// Identifies supported image codec formats. `#non_exhaustive` means new formats may be added in the future. - 172
#derive(Eq, @debug.Debug) - 173
#non_exhaustive - 174
pub(all) enum ImageFormat { - 175
Png - 176
Jpeg - 177
Bmp - 178
Gif - 179
Tga - 180
Psd - 181
Hdr - 182
Pnm - 183
Qoi - 184
Webp - 185
Tiff - 186
Ico - 187
Cur - 188
Icns - 189
Apng - 190
Avif - 191
Heif - 192
JpegXl - 193
Unknown - 194
} - 195
- 196
///| - 197
pub extend ImageFormat with @debug.Debug::{to_repr} - 198
- 199
///| - 200
pub extend ImageFormat with Eq::{not_equal, equal} - 201
- 202
///| - 203
/// resize 滤波器类型 Resize filter type - 204
/// - 205
/// 用于图像缩放时的插值算法选择。 Selects interpolation algorithm for image resizing. - 206
/// `#non_exhaustive` 表示未来可能添加新构造器 - 207
#derive(Eq, @debug.Debug) - 208
#non_exhaustive - 209
pub(all) enum ResizeFilter { - 210
Default - 211
Box - 212
Triangle - 213
CubicBSPline - 214
CatmullROM - 215
Mitchell - 216
PointSample - 217
} - 218
- 219
///| - 220
pub extend ResizeFilter with @debug.Debug::{to_repr} - 221
- 222
///| - 223
pub extend ResizeFilter with Eq::{not_equal, equal} - 224
- 225
///| - 226
/// resize 边缘处理模式 Resize edge handling mode - 227
/// - 228
/// 定义图像缩放时如何处理超出边界的像素坐标。 Defines how pixel coordinates beyond image boundaries are handled during resizing. - 229
/// `#non_exhaustive` 表示未来可能添加新构造器 - 230
#derive(Eq, @debug.Debug) - 231
#non_exhaustive - 232
pub(all) enum ResizeEdge { - 233
Clamp - 234
Reflect - 235
Wrap - 236
Zero - 237
} - 238
- 239
///| - 240
pub extend ResizeEdge with @debug.Debug::{to_repr} - 241
- 242
///| - 243
pub extend ResizeEdge with Eq::{not_equal, equal} - 244
- 245
///| - 246
/// APNG 动画解码结果 APNG animation decode result - 247
/// - 248
/// 字段 Fields: - 249
/// - `frames` - 帧图像数组 Array of frame images - 250
/// - `delays` - 每帧延迟时间(毫秒)Per-frame delay in milliseconds - 251
#derive(Eq, @debug.Debug) - 252
pub(all) struct PngAnimation { - 253
frames : Array[Image] - 254
delays : Array[Int32] // 毫秒 - 255
} - 256
- 257
///| - 258
pub extend PngAnimation with @debug.Debug::{to_repr} - 259
- 260
///| - 261
pub extend PngAnimation with Eq::{not_equal, equal} - 262
- 263
///| - 264
/// 图像维度上限(单边最大像素数) Maximum image dimension limit (max pixels per side) - 265
/// - 266
/// 防止恶意图像声明超大尺寸导致 OOM 或整数溢出。 Prevents malicious images from declaring oversized dimensions causing OOM or integer overflow. - 267
/// 65535 覆盖常见图像格式最大尺寸(PNG/TIFF 32-bit、JPEG 65500、BMP 32-bit)。 65535 covers max sizes of common formats (PNG/TIFF 32-bit, JPEG 65500, BMP 32-bit). - 268
pub const MAX_IMAGE_DIMENSION : Int32 = 65535 - 269
- 270
///| 总像素数上限 — 维度守卫之上的内存安全闸门(发起人确认取值 5e8)。 - 271
- 272
///| 内存峰值:RGB 3 通道 ≈ 1.5 GB / ImageF HDR float 3 通道 ≈ 12 GB。 - 273
- 274
///| Total pixel budget — memory-safety gate on top of per-dimension guards - 275
- 276
///| - 277
/// (confirmed value 5e8; peak memory: RGB ≈ 1.5 GB, ImageF HDR ≈ 12 GB). - 278
pub const MAX_TOTAL_PIXELS : Int32 = 500000000 - 279
- 280
///| - 281
/// 校验图像维度是否在安全范围内。 Validate image dimensions are within safe bounds. - 282
/// - 283
/// 检查 width/height 为正数且不超过 MAX_IMAGE_DIMENSION,且 width * height * channels 不超过 Int 最大值(防溢出)。 Checks width/height are positive and do not exceed MAX_IMAGE_DIMENSION, and width * height * channels does not overflow Int (prevents overflow). - 284
- 285
///| - 286
/// 参数 Parameters: - 287
/// - `width` - 图像宽度 Image width - 288
/// - `height` - 图像高度 Image height - 289
/// - `channels` - 通道数 Number of channels - 290
/// - 291
/// 错误 Errors: - 292
/// - `LoadError::DecodeFailed` - 维度无效、超过上限或溢出 Invalid dimensions, exceeds limit, or overflow - 293
/// - 294
/// 示例 Example: - 295
/// ```mbt check - 296
/// test "doc_check_dims_valid" { - 297
/// @types.check_dims(1, 1, 3) - 298
/// assert_true(true) - 299
/// } - 300
/// ``` - 301
/// - 302
/// ```mbt check - 303
/// test "doc_check_dims_total_pixels_ok" { - 304
/// @types.check_dims(25000, 20000, 3) // 5e8 边界内(总像素上限 5 亿) - 305
/// assert_true(true) - 306
/// } - 307
/// ``` - 308
/// - 309
/// ```mbt check - 310
/// test "doc_check_dims_total_pixels_exceeded" { - 311
/// try { - 312
/// @types.check_dims(25001, 20000, 3) // 500,020,000 > 5e8 - 313
/// assert_true(false) - 314
/// } catch { - 315
/// @types.LoadError::DecodeFailed(_) => assert_true(true) - 316
/// _ => assert_true(false) - 317
/// } - 318
/// } - 319
/// ``` - 320
pub fn check_dims( - 321
width : Int32, - 322
height : Int32, - 323
channels : Int32, - 324
) -> Unit raise LoadError { - 325●
if width <= 0 || height <= 0 || channels <= 0 { - 326●
raise LoadError::DecodeFailed( - 327
"图像尺寸无效: width=\{width}, height=\{height}, channels=\{channels}", - 328
) - 329
} - 330
if width > MAX_IMAGE_DIMENSION || height > MAX_IMAGE_DIMENSION { - 331●
raise LoadError::DecodeFailed( - 332
"图像尺寸超过上限 \{MAX_IMAGE_DIMENSION}: width=\{width}, height=\{height}", - 333
) - 334
} - 335
// 检查 width * height * channels 是否溢出 - 336
// Int 在 wasm/native 为 32 位有符号,最大值 2147483647 - 337
// 先算 width * height,再乘 channels - 338
let max_int = 2147483647 - 339
if width > max_int / height { - 340●
raise LoadError::DecodeFailed( - 341
"图像像素总数溢出: \{width} * \{height}", - 342
) - 343
} - 344
let pixel_count = width * height - 345
if pixel_count > MAX_TOTAL_PIXELS { - 346●
raise LoadError::DecodeFailed( - 347
"图像像素总数超过内存安全上限 \{MAX_TOTAL_PIXELS}: \{pixel_count} 像素(\{pixel_count / 1000000} M pixels) Total pixels exceed the memory-safety budget", - 348
) - 349
} - 350
if pixel_count > max_int / channels { - 351○
raise LoadError::DecodeFailed( - 352
"图像数据大小溢出: \{pixel_count} * \{channels}", - 353
) - 354
} - 355
} - 356
- 357
///| - 358
/// 判断维度是否在安全范围内(纯函数,可用于证明前提)。 Check if dimensions are within safe bounds (pure function, usable as proof precondition). - 359
/// - 360
/// 返回 true 当且仅当 width/height/channels 均为正、不超过 MAX_IMAGE_DIMENSION、且乘积不溢出 Int32。 Returns true iff width/height/channels are all positive, do not exceed MAX_IMAGE_DIMENSION, and product does not overflow Int32. - 361
- 362
///| - 363
/// 参数 Parameters: - 364
/// - `w` - 宽度 Width - 365
/// - `h` - 高度 Height - 366
/// - `c` - 通道数 Channels - 367
/// - 368
/// 返回 Return: - 369
/// - 维度是否合法 Whether dimensions are valid - 370
pub let dims_valid_check : (Int32, Int32, Int32) -> Bool = @safe_math.dims_valid_check - 371
- 372
///| - 373
/// 安全乘法:返回 a * b,溢出时返回 None。 Safe multiplication: returns a * b, or None on overflow. - 374
/// - 375
/// 用于在分配大数组前检查是否会溢出。 Used to check for overflow before allocating large arrays. - 376
/// 实际实现和形式化证明在 core/safe_math 包中。 Actual implementation and formal proof are in the core/safe_math package. - 377
/// - 378
/// 参数 Parameters: - 379
/// - `a` - 乘数 Multiplicand - 380
/// - `b` - 乘数 Multiplier - 381
/// - 382
/// 返回 Return: - 383
/// - `Some(result)` - 乘积 The product - 384
/// - `None` - 溢出 Overflow occurred - 385
pub let safe_mul : (Int32, Int32) -> Int32? = @safe_math.safe_mul - 386
- 387
///| - 388
/// 安全三参数乘法:返回 a * b * c,溢出时返回 None。 Safe three-argument multiplication: returns a * b * c, or None on overflow. - 389
/// - 390
/// 常用于计算 w * h * channels 的数组大小。 Commonly used to compute array size as w * h * channels. - 391
/// 实际实现和形式化证明在 core/safe_math 包中。 Actual implementation and formal proof are in the core/safe_math package. - 392
/// - 393
/// 参数 Parameters: - 394
/// - `a` - 第一乘数 First multiplicand - 395
/// - `b` - 第二乘数 Second multiplicand - 396
/// - `c` - 第三乘数 Third multiplicand - 397
/// - 398
/// 返回 Return: - 399
/// - `Some(result)` - 乘积 The product - 400
/// - `None` - 溢出 Overflow occurred - 401
pub let safe_mul3 : (Int32, Int32, Int32) -> Int32? = @safe_math.safe_mul3 - 402
- 403
///| - 404
/// 通用整数钳制:将 v 限制在 [lo, hi] 范围内。 General integer clamp: constrains v to [lo, hi] range. - 405
/// - 406
/// 实际实现在 core/safe_math 包中。 Actual implementation is in the core/safe_math package. - 407
/// - 408
/// 参数 Parameters: - 409
/// - `v` - 输入值 Input value - 410
/// - `lo` - 下界 Lower bound - 411
/// - `hi` - 上界 Upper bound - 412
/// - 413
/// 返回 Return: - 414
/// - 钳制后的值 Clamped value - 415
pub let clamp_int : (Int32, Int32, Int32) -> Int32 = @safe_math.clamp_int - 416
- 417
///| - 418
/// 像素值钳制:将 value 限制在 [0, 255] 范围内。 Pixel value clamp: constrains value to [0, 255] range. - 419
/// - 420
/// 实际实现和形式化证明在 core/safe_math 包中。 Actual implementation and formal proof are in the core/safe_math package. - 421
/// - 422
/// 参数 Parameters: - 423
/// - `value` - 输入像素值 Input pixel value - 424
/// - 425
/// 返回 Return: - 426
/// - 钳制后的像素值(0-255)Clamped pixel value (0-255) - 427
pub let clamp_pixel_value : (Int32) -> Int32 = @safe_math.clamp_pixel_value - 428
- 429
///| - 430
/// 字节钳制:将 Int32 值限制在 [0, 255] 并转为 Byte。 Byte clamp: constrains Int32 value to [0, 255] and converts to Byte. - 431
/// - 432
/// 等价于 clamp_pixel_value(v).to_byte(),用于像素赋值。 Equivalent to clamp_pixel_value(v).to_byte(), used for pixel assignment. - 433
/// 实际实现在 core/safe_math 包中。 Actual implementation is in the core/safe_math package. - 434
/// - 435
/// 参数 Parameters: - 436
/// - `v` - 输入值 Input value - 437
/// - 438
/// 返回 Return: - 439
/// - 钳制后的字节 Clamped byte - 440
pub let clamp_byte : (Int32) -> Byte = @safe_math.clamp_byte - 441
- 442
///| - 443
/// 坐标钳制:将坐标 v 限制在 [0, max_val-1] 范围内。 Coordinate clamp: constrains coordinate v to [0, max_val-1] range. - 444
/// - 445
/// 用于图像像素坐标的边界检查。 Used for boundary checking of image pixel coordinates. - 446
/// 实际实现在 core/safe_math 包中。 Actual implementation is in the core/safe_math package. - 447
/// - 448
/// 参数 Parameters: - 449
/// - `v` - 坐标值 Coordinate value - 450
/// - `max_val` - 最大值(上限为 max_val-1)Maximum value (upper bound is max_val-1) - 451
/// - 452
/// 返回 Return: - 453
/// - 钳制后的坐标 Clamped coordinate - 454
pub let clamp_coord : (Int32, Int32) -> Int32 = @safe_math.clamp_coord - 455
- 456
///| - 457
/// 浮点钳制:将 Float 值 v 限制在 [lo, hi] 范围内。 Float clamp: constrains Float value v to [lo, hi] range. - 458
/// - 459
/// 用于 16-bit/float 图像处理的范围约束。 Used for range constraints in 16-bit/float image processing. - 460
/// 实际实现在 core/safe_math 包中。 Actual implementation is in the core/safe_math package. - 461
/// - 462
/// 参数 Parameters: - 463
/// - `v` - 输入值 Input value - 464
/// - `lo` - 下界 Lower bound - 465
/// - `hi` - 上界 Upper bound - 466
/// - 467
/// 返回 Return: - 468
/// - 钳制后的值 Clamped value - 469
pub let clamp_float : (Float, Float, Float) -> Float = @safe_math.clamp_float - 470
- 471
///| - 472
/// 双精度浮点钳制:将 Double 值 v 限制在 [lo, hi] 范围内。 Double clamp: constrains Double value v to [lo, hi] range. - 473
/// - 474
/// 用于高精度图像处理(HDR/频域)的范围约束。 Used for range constraints in high-precision image processing (HDR/frequency domain). - 475
/// 实际实现在 core/safe_math 包中。 Actual implementation is in the core/safe_math package. - 476
/// - 477
/// 参数 Parameters: - 478
/// - `v` - 输入值 Input value - 479
/// - `lo` - 下界 Lower bound - 480
/// - `hi` - 上界 Upper bound - 481
/// - 482
/// 返回 Return: - 483
/// - 钳制后的值 Clamped value - 484
pub let clamp_double : (Double, Double, Double) -> Double = @safe_math.clamp_double - 485
- 486
///| - 487
/// 整数最大值:返回 a 和 b 中较大的那个。 Integer maximum: returns the larger of a and b. - 488
/// - 489
/// 实际实现在 core/safe_math 包中。 Actual implementation is in the core/safe_math package. - 490
/// - 491
/// 参数 Parameters: - 492
/// - `a` - 第一个值 First value - 493
/// - `b` - 第二个值 Second value - 494
/// - 495
/// 返回 Return: - 496
/// - 较大值 The larger value - 497
pub let int_max : (Int32, Int32) -> Int32 = @safe_math.int_max - 498
- 499
///| - 500
/// 整数最小值:返回 a 和 b 中较小的那个。 Integer minimum: returns the smaller of a and b. - 501
/// - 502
/// 实际实现在 core/safe_math 包中。 Actual implementation is in the core/safe_math package. - 503
/// - 504
/// 参数 Parameters: - 505
/// - `a` - 第一个值 First value - 506
/// - `b` - 第二个值 Second value - 507
/// - 508
/// 返回 Return: - 509
/// - 较小值 The smaller value - 510
pub let int_min : (Int32, Int32) -> Int32 = @safe_math.int_min - 511
- 512
// ============================================================================ - 513
// Section: 文档测试数据常量 Doc test data constants - 514
// 供跨包文档测试复用的最小合法图像字节串。 - 515
// Minimal valid image byte strings for cross-package doc test reuse. - 516
// ============================================================================ - 517
- 518
///| - 519
/// 文档测试用 1×1 24-bit BMP 字节串(58 字节,红色像素 R=255 G=0 B=0) 1×1 24-bit BMP byte string for doc tests (58 bytes, red pixel R=255 G=0 B=0) - 520
pub const DOC_TEST_BMP_1X1 : Bytes = b"\x42\x4d\x3a\x00\x00\x00\x00\x00\x00\x00\x36\x00\x00\x00\x28\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x18\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00" - 521
- 522
///| - 523
/// 文档测试用 1×1 RGBA PNG 字节串(73 字节,红色像素 R=255 G=0 B=0 A=255) 1×1 RGBA PNG byte string for doc tests (73 bytes, red pixel R=255 G=0 B=0 A=255) - 524
pub const DOC_TEST_PNG_1X1_RGBA : Bytes = b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x01\x00\x00\x00\x01\x08\x06\x00\x00\x00\xeb\x89\x2f\x0b\x00\x00\x00\x10\x49\x44\x41\x54\x78\x01\x01\x05\x00\xfa\xff\x00\xff\x00\x00\xff\x05\x00\x01\xff\x0b\x15\xdf\x08\x00\x00\x00\x00\x49\x45\x4e\x44\xf0\x2b\x1d\x59" - 525
- 526
///| - 527
/// 文档测试用 1×1 RGB PNM (P6) 字节串(14 字节,红色像素 R=255 G=0 B=0) 1×1 RGB PNM (P6) byte string for doc tests (14 bytes, red pixel R=255 G=0 B=0) - 528
pub const DOC_TEST_PNM_1X1 : Bytes = b"P6\n1 1\n255\n\xff\x00\x00" - 529
- 530
///| - 531
/// 文档测试用 1×1 RGBA QOI 字节串(26 字节,红色像素 R=255 G=0 B=0 A=255) 1×1 RGBA QOI byte string for doc tests (26 bytes, red pixel R=255 G=0 B=0 A=255) - 532
pub const DOC_TEST_QOI_1X1 : Bytes = b"\x71\x6f\x69\x66\x00\x00\x00\x01\x00\x00\x00\x01\x04\x00\x00\xfe\x00\xff\x00\x00\x00\x00\x00\x00\x00\x01"