ホーム › Graphics.Gdi › CombineTransform
CombineTransform
関数2つのワールド変換行列を合成して新たな行列を求める。
シグネチャ
// GDI32.dll
#include <windows.h>
BOOL CombineTransform(
XFORM* lpxfOut,
const XFORM* lpxf1,
const XFORM* lpxf2
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpxfOut | XFORM* | out |
| lpxf1 | XFORM* | in |
| lpxf2 | XFORM* | in |
戻り値の型: BOOL
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL CombineTransform(
XFORM* lpxfOut,
const XFORM* lpxf1,
const XFORM* lpxf2
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool CombineTransform(
IntPtr lpxfOut, // XFORM* out
IntPtr lpxf1, // XFORM*
IntPtr lpxf2 // XFORM*
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function CombineTransform(
lpxfOut As IntPtr, ' XFORM* out
lpxf1 As IntPtr, ' XFORM*
lpxf2 As IntPtr ' XFORM*
) As Boolean
End Function' lpxfOut : XFORM* out
' lpxf1 : XFORM*
' lpxf2 : XFORM*
Declare PtrSafe Function CombineTransform Lib "gdi32" ( _
ByVal lpxfOut As LongPtr, _
ByVal lpxf1 As LongPtr, _
ByVal lpxf2 As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CombineTransform = ctypes.windll.gdi32.CombineTransform
CombineTransform.restype = wintypes.BOOL
CombineTransform.argtypes = [
ctypes.c_void_p, # lpxfOut : XFORM* out
ctypes.c_void_p, # lpxf1 : XFORM*
ctypes.c_void_p, # lpxf2 : XFORM*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
CombineTransform = Fiddle::Function.new(
lib['CombineTransform'],
[
Fiddle::TYPE_VOIDP, # lpxfOut : XFORM* out
Fiddle::TYPE_VOIDP, # lpxf1 : XFORM*
Fiddle::TYPE_VOIDP, # lpxf2 : XFORM*
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn CombineTransform(
lpxfOut: *mut XFORM, // XFORM* out
lpxf1: *const XFORM, // XFORM*
lpxf2: *const XFORM // XFORM*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool CombineTransform(IntPtr lpxfOut, IntPtr lpxf1, IntPtr lpxf2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_CombineTransform' -Namespace Win32 -PassThru
# $api::CombineTransform(lpxfOut, lpxf1, lpxf2)#uselib "GDI32.dll"
#func global CombineTransform "CombineTransform" sptr, sptr, sptr
; CombineTransform varptr(lpxfOut), varptr(lpxf1), varptr(lpxf2) ; 戻り値は stat
; lpxfOut : XFORM* out -> "sptr"
; lpxf1 : XFORM* -> "sptr"
; lpxf2 : XFORM* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global CombineTransform "CombineTransform" var, var, var ; res = CombineTransform(lpxfOut, lpxf1, lpxf2) ; lpxfOut : XFORM* out -> "var" ; lpxf1 : XFORM* -> "var" ; lpxf2 : XFORM* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global CombineTransform "CombineTransform" sptr, sptr, sptr ; res = CombineTransform(varptr(lpxfOut), varptr(lpxf1), varptr(lpxf2)) ; lpxfOut : XFORM* out -> "sptr" ; lpxf1 : XFORM* -> "sptr" ; lpxf2 : XFORM* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CombineTransform(XFORM* lpxfOut, XFORM* lpxf1, XFORM* lpxf2) #uselib "GDI32.dll" #cfunc global CombineTransform "CombineTransform" var, var, var ; res = CombineTransform(lpxfOut, lpxf1, lpxf2) ; lpxfOut : XFORM* out -> "var" ; lpxf1 : XFORM* -> "var" ; lpxf2 : XFORM* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CombineTransform(XFORM* lpxfOut, XFORM* lpxf1, XFORM* lpxf2) #uselib "GDI32.dll" #cfunc global CombineTransform "CombineTransform" intptr, intptr, intptr ; res = CombineTransform(varptr(lpxfOut), varptr(lpxf1), varptr(lpxf2)) ; lpxfOut : XFORM* out -> "intptr" ; lpxf1 : XFORM* -> "intptr" ; lpxf2 : XFORM* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procCombineTransform = gdi32.NewProc("CombineTransform")
)
// lpxfOut (XFORM* out), lpxf1 (XFORM*), lpxf2 (XFORM*)
r1, _, err := procCombineTransform.Call(
uintptr(lpxfOut),
uintptr(lpxf1),
uintptr(lpxf2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CombineTransform(
lpxfOut: Pointer; // XFORM* out
lpxf1: Pointer; // XFORM*
lpxf2: Pointer // XFORM*
): BOOL; stdcall;
external 'GDI32.dll' name 'CombineTransform';result := DllCall("GDI32\CombineTransform"
, "Ptr", lpxfOut ; XFORM* out
, "Ptr", lpxf1 ; XFORM*
, "Ptr", lpxf2 ; XFORM*
, "Int") ; return: BOOL●CombineTransform(lpxfOut, lpxf1, lpxf2) = DLL("GDI32.dll", "bool CombineTransform(void*, void*, void*)")
# 呼び出し: CombineTransform(lpxfOut, lpxf1, lpxf2)
# lpxfOut : XFORM* out -> "void*"
# lpxf1 : XFORM* -> "void*"
# lpxf2 : XFORM* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。