Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › DCIOFFSCREEN

DCIOFFSCREEN

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

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

フィールド

フィールドサイズx64x86説明
dciInfoDCISURFACEINFO88/72+0+0オフスクリーンサーフェスの基本情報を保持するDCISURFACEINFO。
DrawINT_PTR8/4+88+72描画(BltからVRAMへ転送)を行うコールバック関数のアドレス。
SetClipListINT_PTR8/4+96+76クリップリストを設定するコールバック関数のアドレス。
SetDestinationINT_PTR8/4+104+80描画先を設定するコールバック関数のアドレス。

各言語での定義

#include <windows.h>

// DCISURFACEINFO  (x64 88 / x86 72 バイト)
typedef struct DCISURFACEINFO {
    DWORD dwSize;
    DWORD dwDCICaps;
    DWORD dwCompression;
    DWORD dwMask[3];
    DWORD dwWidth;
    DWORD dwHeight;
    INT lStride;
    DWORD dwBitCount;
    UINT_PTR dwOffSurface;
    WORD wSelSurface;
    WORD wReserved;
    DWORD dwReserved1;
    DWORD dwReserved2;
    DWORD dwReserved3;
    INT_PTR BeginAccess;
    INT_PTR EndAccess;
    INT_PTR DestroySurface;
} DCISURFACEINFO;

// DCIOFFSCREEN  (x64 112 / x86 84 バイト)
typedef struct DCIOFFSCREEN {
    DCISURFACEINFO dciInfo;
    INT_PTR Draw;
    INT_PTR SetClipList;
    INT_PTR SetDestination;
} DCIOFFSCREEN;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DCISURFACEINFO
{
    public uint dwSize;
    public uint dwDCICaps;
    public uint dwCompression;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] dwMask;
    public uint dwWidth;
    public uint dwHeight;
    public int lStride;
    public uint dwBitCount;
    public UIntPtr dwOffSurface;
    public ushort wSelSurface;
    public ushort wReserved;
    public uint dwReserved1;
    public uint dwReserved2;
    public uint dwReserved3;
    public IntPtr BeginAccess;
    public IntPtr EndAccess;
    public IntPtr DestroySurface;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DCIOFFSCREEN
{
    public DCISURFACEINFO dciInfo;
    public IntPtr Draw;
    public IntPtr SetClipList;
    public IntPtr SetDestination;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DCISURFACEINFO
    Public dwSize As UInteger
    Public dwDCICaps As UInteger
    Public dwCompression As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public dwMask() As UInteger
    Public dwWidth As UInteger
    Public dwHeight As UInteger
    Public lStride As Integer
    Public dwBitCount As UInteger
    Public dwOffSurface As UIntPtr
    Public wSelSurface As UShort
    Public wReserved As UShort
    Public dwReserved1 As UInteger
    Public dwReserved2 As UInteger
    Public dwReserved3 As UInteger
    Public BeginAccess As IntPtr
    Public EndAccess As IntPtr
    Public DestroySurface As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DCIOFFSCREEN
    Public dciInfo As DCISURFACEINFO
    Public Draw As IntPtr
    Public SetClipList As IntPtr
    Public SetDestination As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DCISURFACEINFO(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwDCICaps", wintypes.DWORD),
        ("dwCompression", wintypes.DWORD),
        ("dwMask", wintypes.DWORD * 3),
        ("dwWidth", wintypes.DWORD),
        ("dwHeight", wintypes.DWORD),
        ("lStride", ctypes.c_int),
        ("dwBitCount", wintypes.DWORD),
        ("dwOffSurface", ctypes.c_size_t),
        ("wSelSurface", ctypes.c_ushort),
        ("wReserved", ctypes.c_ushort),
        ("dwReserved1", wintypes.DWORD),
        ("dwReserved2", wintypes.DWORD),
        ("dwReserved3", wintypes.DWORD),
        ("BeginAccess", ctypes.c_ssize_t),
        ("EndAccess", ctypes.c_ssize_t),
        ("DestroySurface", ctypes.c_ssize_t),
    ]

class DCIOFFSCREEN(ctypes.Structure):
    _fields_ = [
        ("dciInfo", DCISURFACEINFO),
        ("Draw", ctypes.c_ssize_t),
        ("SetClipList", ctypes.c_ssize_t),
        ("SetDestination", ctypes.c_ssize_t),
    ]
#[repr(C)]
pub struct DCISURFACEINFO {
    pub dwSize: u32,
    pub dwDCICaps: u32,
    pub dwCompression: u32,
    pub dwMask: [u32; 3],
    pub dwWidth: u32,
    pub dwHeight: u32,
    pub lStride: i32,
    pub dwBitCount: u32,
    pub dwOffSurface: usize,
    pub wSelSurface: u16,
    pub wReserved: u16,
    pub dwReserved1: u32,
    pub dwReserved2: u32,
    pub dwReserved3: u32,
    pub BeginAccess: isize,
    pub EndAccess: isize,
    pub DestroySurface: isize,
}

#[repr(C)]
pub struct DCIOFFSCREEN {
    pub dciInfo: DCISURFACEINFO,
    pub Draw: isize,
    pub SetClipList: isize,
    pub SetDestination: isize,
}
import "golang.org/x/sys/windows"

type DCISURFACEINFO struct {
	dwSize uint32
	dwDCICaps uint32
	dwCompression uint32
	dwMask [3]uint32
	dwWidth uint32
	dwHeight uint32
	lStride int32
	dwBitCount uint32
	dwOffSurface uintptr
	wSelSurface uint16
	wReserved uint16
	dwReserved1 uint32
	dwReserved2 uint32
	dwReserved3 uint32
	BeginAccess uintptr
	EndAccess uintptr
	DestroySurface uintptr
}

type DCIOFFSCREEN struct {
	dciInfo DCISURFACEINFO
	Draw uintptr
	SetClipList uintptr
	SetDestination uintptr
}
type
  DCISURFACEINFO = record
    dwSize: DWORD;
    dwDCICaps: DWORD;
    dwCompression: DWORD;
    dwMask: array[0..2] of DWORD;
    dwWidth: DWORD;
    dwHeight: DWORD;
    lStride: Integer;
    dwBitCount: DWORD;
    dwOffSurface: NativeUInt;
    wSelSurface: Word;
    wReserved: Word;
    dwReserved1: DWORD;
    dwReserved2: DWORD;
    dwReserved3: DWORD;
    BeginAccess: NativeInt;
    EndAccess: NativeInt;
    DestroySurface: NativeInt;
  end;

  DCIOFFSCREEN = record
    dciInfo: DCISURFACEINFO;
    Draw: NativeInt;
    SetClipList: NativeInt;
    SetDestination: NativeInt;
  end;
const DCISURFACEINFO = extern struct {
    dwSize: u32,
    dwDCICaps: u32,
    dwCompression: u32,
    dwMask: [3]u32,
    dwWidth: u32,
    dwHeight: u32,
    lStride: i32,
    dwBitCount: u32,
    dwOffSurface: usize,
    wSelSurface: u16,
    wReserved: u16,
    dwReserved1: u32,
    dwReserved2: u32,
    dwReserved3: u32,
    BeginAccess: isize,
    EndAccess: isize,
    DestroySurface: isize,
};

const DCIOFFSCREEN = extern struct {
    dciInfo: DCISURFACEINFO,
    Draw: isize,
    SetClipList: isize,
    SetDestination: isize,
};
type
  DCISURFACEINFO {.bycopy.} = object
    dwSize: uint32
    dwDCICaps: uint32
    dwCompression: uint32
    dwMask: array[3, uint32]
    dwWidth: uint32
    dwHeight: uint32
    lStride: int32
    dwBitCount: uint32
    dwOffSurface: uint
    wSelSurface: uint16
    wReserved: uint16
    dwReserved1: uint32
    dwReserved2: uint32
    dwReserved3: uint32
    BeginAccess: int
    EndAccess: int
    DestroySurface: int

  DCIOFFSCREEN {.bycopy.} = object
    dciInfo: DCISURFACEINFO
    Draw: int
    SetClipList: int
    SetDestination: int
struct DCISURFACEINFO
{
    uint dwSize;
    uint dwDCICaps;
    uint dwCompression;
    uint[3] dwMask;
    uint dwWidth;
    uint dwHeight;
    int lStride;
    uint dwBitCount;
    size_t dwOffSurface;
    ushort wSelSurface;
    ushort wReserved;
    uint dwReserved1;
    uint dwReserved2;
    uint dwReserved3;
    ptrdiff_t BeginAccess;
    ptrdiff_t EndAccess;
    ptrdiff_t DestroySurface;
}

struct DCIOFFSCREEN
{
    DCISURFACEINFO dciInfo;
    ptrdiff_t Draw;
    ptrdiff_t SetClipList;
    ptrdiff_t SetDestination;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DCIOFFSCREEN サイズ: 84 バイト(x86)
dim st, 21    ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; dciInfo : DCISURFACEINFO (+0, 72byte)  varptr(st)+0 を基点に操作(72byte:入れ子/配列)
; Draw : INT_PTR (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; SetClipList : INT_PTR (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; SetDestination : INT_PTR (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DCIOFFSCREEN サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; dciInfo : DCISURFACEINFO (+0, 88byte)  varptr(st)+0 を基点に操作(88byte:入れ子/配列)
; Draw : INT_PTR (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; SetClipList : INT_PTR (+96, 8byte)  qpoke st,96,値 / qpeek(st,96)  ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; SetDestination : INT_PTR (+104, 8byte)  qpoke st,104,値 / qpeek(st,104)  ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DCISURFACEINFO
    #field int dwSize
    #field int dwDCICaps
    #field int dwCompression
    #field int dwMask 3
    #field int dwWidth
    #field int dwHeight
    #field int lStride
    #field int dwBitCount
    #field intptr dwOffSurface
    #field short wSelSurface
    #field short wReserved
    #field int dwReserved1
    #field int dwReserved2
    #field int dwReserved3
    #field intptr BeginAccess
    #field intptr EndAccess
    #field intptr DestroySurface
#endstruct

#defstruct global DCIOFFSCREEN
    #field DCISURFACEINFO dciInfo
    #field intptr Draw
    #field intptr SetClipList
    #field intptr SetDestination
#endstruct

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