ホーム › Storage.Xps › XPS_MATRIX
XPS_MATRIX
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| m11 | FLOAT | 4 | +0 | +0 | アフィン変換行列の(1,1)成分。 |
| m12 | FLOAT | 4 | +4 | +4 | アフィン変換行列の(1,2)成分。 |
| m21 | FLOAT | 4 | +8 | +8 | アフィン変換行列の(2,1)成分。 |
| m22 | FLOAT | 4 | +12 | +12 | アフィン変換行列の(2,2)成分。 |
| m31 | FLOAT | 4 | +16 | +16 | アフィン変換行列の平行移動X成分。 |
| m32 | FLOAT | 4 | +20 | +20 | アフィン変換行列の平行移動Y成分。 |
各言語での定義
#include <windows.h>
// XPS_MATRIX (x64 24 / x86 24 バイト)
typedef struct XPS_MATRIX {
FLOAT m11;
FLOAT m12;
FLOAT m21;
FLOAT m22;
FLOAT m31;
FLOAT m32;
} XPS_MATRIX;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XPS_MATRIX
{
public float m11;
public float m12;
public float m21;
public float m22;
public float m31;
public float m32;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XPS_MATRIX
Public m11 As Single
Public m12 As Single
Public m21 As Single
Public m22 As Single
Public m31 As Single
Public m32 As Single
End Structureimport ctypes
from ctypes import wintypes
class XPS_MATRIX(ctypes.Structure):
_fields_ = [
("m11", ctypes.c_float),
("m12", ctypes.c_float),
("m21", ctypes.c_float),
("m22", ctypes.c_float),
("m31", ctypes.c_float),
("m32", ctypes.c_float),
]#[repr(C)]
pub struct XPS_MATRIX {
pub m11: f32,
pub m12: f32,
pub m21: f32,
pub m22: f32,
pub m31: f32,
pub m32: f32,
}import "golang.org/x/sys/windows"
type XPS_MATRIX struct {
m11 float32
m12 float32
m21 float32
m22 float32
m31 float32
m32 float32
}type
XPS_MATRIX = record
m11: Single;
m12: Single;
m21: Single;
m22: Single;
m31: Single;
m32: Single;
end;const XPS_MATRIX = extern struct {
m11: f32,
m12: f32,
m21: f32,
m22: f32,
m31: f32,
m32: f32,
};type
XPS_MATRIX {.bycopy.} = object
m11: float32
m12: float32
m21: float32
m22: float32
m31: float32
m32: float32struct XPS_MATRIX
{
float m11;
float m12;
float m21;
float m22;
float m31;
float m32;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; XPS_MATRIX サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; m11 : FLOAT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; m12 : FLOAT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; m21 : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; m22 : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; m31 : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; m32 : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global XPS_MATRIX
#field float m11
#field float m12
#field float m21
#field float m22
#field float m31
#field float m32
#endstruct
stdim st, XPS_MATRIX ; NSTRUCT 変数を確保
st->m11 = 100
mes "m11=" + st->m11