Win32 API 日本語リファレンス
ホームGraphics.Imaging › WICJpegScanHeader

WICJpegScanHeader

構造体
サイズx64: 20 バイト / x86: 20 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
cComponentsDWORD4+0+0このスキャンに含まれる色成分数。
RestartIntervalDWORD4+4+4リスタートマーカ間のMCU数。0でリスタート間隔なし。
ComponentSelectorsDWORD4+8+8スキャン対象の各成分セレクタをパックしたDWORD。
HuffmanTableIndicesDWORD4+12+12各成分が使用するハフマンテーブル(DC/AC)のインデックスをパックしたDWORD。
StartSpectralSelectionBYTE1+16+16プログレッシブ符号化で開始するスペクトル選択(係数開始位置)。
EndSpectralSelectionBYTE1+17+17プログレッシブ符号化で終了するスペクトル選択(係数終了位置)。
SuccessiveApproximationHighBYTE1+18+18逐次近似の上位ビット位置。プログレッシブ符号化で用いる。
SuccessiveApproximationLowBYTE1+19+19逐次近似の下位ビット位置。プログレッシブ符号化で用いる。

各言語での定義

#include <windows.h>

// WICJpegScanHeader  (x64 20 / x86 20 バイト)
typedef struct WICJpegScanHeader {
    DWORD cComponents;
    DWORD RestartInterval;
    DWORD ComponentSelectors;
    DWORD HuffmanTableIndices;
    BYTE StartSpectralSelection;
    BYTE EndSpectralSelection;
    BYTE SuccessiveApproximationHigh;
    BYTE SuccessiveApproximationLow;
} WICJpegScanHeader;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WICJpegScanHeader
{
    public uint cComponents;
    public uint RestartInterval;
    public uint ComponentSelectors;
    public uint HuffmanTableIndices;
    public byte StartSpectralSelection;
    public byte EndSpectralSelection;
    public byte SuccessiveApproximationHigh;
    public byte SuccessiveApproximationLow;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WICJpegScanHeader
    Public cComponents As UInteger
    Public RestartInterval As UInteger
    Public ComponentSelectors As UInteger
    Public HuffmanTableIndices As UInteger
    Public StartSpectralSelection As Byte
    Public EndSpectralSelection As Byte
    Public SuccessiveApproximationHigh As Byte
    Public SuccessiveApproximationLow As Byte
End Structure
import ctypes
from ctypes import wintypes

class WICJpegScanHeader(ctypes.Structure):
    _fields_ = [
        ("cComponents", wintypes.DWORD),
        ("RestartInterval", wintypes.DWORD),
        ("ComponentSelectors", wintypes.DWORD),
        ("HuffmanTableIndices", wintypes.DWORD),
        ("StartSpectralSelection", ctypes.c_ubyte),
        ("EndSpectralSelection", ctypes.c_ubyte),
        ("SuccessiveApproximationHigh", ctypes.c_ubyte),
        ("SuccessiveApproximationLow", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct WICJpegScanHeader {
    pub cComponents: u32,
    pub RestartInterval: u32,
    pub ComponentSelectors: u32,
    pub HuffmanTableIndices: u32,
    pub StartSpectralSelection: u8,
    pub EndSpectralSelection: u8,
    pub SuccessiveApproximationHigh: u8,
    pub SuccessiveApproximationLow: u8,
}
import "golang.org/x/sys/windows"

type WICJpegScanHeader struct {
	cComponents uint32
	RestartInterval uint32
	ComponentSelectors uint32
	HuffmanTableIndices uint32
	StartSpectralSelection byte
	EndSpectralSelection byte
	SuccessiveApproximationHigh byte
	SuccessiveApproximationLow byte
}
type
  WICJpegScanHeader = record
    cComponents: DWORD;
    RestartInterval: DWORD;
    ComponentSelectors: DWORD;
    HuffmanTableIndices: DWORD;
    StartSpectralSelection: Byte;
    EndSpectralSelection: Byte;
    SuccessiveApproximationHigh: Byte;
    SuccessiveApproximationLow: Byte;
  end;
const WICJpegScanHeader = extern struct {
    cComponents: u32,
    RestartInterval: u32,
    ComponentSelectors: u32,
    HuffmanTableIndices: u32,
    StartSpectralSelection: u8,
    EndSpectralSelection: u8,
    SuccessiveApproximationHigh: u8,
    SuccessiveApproximationLow: u8,
};
type
  WICJpegScanHeader {.bycopy.} = object
    cComponents: uint32
    RestartInterval: uint32
    ComponentSelectors: uint32
    HuffmanTableIndices: uint32
    StartSpectralSelection: uint8
    EndSpectralSelection: uint8
    SuccessiveApproximationHigh: uint8
    SuccessiveApproximationLow: uint8
struct WICJpegScanHeader
{
    uint cComponents;
    uint RestartInterval;
    uint ComponentSelectors;
    uint HuffmanTableIndices;
    ubyte StartSpectralSelection;
    ubyte EndSpectralSelection;
    ubyte SuccessiveApproximationHigh;
    ubyte SuccessiveApproximationLow;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WICJpegScanHeader サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; cComponents : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; RestartInterval : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ComponentSelectors : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; HuffmanTableIndices : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; StartSpectralSelection : BYTE (+16, 1byte)  poke st,16,値  /  値 = peek(st,16)
; EndSpectralSelection : BYTE (+17, 1byte)  poke st,17,値  /  値 = peek(st,17)
; SuccessiveApproximationHigh : BYTE (+18, 1byte)  poke st,18,値  /  値 = peek(st,18)
; SuccessiveApproximationLow : BYTE (+19, 1byte)  poke st,19,値  /  値 = peek(st,19)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WICJpegScanHeader
    #field int cComponents
    #field int RestartInterval
    #field int ComponentSelectors
    #field int HuffmanTableIndices
    #field byte StartSpectralSelection
    #field byte EndSpectralSelection
    #field byte SuccessiveApproximationHigh
    #field byte SuccessiveApproximationLow
#endstruct

stdim st, WICJpegScanHeader        ; NSTRUCT 変数を確保
st->cComponents = 100
mes "cComponents=" + st->cComponents