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

GdipRotateWorldTransform

関数
Graphicsのワールド変換に回転を適用する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

// gdiplus.dll
#include <windows.h>

Status GdipRotateWorldTransform(
    GpGraphics* graphics,
    FLOAT angle,
    MatrixOrder order
);

パラメーター

名前方向
graphicsGpGraphics*inout
angleFLOATin
orderMatrixOrderin

戻り値の型: Status

各言語での呼び出し定義

// gdiplus.dll
#include <windows.h>

Status GdipRotateWorldTransform(
    GpGraphics* graphics,
    FLOAT angle,
    MatrixOrder order
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipRotateWorldTransform(
    IntPtr graphics,   // GpGraphics* in/out
    float angle,   // FLOAT
    int order   // MatrixOrder
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipRotateWorldTransform(
    graphics As IntPtr,   ' GpGraphics* in/out
    angle As Single,   ' FLOAT
    order As Integer   ' MatrixOrder
) As Integer
End Function
' graphics : GpGraphics* in/out
' angle : FLOAT
' order : MatrixOrder
Declare PtrSafe Function GdipRotateWorldTransform Lib "gdiplus" ( _
    ByVal graphics As LongPtr, _
    ByVal angle 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

GdipRotateWorldTransform = ctypes.windll.gdiplus.GdipRotateWorldTransform
GdipRotateWorldTransform.restype = ctypes.c_int
GdipRotateWorldTransform.argtypes = [
    ctypes.c_void_p,  # graphics : GpGraphics* in/out
    ctypes.c_float,  # angle : FLOAT
    ctypes.c_int,  # order : MatrixOrder
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipRotateWorldTransform = Fiddle::Function.new(
  lib['GdipRotateWorldTransform'],
  [
    Fiddle::TYPE_VOIDP,  # graphics : GpGraphics* in/out
    Fiddle::TYPE_FLOAT,  # angle : FLOAT
    Fiddle::TYPE_INT,  # order : MatrixOrder
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipRotateWorldTransform(
        graphics: *mut GpGraphics,  // GpGraphics* in/out
        angle: f32,  // FLOAT
        order: i32  // MatrixOrder
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipRotateWorldTransform(IntPtr graphics, float angle, int order);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipRotateWorldTransform' -Namespace Win32 -PassThru
# $api::GdipRotateWorldTransform(graphics, angle, order)
#uselib "gdiplus.dll"
#func global GdipRotateWorldTransform "GdipRotateWorldTransform" sptr, float, sptr
; GdipRotateWorldTransform varptr(graphics), angle, order   ; 戻り値は stat
; graphics : GpGraphics* in/out -> "sptr"
; angle : FLOAT -> "float"
; order : MatrixOrder -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipRotateWorldTransform "GdipRotateWorldTransform" var, float, int
; res = GdipRotateWorldTransform(graphics, angle, order)
; graphics : GpGraphics* in/out -> "var"
; angle : FLOAT -> "float"
; order : MatrixOrder -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipRotateWorldTransform(GpGraphics* graphics, FLOAT angle, MatrixOrder order)
#uselib "gdiplus.dll"
#cfunc global GdipRotateWorldTransform "GdipRotateWorldTransform" var, float, int
; res = GdipRotateWorldTransform(graphics, angle, order)
; graphics : GpGraphics* in/out -> "var"
; angle : FLOAT -> "float"
; order : MatrixOrder -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipRotateWorldTransform = gdiplus.NewProc("GdipRotateWorldTransform")
)

// graphics (GpGraphics* in/out), angle (FLOAT), order (MatrixOrder)
r1, _, err := procGdipRotateWorldTransform.Call(
	uintptr(graphics),
	uintptr(math.Float32bits(angle)),
	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 GdipRotateWorldTransform(
  graphics: Pointer;   // GpGraphics* in/out
  angle: Single;   // FLOAT
  order: Integer   // MatrixOrder
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipRotateWorldTransform';
result := DllCall("gdiplus\GdipRotateWorldTransform"
    , "Ptr", graphics   ; GpGraphics* in/out
    , "Float", angle   ; FLOAT
    , "Int", order   ; MatrixOrder
    , "Int")   ; return: Status
●GdipRotateWorldTransform(graphics, angle, order) = DLL("gdiplus.dll", "int GdipRotateWorldTransform(void*, float, int)")
# 呼び出し: GdipRotateWorldTransform(graphics, angle, order)
# graphics : GpGraphics* in/out -> "void*"
# angle : FLOAT -> "float"
# order : MatrixOrder -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。