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

WICDdsFormatInfo

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

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

フィールド

フィールドサイズx64x86説明
DxgiFormatDXGI_FORMAT4+0+0対象ブロックのピクセル形式を示すDXGI_FORMAT列挙値。
BytesPerBlockDWORD4+4+41圧縮ブロックあたりのバイト数。非圧縮形式では1ピクセル分となる。
BlockWidthDWORD4+8+81ブロックの幅(ピクセル単位)。BC形式では通常4。
BlockHeightDWORD4+12+121ブロックの高さ(ピクセル単位)。BC形式では通常4。

各言語での定義

#include <windows.h>

// WICDdsFormatInfo  (x64 16 / x86 16 バイト)
typedef struct WICDdsFormatInfo {
    DXGI_FORMAT DxgiFormat;
    DWORD BytesPerBlock;
    DWORD BlockWidth;
    DWORD BlockHeight;
} WICDdsFormatInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WICDdsFormatInfo
{
    public int DxgiFormat;
    public uint BytesPerBlock;
    public uint BlockWidth;
    public uint BlockHeight;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WICDdsFormatInfo
    Public DxgiFormat As Integer
    Public BytesPerBlock As UInteger
    Public BlockWidth As UInteger
    Public BlockHeight As UInteger
End Structure
import ctypes
from ctypes import wintypes

class WICDdsFormatInfo(ctypes.Structure):
    _fields_ = [
        ("DxgiFormat", ctypes.c_int),
        ("BytesPerBlock", wintypes.DWORD),
        ("BlockWidth", wintypes.DWORD),
        ("BlockHeight", wintypes.DWORD),
    ]
#[repr(C)]
pub struct WICDdsFormatInfo {
    pub DxgiFormat: i32,
    pub BytesPerBlock: u32,
    pub BlockWidth: u32,
    pub BlockHeight: u32,
}
import "golang.org/x/sys/windows"

type WICDdsFormatInfo struct {
	DxgiFormat int32
	BytesPerBlock uint32
	BlockWidth uint32
	BlockHeight uint32
}
type
  WICDdsFormatInfo = record
    DxgiFormat: Integer;
    BytesPerBlock: DWORD;
    BlockWidth: DWORD;
    BlockHeight: DWORD;
  end;
const WICDdsFormatInfo = extern struct {
    DxgiFormat: i32,
    BytesPerBlock: u32,
    BlockWidth: u32,
    BlockHeight: u32,
};
type
  WICDdsFormatInfo {.bycopy.} = object
    DxgiFormat: int32
    BytesPerBlock: uint32
    BlockWidth: uint32
    BlockHeight: uint32
struct WICDdsFormatInfo
{
    int DxgiFormat;
    uint BytesPerBlock;
    uint BlockWidth;
    uint BlockHeight;
}

HSP用 定義

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

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

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