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

EncoderParameters

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

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

フィールド

フィールドサイズx64x86説明
CountDWORD4+0+0Parameter配列に含まれるパラメータの個数を表す。
ParameterEncoderParameter32/28+8+4エンコーダパラメータを格納するEncoderParameter配列の先頭(可変長)。

各言語での定義

#include <windows.h>

// EncoderParameter  (x64 32 / x86 28 バイト)
typedef struct EncoderParameter {
    GUID Guid;
    DWORD NumberOfValues;
    DWORD Type;
    void* Value;
} EncoderParameter;

// EncoderParameters  (x64 40 / x86 32 バイト)
typedef struct EncoderParameters {
    DWORD Count;
    EncoderParameter Parameter[1];
} EncoderParameters;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EncoderParameter
{
    public Guid Guid;
    public uint NumberOfValues;
    public uint Type;
    public IntPtr Value;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EncoderParameters
{
    public uint Count;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public EncoderParameter[] Parameter;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EncoderParameter
    Public Guid As Guid
    Public NumberOfValues As UInteger
    Public Type As UInteger
    Public Value As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EncoderParameters
    Public Count As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Parameter() As EncoderParameter
End Structure
import ctypes
from ctypes import wintypes

class EncoderParameter(ctypes.Structure):
    _fields_ = [
        ("Guid", GUID),
        ("NumberOfValues", wintypes.DWORD),
        ("Type", wintypes.DWORD),
        ("Value", ctypes.c_void_p),
    ]

class EncoderParameters(ctypes.Structure):
    _fields_ = [
        ("Count", wintypes.DWORD),
        ("Parameter", EncoderParameter * 1),
    ]
#[repr(C)]
pub struct EncoderParameter {
    pub Guid: GUID,
    pub NumberOfValues: u32,
    pub Type: u32,
    pub Value: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct EncoderParameters {
    pub Count: u32,
    pub Parameter: [EncoderParameter; 1],
}
import "golang.org/x/sys/windows"

type EncoderParameter struct {
	Guid windows.GUID
	NumberOfValues uint32
	Type uint32
	Value uintptr
}

type EncoderParameters struct {
	Count uint32
	Parameter [1]EncoderParameter
}
type
  EncoderParameter = record
    Guid: TGUID;
    NumberOfValues: DWORD;
    Type: DWORD;
    Value: Pointer;
  end;

  EncoderParameters = record
    Count: DWORD;
    Parameter: array[0..0] of EncoderParameter;
  end;
const EncoderParameter = extern struct {
    Guid: GUID,
    NumberOfValues: u32,
    Type: u32,
    Value: ?*anyopaque,
};

const EncoderParameters = extern struct {
    Count: u32,
    Parameter: [1]EncoderParameter,
};
type
  EncoderParameter {.bycopy.} = object
    Guid: GUID
    NumberOfValues: uint32
    Type: uint32
    Value: pointer

  EncoderParameters {.bycopy.} = object
    Count: uint32
    Parameter: array[1, EncoderParameter]
struct EncoderParameter
{
    GUID Guid;
    uint NumberOfValues;
    uint Type;
    void* Value;
}

struct EncoderParameters
{
    uint Count;
    EncoderParameter[1] Parameter;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; EncoderParameters サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Count : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Parameter : EncoderParameter (+4, 28byte)  varptr(st)+4 を基点に操作(28byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EncoderParameters サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Count : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Parameter : EncoderParameter (+8, 32byte)  varptr(st)+8 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global EncoderParameter
    #field GUID Guid
    #field int NumberOfValues
    #field int Type
    #field intptr Value
#endstruct

#defstruct global EncoderParameters
    #field int Count
    #field EncoderParameter Parameter 1
#endstruct

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