ホーム › Graphics.GdiPlus › GdipTranslateMatrix
GdipTranslateMatrix
関数変換行列に平行移動を適用する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipTranslateMatrix(
Matrix* matrix,
FLOAT offsetX,
FLOAT offsetY,
MatrixOrder order
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| matrix | Matrix* | inout |
| offsetX | FLOAT | in |
| offsetY | FLOAT | in |
| order | MatrixOrder | in |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipTranslateMatrix(
Matrix* matrix,
FLOAT offsetX,
FLOAT offsetY,
MatrixOrder order
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipTranslateMatrix(
ref IntPtr matrix, // Matrix* in/out
float offsetX, // FLOAT
float offsetY, // FLOAT
int order // MatrixOrder
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipTranslateMatrix(
ByRef matrix As IntPtr, ' Matrix* in/out
offsetX As Single, ' FLOAT
offsetY As Single, ' FLOAT
order As Integer ' MatrixOrder
) As Integer
End Function' matrix : Matrix* in/out
' offsetX : FLOAT
' offsetY : FLOAT
' order : MatrixOrder
Declare PtrSafe Function GdipTranslateMatrix Lib "gdiplus" ( _
ByRef matrix As LongPtr, _
ByVal offsetX As Single, _
ByVal offsetY As Single, _
ByVal order As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipTranslateMatrix = ctypes.windll.gdiplus.GdipTranslateMatrix
GdipTranslateMatrix.restype = ctypes.c_int
GdipTranslateMatrix.argtypes = [
ctypes.c_void_p, # matrix : Matrix* in/out
ctypes.c_float, # offsetX : FLOAT
ctypes.c_float, # offsetY : FLOAT
ctypes.c_int, # order : MatrixOrder
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipTranslateMatrix = Fiddle::Function.new(
lib['GdipTranslateMatrix'],
[
Fiddle::TYPE_VOIDP, # matrix : Matrix* in/out
Fiddle::TYPE_FLOAT, # offsetX : FLOAT
Fiddle::TYPE_FLOAT, # offsetY : FLOAT
Fiddle::TYPE_INT, # order : MatrixOrder
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipTranslateMatrix(
matrix: *mut isize, // Matrix* in/out
offsetX: f32, // FLOAT
offsetY: f32, // FLOAT
order: i32 // MatrixOrder
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipTranslateMatrix(ref IntPtr matrix, float offsetX, float offsetY, int order);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipTranslateMatrix' -Namespace Win32 -PassThru
# $api::GdipTranslateMatrix(matrix, offsetX, offsetY, order)#uselib "gdiplus.dll"
#func global GdipTranslateMatrix "GdipTranslateMatrix" sptr, float, float, sptr
; GdipTranslateMatrix matrix, offsetX, offsetY, order ; 戻り値は stat
; matrix : Matrix* in/out -> "sptr"
; offsetX : FLOAT -> "float"
; offsetY : FLOAT -> "float"
; order : MatrixOrder -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "gdiplus.dll"
#cfunc global GdipTranslateMatrix "GdipTranslateMatrix" int, float, float, int
; res = GdipTranslateMatrix(matrix, offsetX, offsetY, order)
; matrix : Matrix* in/out -> "int"
; offsetX : FLOAT -> "float"
; offsetY : FLOAT -> "float"
; order : MatrixOrder -> "int"; Status GdipTranslateMatrix(Matrix* matrix, FLOAT offsetX, FLOAT offsetY, MatrixOrder order)
#uselib "gdiplus.dll"
#cfunc global GdipTranslateMatrix "GdipTranslateMatrix" int, float, float, int
; res = GdipTranslateMatrix(matrix, offsetX, offsetY, order)
; matrix : Matrix* in/out -> "int"
; offsetX : FLOAT -> "float"
; offsetY : FLOAT -> "float"
; order : MatrixOrder -> "int"import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipTranslateMatrix = gdiplus.NewProc("GdipTranslateMatrix")
)
// matrix (Matrix* in/out), offsetX (FLOAT), offsetY (FLOAT), order (MatrixOrder)
r1, _, err := procGdipTranslateMatrix.Call(
uintptr(matrix),
uintptr(math.Float32bits(offsetX)),
uintptr(math.Float32bits(offsetY)),
uintptr(order),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Status
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。function GdipTranslateMatrix(
matrix: Pointer; // Matrix* in/out
offsetX: Single; // FLOAT
offsetY: Single; // FLOAT
order: Integer // MatrixOrder
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipTranslateMatrix';result := DllCall("gdiplus\GdipTranslateMatrix"
, "Ptr", matrix ; Matrix* in/out
, "Float", offsetX ; FLOAT
, "Float", offsetY ; FLOAT
, "Int", order ; MatrixOrder
, "Int") ; return: Status●GdipTranslateMatrix(matrix, offsetX, offsetY, order) = DLL("gdiplus.dll", "int GdipTranslateMatrix(void*, float, float, int)")
# 呼び出し: GdipTranslateMatrix(matrix, offsetX, offsetY, order)
# matrix : Matrix* in/out -> "void*"
# offsetX : FLOAT -> "float"
# offsetY : FLOAT -> "float"
# order : MatrixOrder -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。