写出zbar_image_t结构体
时间: 2023-08-04 17:03:23 浏览: 60
以下是 `zbar_image_t` 结构体的定义,包含了该结构体的所有属性:
```c
typedef struct zbar_image_s {
unsigned long long int seq;
unsigned width, height;
unsigned char *data;
unsigned long datalen;
zbar_image_format_t format;
zbar_symbol_type_t type;
unsigned quality;
unsigned img_bound[4];
zbar_image_t *next;
} zbar_image_t;
```
其中,`zbar_image_s` 是结构体的名称,`zbar_image_t` 是该结构体的别名,方便在程序中使用。`seq` 表示图像的序列号,`width` 和 `height` 分别表示图像的宽度和高度,`data` 表示图像的数据,`datalen` 表示数据的长度,`format` 表示图像的格式,`type` 表示图像中包含的条码或二维码的类型,`quality` 表示图像的质量,`img_bound` 表示图像的边界,`next` 是指向下一个图像节点的指针。
相关问题
写出zbar_image_format_t
`zbar_image_format_t` 是 ZBar 库中表示图像格式的枚举类型,包括以下几种类型:
```c
typedef enum zbar_image_format_e {
ZBAR_NONE = 0, /**< no defined format */
ZBAR_PARTIAL = 1, /**< generic partial decode */
ZBAR_EAN2 = 2, /**< GS1 2-digit add-on */
ZBAR_EAN5 = 5, /**< GS1 5-digit add-on */
ZBAR_EAN8 = 8, /**< EAN-8 */
ZBAR_UPCE = 9, /**< UPC-E */
ZBAR_ISBN10 = 10, /**< ISBN-10 (from EAN-13). */
ZBAR_UPCA = 12, /**< UPC-A */
ZBAR_EAN13 = 13, /**< EAN-13 */
ZBAR_ISBN13 = 14, /**< ISBN-13 (from EAN-13). */
ZBAR_COMPOSITE = 15, /**< EAN/UPC composite */
ZBAR_I25 = 25, /**< Interleaved 2 of 5. */
ZBAR_CODE39 = 39, /**< Code 39. */
ZBAR_PDF417 = 57, /**< PDF417. */
ZBAR_QRCODE = 64, /**< QR Code. */
ZBAR_CODE128 = 128, /**< Code 128. */
ZBAR_SYMBOL = 0x00ff, /**< mask for base symbol type. */
ZBAR_ADDON2 = 0x0200, /**< 2-digit add-on flag. */
ZBAR_ADDON5 = 0x0500, /**< 5-digit add-on flag. */
ZBAR_ADDON = 0x0700, /**< add-on flag mask. */
} zbar_image_format_t;
```
其中,`ZBAR_NONE` 表示未定义的格式,`ZBAR_PARTIAL` 表示部分解码格式,`ZBAR_EAN2` 表示 GS1 2 位附加码格式,`ZBAR_EAN5` 表示 GS1 5 位附加码格式,`ZBAR_EAN8` 表示 EAN-8 格式,`ZBAR_UPCE` 表示 UPC-E 格式,`ZBAR_ISBN10` 表示 ISBN-10 格式,`ZBAR_UPCA` 表示 UPC-A 格式,`ZBAR_EAN13` 表示 EAN-13 格式,`ZBAR_ISBN13` 表示 ISBN-13 格式,`ZBAR_COMPOSITE` 表示 EAN/UPC 组合码格式,`ZBAR_I25` 表示 Interleaved 2 of 5 格式,`ZBAR_CODE39` 表示 Code 39 格式,`ZBAR_PDF417` 表示 PDF417 格式,`ZBAR_QRCODE` 表示 QR Code 格式,`ZBAR_CODE128` 表示 Code 128 格式,`ZBAR_SYMBOL` 表示基本符号类型的掩码,`ZBAR_ADDON2` 表示 2 位附加码的掩码,`ZBAR_ADDON5` 表示 5 位附加码的掩码,`ZBAR_ADDON` 表示附加码的掩码。
写出zbar_image_set_size函数
zbar_image_set_size函数的定义如下:
```c
void zbar_image_set_size(zbar_image_t *image,
unsigned width,
unsigned height);
```
该函数用于设置图像的宽度和高度。
参数说明:
- `image`:指向`zbar_image_t`结构体的指针,表示待设置大小的图像。
- `width`:图像的新宽度。
- `height`:图像的新高度。
调用示例:
```c
zbar_image_t *image = zbar_image_create();
zbar_image_set_size(image, 640, 480);
```
上述代码创建了一个大小为640x480的图像。