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

LAYERPLANEDESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
nSizeWORD2+0+0本構造体のサイズ(バイト単位)。
nVersionWORD2+2+2構造体のバージョン番号。現在は1を指定する。
dwFlagsDWORD4+4+4レイヤプレーンのプロパティを示すビットフラグ。
iPixelTypeBYTE1+8+8ピクセルデータ型。RGBAまたはカラーインデックスを指定する。
cColorBitsBYTE1+9+9カラーバッファのビット深度。
cRedBitsBYTE1+10+10赤成分のビット数。
cRedShiftBYTE1+11+11赤成分のシフト量(ビット位置)。
cGreenBitsBYTE1+12+12緑成分のビット数。
cGreenShiftBYTE1+13+13緑成分のシフト量(ビット位置)。
cBlueBitsBYTE1+14+14青成分のビット数。
cBlueShiftBYTE1+15+15青成分のシフト量(ビット位置)。
cAlphaBitsBYTE1+16+16アルファ成分のビット数。
cAlphaShiftBYTE1+17+17アルファ成分のシフト量(ビット位置)。
cAccumBitsBYTE1+18+18アキュムレーションバッファの総ビット数。
cAccumRedBitsBYTE1+19+19アキュムレーションバッファの赤成分ビット数。
cAccumGreenBitsBYTE1+20+20アキュムレーションバッファの緑成分ビット数。
cAccumBlueBitsBYTE1+21+21アキュムレーションバッファの青成分ビット数。
cAccumAlphaBitsBYTE1+22+22アキュムレーションバッファのアルファ成分ビット数。
cDepthBitsBYTE1+23+23デプス(Z)バッファのビット深度。
cStencilBitsBYTE1+24+24ステンシルバッファのビット深度。
cAuxBuffersBYTE1+25+25補助バッファの数。
iLayerPlaneBYTE1+26+26オーバーレイ/アンダーレイのプレーン番号。正でオーバーレイ、負でアンダーレイ。
bReservedBYTE1+27+27予約フィールド。0を設定する。
crTransparentCOLORREF4+28+28透過色を示すCOLORREF値。この色のピクセルが透過扱いとなる。

各言語での定義

#include <windows.h>

// LAYERPLANEDESCRIPTOR  (x64 32 / x86 32 バイト)
typedef struct LAYERPLANEDESCRIPTOR {
    WORD nSize;
    WORD nVersion;
    DWORD dwFlags;
    BYTE iPixelType;
    BYTE cColorBits;
    BYTE cRedBits;
    BYTE cRedShift;
    BYTE cGreenBits;
    BYTE cGreenShift;
    BYTE cBlueBits;
    BYTE cBlueShift;
    BYTE cAlphaBits;
    BYTE cAlphaShift;
    BYTE cAccumBits;
    BYTE cAccumRedBits;
    BYTE cAccumGreenBits;
    BYTE cAccumBlueBits;
    BYTE cAccumAlphaBits;
    BYTE cDepthBits;
    BYTE cStencilBits;
    BYTE cAuxBuffers;
    BYTE iLayerPlane;
    BYTE bReserved;
    COLORREF crTransparent;
} LAYERPLANEDESCRIPTOR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LAYERPLANEDESCRIPTOR
{
    public ushort nSize;
    public ushort nVersion;
    public uint dwFlags;
    public byte iPixelType;
    public byte cColorBits;
    public byte cRedBits;
    public byte cRedShift;
    public byte cGreenBits;
    public byte cGreenShift;
    public byte cBlueBits;
    public byte cBlueShift;
    public byte cAlphaBits;
    public byte cAlphaShift;
    public byte cAccumBits;
    public byte cAccumRedBits;
    public byte cAccumGreenBits;
    public byte cAccumBlueBits;
    public byte cAccumAlphaBits;
    public byte cDepthBits;
    public byte cStencilBits;
    public byte cAuxBuffers;
    public byte iLayerPlane;
    public byte bReserved;
    public uint crTransparent;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LAYERPLANEDESCRIPTOR
    Public nSize As UShort
    Public nVersion As UShort
    Public dwFlags As UInteger
    Public iPixelType As Byte
    Public cColorBits As Byte
    Public cRedBits As Byte
    Public cRedShift As Byte
    Public cGreenBits As Byte
    Public cGreenShift As Byte
    Public cBlueBits As Byte
    Public cBlueShift As Byte
    Public cAlphaBits As Byte
    Public cAlphaShift As Byte
    Public cAccumBits As Byte
    Public cAccumRedBits As Byte
    Public cAccumGreenBits As Byte
    Public cAccumBlueBits As Byte
    Public cAccumAlphaBits As Byte
    Public cDepthBits As Byte
    Public cStencilBits As Byte
    Public cAuxBuffers As Byte
    Public iLayerPlane As Byte
    Public bReserved As Byte
    Public crTransparent As UInteger
End Structure
import ctypes
from ctypes import wintypes

class LAYERPLANEDESCRIPTOR(ctypes.Structure):
    _fields_ = [
        ("nSize", ctypes.c_ushort),
        ("nVersion", ctypes.c_ushort),
        ("dwFlags", wintypes.DWORD),
        ("iPixelType", ctypes.c_ubyte),
        ("cColorBits", ctypes.c_ubyte),
        ("cRedBits", ctypes.c_ubyte),
        ("cRedShift", ctypes.c_ubyte),
        ("cGreenBits", ctypes.c_ubyte),
        ("cGreenShift", ctypes.c_ubyte),
        ("cBlueBits", ctypes.c_ubyte),
        ("cBlueShift", ctypes.c_ubyte),
        ("cAlphaBits", ctypes.c_ubyte),
        ("cAlphaShift", ctypes.c_ubyte),
        ("cAccumBits", ctypes.c_ubyte),
        ("cAccumRedBits", ctypes.c_ubyte),
        ("cAccumGreenBits", ctypes.c_ubyte),
        ("cAccumBlueBits", ctypes.c_ubyte),
        ("cAccumAlphaBits", ctypes.c_ubyte),
        ("cDepthBits", ctypes.c_ubyte),
        ("cStencilBits", ctypes.c_ubyte),
        ("cAuxBuffers", ctypes.c_ubyte),
        ("iLayerPlane", ctypes.c_ubyte),
        ("bReserved", ctypes.c_ubyte),
        ("crTransparent", wintypes.DWORD),
    ]
#[repr(C)]
pub struct LAYERPLANEDESCRIPTOR {
    pub nSize: u16,
    pub nVersion: u16,
    pub dwFlags: u32,
    pub iPixelType: u8,
    pub cColorBits: u8,
    pub cRedBits: u8,
    pub cRedShift: u8,
    pub cGreenBits: u8,
    pub cGreenShift: u8,
    pub cBlueBits: u8,
    pub cBlueShift: u8,
    pub cAlphaBits: u8,
    pub cAlphaShift: u8,
    pub cAccumBits: u8,
    pub cAccumRedBits: u8,
    pub cAccumGreenBits: u8,
    pub cAccumBlueBits: u8,
    pub cAccumAlphaBits: u8,
    pub cDepthBits: u8,
    pub cStencilBits: u8,
    pub cAuxBuffers: u8,
    pub iLayerPlane: u8,
    pub bReserved: u8,
    pub crTransparent: u32,
}
import "golang.org/x/sys/windows"

type LAYERPLANEDESCRIPTOR struct {
	nSize uint16
	nVersion uint16
	dwFlags uint32
	iPixelType byte
	cColorBits byte
	cRedBits byte
	cRedShift byte
	cGreenBits byte
	cGreenShift byte
	cBlueBits byte
	cBlueShift byte
	cAlphaBits byte
	cAlphaShift byte
	cAccumBits byte
	cAccumRedBits byte
	cAccumGreenBits byte
	cAccumBlueBits byte
	cAccumAlphaBits byte
	cDepthBits byte
	cStencilBits byte
	cAuxBuffers byte
	iLayerPlane byte
	bReserved byte
	crTransparent uint32
}
type
  LAYERPLANEDESCRIPTOR = record
    nSize: Word;
    nVersion: Word;
    dwFlags: DWORD;
    iPixelType: Byte;
    cColorBits: Byte;
    cRedBits: Byte;
    cRedShift: Byte;
    cGreenBits: Byte;
    cGreenShift: Byte;
    cBlueBits: Byte;
    cBlueShift: Byte;
    cAlphaBits: Byte;
    cAlphaShift: Byte;
    cAccumBits: Byte;
    cAccumRedBits: Byte;
    cAccumGreenBits: Byte;
    cAccumBlueBits: Byte;
    cAccumAlphaBits: Byte;
    cDepthBits: Byte;
    cStencilBits: Byte;
    cAuxBuffers: Byte;
    iLayerPlane: Byte;
    bReserved: Byte;
    crTransparent: DWORD;
  end;
const LAYERPLANEDESCRIPTOR = extern struct {
    nSize: u16,
    nVersion: u16,
    dwFlags: u32,
    iPixelType: u8,
    cColorBits: u8,
    cRedBits: u8,
    cRedShift: u8,
    cGreenBits: u8,
    cGreenShift: u8,
    cBlueBits: u8,
    cBlueShift: u8,
    cAlphaBits: u8,
    cAlphaShift: u8,
    cAccumBits: u8,
    cAccumRedBits: u8,
    cAccumGreenBits: u8,
    cAccumBlueBits: u8,
    cAccumAlphaBits: u8,
    cDepthBits: u8,
    cStencilBits: u8,
    cAuxBuffers: u8,
    iLayerPlane: u8,
    bReserved: u8,
    crTransparent: u32,
};
type
  LAYERPLANEDESCRIPTOR {.bycopy.} = object
    nSize: uint16
    nVersion: uint16
    dwFlags: uint32
    iPixelType: uint8
    cColorBits: uint8
    cRedBits: uint8
    cRedShift: uint8
    cGreenBits: uint8
    cGreenShift: uint8
    cBlueBits: uint8
    cBlueShift: uint8
    cAlphaBits: uint8
    cAlphaShift: uint8
    cAccumBits: uint8
    cAccumRedBits: uint8
    cAccumGreenBits: uint8
    cAccumBlueBits: uint8
    cAccumAlphaBits: uint8
    cDepthBits: uint8
    cStencilBits: uint8
    cAuxBuffers: uint8
    iLayerPlane: uint8
    bReserved: uint8
    crTransparent: uint32
struct LAYERPLANEDESCRIPTOR
{
    ushort nSize;
    ushort nVersion;
    uint dwFlags;
    ubyte iPixelType;
    ubyte cColorBits;
    ubyte cRedBits;
    ubyte cRedShift;
    ubyte cGreenBits;
    ubyte cGreenShift;
    ubyte cBlueBits;
    ubyte cBlueShift;
    ubyte cAlphaBits;
    ubyte cAlphaShift;
    ubyte cAccumBits;
    ubyte cAccumRedBits;
    ubyte cAccumGreenBits;
    ubyte cAccumBlueBits;
    ubyte cAccumAlphaBits;
    ubyte cDepthBits;
    ubyte cStencilBits;
    ubyte cAuxBuffers;
    ubyte iLayerPlane;
    ubyte bReserved;
    uint crTransparent;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LAYERPLANEDESCRIPTOR サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; nSize : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; nVersion : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; iPixelType : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; cColorBits : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; cRedBits : BYTE (+10, 1byte)  poke st,10,値  /  値 = peek(st,10)
; cRedShift : BYTE (+11, 1byte)  poke st,11,値  /  値 = peek(st,11)
; cGreenBits : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; cGreenShift : BYTE (+13, 1byte)  poke st,13,値  /  値 = peek(st,13)
; cBlueBits : BYTE (+14, 1byte)  poke st,14,値  /  値 = peek(st,14)
; cBlueShift : BYTE (+15, 1byte)  poke st,15,値  /  値 = peek(st,15)
; cAlphaBits : BYTE (+16, 1byte)  poke st,16,値  /  値 = peek(st,16)
; cAlphaShift : BYTE (+17, 1byte)  poke st,17,値  /  値 = peek(st,17)
; cAccumBits : BYTE (+18, 1byte)  poke st,18,値  /  値 = peek(st,18)
; cAccumRedBits : BYTE (+19, 1byte)  poke st,19,値  /  値 = peek(st,19)
; cAccumGreenBits : BYTE (+20, 1byte)  poke st,20,値  /  値 = peek(st,20)
; cAccumBlueBits : BYTE (+21, 1byte)  poke st,21,値  /  値 = peek(st,21)
; cAccumAlphaBits : BYTE (+22, 1byte)  poke st,22,値  /  値 = peek(st,22)
; cDepthBits : BYTE (+23, 1byte)  poke st,23,値  /  値 = peek(st,23)
; cStencilBits : BYTE (+24, 1byte)  poke st,24,値  /  値 = peek(st,24)
; cAuxBuffers : BYTE (+25, 1byte)  poke st,25,値  /  値 = peek(st,25)
; iLayerPlane : BYTE (+26, 1byte)  poke st,26,値  /  値 = peek(st,26)
; bReserved : BYTE (+27, 1byte)  poke st,27,値  /  値 = peek(st,27)
; crTransparent : COLORREF (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global LAYERPLANEDESCRIPTOR
    #field short nSize
    #field short nVersion
    #field int dwFlags
    #field byte iPixelType
    #field byte cColorBits
    #field byte cRedBits
    #field byte cRedShift
    #field byte cGreenBits
    #field byte cGreenShift
    #field byte cBlueBits
    #field byte cBlueShift
    #field byte cAlphaBits
    #field byte cAlphaShift
    #field byte cAccumBits
    #field byte cAccumRedBits
    #field byte cAccumGreenBits
    #field byte cAccumBlueBits
    #field byte cAccumAlphaBits
    #field byte cDepthBits
    #field byte cStencilBits
    #field byte cAuxBuffers
    #field byte iLayerPlane
    #field byte bReserved
    #field int crTransparent
#endstruct

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