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

GdipScaleMatrix

関数
変換行列に拡大縮小を適用する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipScaleMatrix(
    Matrix* matrix,
    FLOAT scaleX,
    FLOAT scaleY,
    MatrixOrder order
);

パラメーター

名前方向
matrixMatrix*inout
scaleXFLOATin
scaleYFLOATin
orderMatrixOrderin

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipScaleMatrix = ctypes.windll.gdiplus.GdipScaleMatrix
GdipScaleMatrix.restype = ctypes.c_int
GdipScaleMatrix.argtypes = [
    ctypes.c_void_p,  # matrix : Matrix* in/out
    ctypes.c_float,  # scaleX : FLOAT
    ctypes.c_float,  # scaleY : FLOAT
    ctypes.c_int,  # order : MatrixOrder
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipScaleMatrix = Fiddle::Function.new(
  lib['GdipScaleMatrix'],
  [
    Fiddle::TYPE_VOIDP,  # matrix : Matrix* in/out
    Fiddle::TYPE_FLOAT,  # scaleX : FLOAT
    Fiddle::TYPE_FLOAT,  # scaleY : FLOAT
    Fiddle::TYPE_INT,  # order : MatrixOrder
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipScaleMatrix(
        matrix: *mut isize,  // Matrix* in/out
        scaleX: f32,  // FLOAT
        scaleY: f32,  // FLOAT
        order: i32  // MatrixOrder
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipScaleMatrix(ref IntPtr matrix, float scaleX, float scaleY, int order);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipScaleMatrix' -Namespace Win32 -PassThru
# $api::GdipScaleMatrix(matrix, scaleX, scaleY, order)
#uselib "gdiplus.dll"
#func global GdipScaleMatrix "GdipScaleMatrix" sptr, float, float, sptr
; GdipScaleMatrix matrix, scaleX, scaleY, order   ; 戻り値は stat
; matrix : Matrix* in/out -> "sptr"
; scaleX : FLOAT -> "float"
; scaleY : FLOAT -> "float"
; order : MatrixOrder -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "gdiplus.dll"
#cfunc global GdipScaleMatrix "GdipScaleMatrix" int, float, float, int
; res = GdipScaleMatrix(matrix, scaleX, scaleY, order)
; matrix : Matrix* in/out -> "int"
; scaleX : FLOAT -> "float"
; scaleY : FLOAT -> "float"
; order : MatrixOrder -> "int"
; Status GdipScaleMatrix(Matrix* matrix, FLOAT scaleX, FLOAT scaleY, MatrixOrder order)
#uselib "gdiplus.dll"
#cfunc global GdipScaleMatrix "GdipScaleMatrix" int, float, float, int
; res = GdipScaleMatrix(matrix, scaleX, scaleY, order)
; matrix : Matrix* in/out -> "int"
; scaleX : FLOAT -> "float"
; scaleY : FLOAT -> "float"
; order : MatrixOrder -> "int"
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipScaleMatrix = gdiplus.NewProc("GdipScaleMatrix")
)

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