ホーム › Graphics.GdiPlus › GdipScaleWorldTransform
GdipScaleWorldTransform
関数Graphicsのワールド変換に拡大縮小を適用する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipScaleWorldTransform(
GpGraphics* graphics,
FLOAT sx,
FLOAT sy,
MatrixOrder order
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| graphics | GpGraphics* | inout |
| sx | FLOAT | in |
| sy | FLOAT | in |
| order | MatrixOrder | in |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipScaleWorldTransform(
GpGraphics* graphics,
FLOAT sx,
FLOAT sy,
MatrixOrder order
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipScaleWorldTransform(
IntPtr graphics, // GpGraphics* in/out
float sx, // FLOAT
float sy, // FLOAT
int order // MatrixOrder
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipScaleWorldTransform(
graphics As IntPtr, ' GpGraphics* in/out
sx As Single, ' FLOAT
sy As Single, ' FLOAT
order As Integer ' MatrixOrder
) As Integer
End Function' graphics : GpGraphics* in/out
' sx : FLOAT
' sy : FLOAT
' order : MatrixOrder
Declare PtrSafe Function GdipScaleWorldTransform Lib "gdiplus" ( _
ByVal graphics As LongPtr, _
ByVal sx As Single, _
ByVal sy 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
GdipScaleWorldTransform = ctypes.windll.gdiplus.GdipScaleWorldTransform
GdipScaleWorldTransform.restype = ctypes.c_int
GdipScaleWorldTransform.argtypes = [
ctypes.c_void_p, # graphics : GpGraphics* in/out
ctypes.c_float, # sx : FLOAT
ctypes.c_float, # sy : FLOAT
ctypes.c_int, # order : MatrixOrder
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipScaleWorldTransform = Fiddle::Function.new(
lib['GdipScaleWorldTransform'],
[
Fiddle::TYPE_VOIDP, # graphics : GpGraphics* in/out
Fiddle::TYPE_FLOAT, # sx : FLOAT
Fiddle::TYPE_FLOAT, # sy : FLOAT
Fiddle::TYPE_INT, # order : MatrixOrder
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipScaleWorldTransform(
graphics: *mut GpGraphics, // GpGraphics* in/out
sx: f32, // FLOAT
sy: f32, // FLOAT
order: i32 // MatrixOrder
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipScaleWorldTransform(IntPtr graphics, float sx, float sy, int order);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipScaleWorldTransform' -Namespace Win32 -PassThru
# $api::GdipScaleWorldTransform(graphics, sx, sy, order)#uselib "gdiplus.dll"
#func global GdipScaleWorldTransform "GdipScaleWorldTransform" sptr, float, float, sptr
; GdipScaleWorldTransform varptr(graphics), sx, sy, order ; 戻り値は stat
; graphics : GpGraphics* in/out -> "sptr"
; sx : FLOAT -> "float"
; sy : FLOAT -> "float"
; order : MatrixOrder -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipScaleWorldTransform "GdipScaleWorldTransform" var, float, float, int ; res = GdipScaleWorldTransform(graphics, sx, sy, order) ; graphics : GpGraphics* in/out -> "var" ; sx : FLOAT -> "float" ; sy : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipScaleWorldTransform "GdipScaleWorldTransform" sptr, float, float, int ; res = GdipScaleWorldTransform(varptr(graphics), sx, sy, order) ; graphics : GpGraphics* in/out -> "sptr" ; sx : FLOAT -> "float" ; sy : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipScaleWorldTransform(GpGraphics* graphics, FLOAT sx, FLOAT sy, MatrixOrder order) #uselib "gdiplus.dll" #cfunc global GdipScaleWorldTransform "GdipScaleWorldTransform" var, float, float, int ; res = GdipScaleWorldTransform(graphics, sx, sy, order) ; graphics : GpGraphics* in/out -> "var" ; sx : FLOAT -> "float" ; sy : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipScaleWorldTransform(GpGraphics* graphics, FLOAT sx, FLOAT sy, MatrixOrder order) #uselib "gdiplus.dll" #cfunc global GdipScaleWorldTransform "GdipScaleWorldTransform" intptr, float, float, int ; res = GdipScaleWorldTransform(varptr(graphics), sx, sy, order) ; graphics : GpGraphics* in/out -> "intptr" ; sx : FLOAT -> "float" ; sy : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipScaleWorldTransform = gdiplus.NewProc("GdipScaleWorldTransform")
)
// graphics (GpGraphics* in/out), sx (FLOAT), sy (FLOAT), order (MatrixOrder)
r1, _, err := procGdipScaleWorldTransform.Call(
uintptr(graphics),
uintptr(math.Float32bits(sx)),
uintptr(math.Float32bits(sy)),
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 GdipScaleWorldTransform(
graphics: Pointer; // GpGraphics* in/out
sx: Single; // FLOAT
sy: Single; // FLOAT
order: Integer // MatrixOrder
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipScaleWorldTransform';result := DllCall("gdiplus\GdipScaleWorldTransform"
, "Ptr", graphics ; GpGraphics* in/out
, "Float", sx ; FLOAT
, "Float", sy ; FLOAT
, "Int", order ; MatrixOrder
, "Int") ; return: Status●GdipScaleWorldTransform(graphics, sx, sy, order) = DLL("gdiplus.dll", "int GdipScaleWorldTransform(void*, float, float, int)")
# 呼び出し: GdipScaleWorldTransform(graphics, sx, sy, order)
# graphics : GpGraphics* in/out -> "void*"
# sx : FLOAT -> "float"
# sy : FLOAT -> "float"
# order : MatrixOrder -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。