Win32 API 日本語リファレンス
ホームMedia.Multimedia › ICDRAWBEGIN

ICDRAWBEGIN

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

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

フィールド

フィールドサイズx64x86説明
dwFlagsDWORD4+0+0描画開始を制御するフラグ。ICDRAW_QUERY等を示す。
hpalHPALETTE8/4+8+4描画に使用するパレットのハンドル。
hwndHWND8/4+16+8描画先のウィンドウハンドル。
hdcHDC8/4+24+12描画先のデバイスコンテキストハンドル。
xDstINT4+32+16描画先矩形の左上X座標。
yDstINT4+36+20描画先矩形の左上Y座標。
dxDstINT4+40+24描画先矩形の幅。
dyDstINT4+44+28描画先矩形の高さ。
lpbiBITMAPINFOHEADER*8/4+48+32ソース画像のBITMAPINFOHEADERへのポインタ。
xSrcINT4+56+36ソース矩形の左上X座標。
ySrcINT4+60+40ソース矩形の左上Y座標。
dxSrcINT4+64+44ソース矩形の幅。
dySrcINT4+68+48ソース矩形の高さ。
dwRateDWORD4+72+52再生レートの分子。dwScaleとの比でフレームレートを示す。
dwScaleDWORD4+76+56再生レートの分母。dwRateとの比でフレームレートを示す。

各言語での定義

#include <windows.h>

// ICDRAWBEGIN  (x64 80 / x86 60 バイト)
typedef struct ICDRAWBEGIN {
    DWORD dwFlags;
    HPALETTE hpal;
    HWND hwnd;
    HDC hdc;
    INT xDst;
    INT yDst;
    INT dxDst;
    INT dyDst;
    BITMAPINFOHEADER* lpbi;
    INT xSrc;
    INT ySrc;
    INT dxSrc;
    INT dySrc;
    DWORD dwRate;
    DWORD dwScale;
} ICDRAWBEGIN;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ICDRAWBEGIN
{
    public uint dwFlags;
    public IntPtr hpal;
    public IntPtr hwnd;
    public IntPtr hdc;
    public int xDst;
    public int yDst;
    public int dxDst;
    public int dyDst;
    public IntPtr lpbi;
    public int xSrc;
    public int ySrc;
    public int dxSrc;
    public int dySrc;
    public uint dwRate;
    public uint dwScale;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ICDRAWBEGIN
    Public dwFlags As UInteger
    Public hpal As IntPtr
    Public hwnd As IntPtr
    Public hdc As IntPtr
    Public xDst As Integer
    Public yDst As Integer
    Public dxDst As Integer
    Public dyDst As Integer
    Public lpbi As IntPtr
    Public xSrc As Integer
    Public ySrc As Integer
    Public dxSrc As Integer
    Public dySrc As Integer
    Public dwRate As UInteger
    Public dwScale As UInteger
End Structure
import ctypes
from ctypes import wintypes

class ICDRAWBEGIN(ctypes.Structure):
    _fields_ = [
        ("dwFlags", wintypes.DWORD),
        ("hpal", ctypes.c_void_p),
        ("hwnd", ctypes.c_void_p),
        ("hdc", ctypes.c_void_p),
        ("xDst", ctypes.c_int),
        ("yDst", ctypes.c_int),
        ("dxDst", ctypes.c_int),
        ("dyDst", ctypes.c_int),
        ("lpbi", ctypes.c_void_p),
        ("xSrc", ctypes.c_int),
        ("ySrc", ctypes.c_int),
        ("dxSrc", ctypes.c_int),
        ("dySrc", ctypes.c_int),
        ("dwRate", wintypes.DWORD),
        ("dwScale", wintypes.DWORD),
    ]
#[repr(C)]
pub struct ICDRAWBEGIN {
    pub dwFlags: u32,
    pub hpal: *mut core::ffi::c_void,
    pub hwnd: *mut core::ffi::c_void,
    pub hdc: *mut core::ffi::c_void,
    pub xDst: i32,
    pub yDst: i32,
    pub dxDst: i32,
    pub dyDst: i32,
    pub lpbi: *mut core::ffi::c_void,
    pub xSrc: i32,
    pub ySrc: i32,
    pub dxSrc: i32,
    pub dySrc: i32,
    pub dwRate: u32,
    pub dwScale: u32,
}
import "golang.org/x/sys/windows"

type ICDRAWBEGIN struct {
	dwFlags uint32
	hpal uintptr
	hwnd uintptr
	hdc uintptr
	xDst int32
	yDst int32
	dxDst int32
	dyDst int32
	lpbi uintptr
	xSrc int32
	ySrc int32
	dxSrc int32
	dySrc int32
	dwRate uint32
	dwScale uint32
}
type
  ICDRAWBEGIN = record
    dwFlags: DWORD;
    hpal: Pointer;
    hwnd: Pointer;
    hdc: Pointer;
    xDst: Integer;
    yDst: Integer;
    dxDst: Integer;
    dyDst: Integer;
    lpbi: Pointer;
    xSrc: Integer;
    ySrc: Integer;
    dxSrc: Integer;
    dySrc: Integer;
    dwRate: DWORD;
    dwScale: DWORD;
  end;
const ICDRAWBEGIN = extern struct {
    dwFlags: u32,
    hpal: ?*anyopaque,
    hwnd: ?*anyopaque,
    hdc: ?*anyopaque,
    xDst: i32,
    yDst: i32,
    dxDst: i32,
    dyDst: i32,
    lpbi: ?*anyopaque,
    xSrc: i32,
    ySrc: i32,
    dxSrc: i32,
    dySrc: i32,
    dwRate: u32,
    dwScale: u32,
};
type
  ICDRAWBEGIN {.bycopy.} = object
    dwFlags: uint32
    hpal: pointer
    hwnd: pointer
    hdc: pointer
    xDst: int32
    yDst: int32
    dxDst: int32
    dyDst: int32
    lpbi: pointer
    xSrc: int32
    ySrc: int32
    dxSrc: int32
    dySrc: int32
    dwRate: uint32
    dwScale: uint32
struct ICDRAWBEGIN
{
    uint dwFlags;
    void* hpal;
    void* hwnd;
    void* hdc;
    int xDst;
    int yDst;
    int dxDst;
    int dyDst;
    void* lpbi;
    int xSrc;
    int ySrc;
    int dxSrc;
    int dySrc;
    uint dwRate;
    uint dwScale;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; ICDRAWBEGIN サイズ: 60 バイト(x86)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hpal : HPALETTE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; hwnd : HWND (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; hdc : HDC (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; xDst : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; yDst : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dxDst : INT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dyDst : INT (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; lpbi : BITMAPINFOHEADER* (+32, 4byte)  varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; xSrc : INT (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ySrc : INT (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dxSrc : INT (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dySrc : INT (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwRate : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; dwScale : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ICDRAWBEGIN サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hpal : HPALETTE (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; hwnd : HWND (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hdc : HDC (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; xDst : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; yDst : INT (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dxDst : INT (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dyDst : INT (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; lpbi : BITMAPINFOHEADER* (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; xSrc : INT (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ySrc : INT (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; dxSrc : INT (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; dySrc : INT (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; dwRate : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; dwScale : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ICDRAWBEGIN
    #field int dwFlags
    #field intptr hpal
    #field intptr hwnd
    #field intptr hdc
    #field int xDst
    #field int yDst
    #field int dxDst
    #field int dyDst
    #field intptr lpbi
    #field int xSrc
    #field int ySrc
    #field int dxSrc
    #field int dySrc
    #field int dwRate
    #field int dwScale
#endstruct

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