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

GdipShearMatrix

関数
変換行列にせん断(シアー)を適用する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipShearMatrix(
    Matrix* matrix,
    FLOAT shearX,
    FLOAT shearY,
    MatrixOrder order
);

パラメーター

名前方向
matrixMatrix*inout
shearXFLOATin
shearYFLOATin
orderMatrixOrderin

戻り値の型: Status

各言語での呼び出し定義

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

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

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

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipShearMatrix = gdiplus.NewProc("GdipShearMatrix")
)

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