ホーム › Devices.ImageAcquisition › WIA_RAW_HEADER
WIA_RAW_HEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Tag | DWORD | 4 | +0 | +0 | RAWデータを識別するタグ値(マジックナンバー)。 |
| Version | DWORD | 4 | +4 | +4 | RAWヘッダーのバージョン番号。 |
| HeaderSize | DWORD | 4 | +8 | +8 | ヘッダー部のバイトサイズ。 |
| XRes | DWORD | 4 | +12 | +12 | 水平方向の解像度(DPI)。 |
| YRes | DWORD | 4 | +16 | +16 | 垂直方向の解像度(DPI)。 |
| XExtent | DWORD | 4 | +20 | +20 | 画像の幅(ピクセル)。 |
| YExtent | DWORD | 4 | +24 | +24 | 画像の高さ(ピクセル)。 |
| BytesPerLine | DWORD | 4 | +28 | +28 | 1ラインあたりのバイト数。 |
| BitsPerPixel | DWORD | 4 | +32 | +32 | 1ピクセルあたりのビット数。 |
| ChannelsPerPixel | DWORD | 4 | +36 | +36 | 1ピクセルあたりのチャンネル数。 |
| DataType | DWORD | 4 | +40 | +40 | ピクセルデータの型を示す値。 |
| BitsPerChannel | BYTE | 8 | +44 | +44 | 1チャンネルあたりのビット数。 |
| Compression | DWORD | 4 | +52 | +52 | 圧縮方式を示す値。 |
| PhotometricInterp | DWORD | 4 | +56 | +56 | 測光解釈(色の意味付け)を示す値。 |
| LineOrder | DWORD | 4 | +60 | +60 | ラインの並び順(トップダウン等)を示す値。 |
| RawDataOffset | DWORD | 4 | +64 | +64 | 生画像データ開始位置のオフセット(バイト)。 |
| RawDataSize | DWORD | 4 | +68 | +68 | 生画像データのバイトサイズ。 |
| PaletteOffset | DWORD | 4 | +72 | +72 | パレットデータ開始位置のオフセット(バイト)。 |
| PaletteSize | DWORD | 4 | +76 | +76 | パレットデータのバイトサイズ。 |
各言語での定義
#include <windows.h>
// WIA_RAW_HEADER (x64 80 / x86 80 バイト)
typedef struct WIA_RAW_HEADER {
DWORD Tag;
DWORD Version;
DWORD HeaderSize;
DWORD XRes;
DWORD YRes;
DWORD XExtent;
DWORD YExtent;
DWORD BytesPerLine;
DWORD BitsPerPixel;
DWORD ChannelsPerPixel;
DWORD DataType;
BYTE BitsPerChannel[8];
DWORD Compression;
DWORD PhotometricInterp;
DWORD LineOrder;
DWORD RawDataOffset;
DWORD RawDataSize;
DWORD PaletteOffset;
DWORD PaletteSize;
} WIA_RAW_HEADER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WIA_RAW_HEADER
{
public uint Tag;
public uint Version;
public uint HeaderSize;
public uint XRes;
public uint YRes;
public uint XExtent;
public uint YExtent;
public uint BytesPerLine;
public uint BitsPerPixel;
public uint ChannelsPerPixel;
public uint DataType;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] BitsPerChannel;
public uint Compression;
public uint PhotometricInterp;
public uint LineOrder;
public uint RawDataOffset;
public uint RawDataSize;
public uint PaletteOffset;
public uint PaletteSize;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WIA_RAW_HEADER
Public Tag As UInteger
Public Version As UInteger
Public HeaderSize As UInteger
Public XRes As UInteger
Public YRes As UInteger
Public XExtent As UInteger
Public YExtent As UInteger
Public BytesPerLine As UInteger
Public BitsPerPixel As UInteger
Public ChannelsPerPixel As UInteger
Public DataType As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public BitsPerChannel() As Byte
Public Compression As UInteger
Public PhotometricInterp As UInteger
Public LineOrder As UInteger
Public RawDataOffset As UInteger
Public RawDataSize As UInteger
Public PaletteOffset As UInteger
Public PaletteSize As UInteger
End Structureimport ctypes
from ctypes import wintypes
class WIA_RAW_HEADER(ctypes.Structure):
_fields_ = [
("Tag", wintypes.DWORD),
("Version", wintypes.DWORD),
("HeaderSize", wintypes.DWORD),
("XRes", wintypes.DWORD),
("YRes", wintypes.DWORD),
("XExtent", wintypes.DWORD),
("YExtent", wintypes.DWORD),
("BytesPerLine", wintypes.DWORD),
("BitsPerPixel", wintypes.DWORD),
("ChannelsPerPixel", wintypes.DWORD),
("DataType", wintypes.DWORD),
("BitsPerChannel", ctypes.c_ubyte * 8),
("Compression", wintypes.DWORD),
("PhotometricInterp", wintypes.DWORD),
("LineOrder", wintypes.DWORD),
("RawDataOffset", wintypes.DWORD),
("RawDataSize", wintypes.DWORD),
("PaletteOffset", wintypes.DWORD),
("PaletteSize", wintypes.DWORD),
]#[repr(C)]
pub struct WIA_RAW_HEADER {
pub Tag: u32,
pub Version: u32,
pub HeaderSize: u32,
pub XRes: u32,
pub YRes: u32,
pub XExtent: u32,
pub YExtent: u32,
pub BytesPerLine: u32,
pub BitsPerPixel: u32,
pub ChannelsPerPixel: u32,
pub DataType: u32,
pub BitsPerChannel: [u8; 8],
pub Compression: u32,
pub PhotometricInterp: u32,
pub LineOrder: u32,
pub RawDataOffset: u32,
pub RawDataSize: u32,
pub PaletteOffset: u32,
pub PaletteSize: u32,
}import "golang.org/x/sys/windows"
type WIA_RAW_HEADER struct {
Tag uint32
Version uint32
HeaderSize uint32
XRes uint32
YRes uint32
XExtent uint32
YExtent uint32
BytesPerLine uint32
BitsPerPixel uint32
ChannelsPerPixel uint32
DataType uint32
BitsPerChannel [8]byte
Compression uint32
PhotometricInterp uint32
LineOrder uint32
RawDataOffset uint32
RawDataSize uint32
PaletteOffset uint32
PaletteSize uint32
}type
WIA_RAW_HEADER = record
Tag: DWORD;
Version: DWORD;
HeaderSize: DWORD;
XRes: DWORD;
YRes: DWORD;
XExtent: DWORD;
YExtent: DWORD;
BytesPerLine: DWORD;
BitsPerPixel: DWORD;
ChannelsPerPixel: DWORD;
DataType: DWORD;
BitsPerChannel: array[0..7] of Byte;
Compression: DWORD;
PhotometricInterp: DWORD;
LineOrder: DWORD;
RawDataOffset: DWORD;
RawDataSize: DWORD;
PaletteOffset: DWORD;
PaletteSize: DWORD;
end;const WIA_RAW_HEADER = extern struct {
Tag: u32,
Version: u32,
HeaderSize: u32,
XRes: u32,
YRes: u32,
XExtent: u32,
YExtent: u32,
BytesPerLine: u32,
BitsPerPixel: u32,
ChannelsPerPixel: u32,
DataType: u32,
BitsPerChannel: [8]u8,
Compression: u32,
PhotometricInterp: u32,
LineOrder: u32,
RawDataOffset: u32,
RawDataSize: u32,
PaletteOffset: u32,
PaletteSize: u32,
};type
WIA_RAW_HEADER {.bycopy.} = object
Tag: uint32
Version: uint32
HeaderSize: uint32
XRes: uint32
YRes: uint32
XExtent: uint32
YExtent: uint32
BytesPerLine: uint32
BitsPerPixel: uint32
ChannelsPerPixel: uint32
DataType: uint32
BitsPerChannel: array[8, uint8]
Compression: uint32
PhotometricInterp: uint32
LineOrder: uint32
RawDataOffset: uint32
RawDataSize: uint32
PaletteOffset: uint32
PaletteSize: uint32struct WIA_RAW_HEADER
{
uint Tag;
uint Version;
uint HeaderSize;
uint XRes;
uint YRes;
uint XExtent;
uint YExtent;
uint BytesPerLine;
uint BitsPerPixel;
uint ChannelsPerPixel;
uint DataType;
ubyte[8] BitsPerChannel;
uint Compression;
uint PhotometricInterp;
uint LineOrder;
uint RawDataOffset;
uint RawDataSize;
uint PaletteOffset;
uint PaletteSize;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WIA_RAW_HEADER サイズ: 80 バイト(x64)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; Tag : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Version : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; HeaderSize : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; XRes : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; YRes : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; XExtent : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; YExtent : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; BytesPerLine : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; BitsPerPixel : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ChannelsPerPixel : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; DataType : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; BitsPerChannel : BYTE (+44, 8byte) varptr(st)+44 を基点に操作(8byte:入れ子/配列)
; Compression : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; PhotometricInterp : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; LineOrder : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; RawDataOffset : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; RawDataSize : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; PaletteOffset : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; PaletteSize : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WIA_RAW_HEADER
#field int Tag
#field int Version
#field int HeaderSize
#field int XRes
#field int YRes
#field int XExtent
#field int YExtent
#field int BytesPerLine
#field int BitsPerPixel
#field int ChannelsPerPixel
#field int DataType
#field byte BitsPerChannel 8
#field int Compression
#field int PhotometricInterp
#field int LineOrder
#field int RawDataOffset
#field int RawDataSize
#field int PaletteOffset
#field int PaletteSize
#endstruct
stdim st, WIA_RAW_HEADER ; NSTRUCT 変数を確保
st->Tag = 100
mes "Tag=" + st->Tag