ホーム › Graphics.GdiPlus › GdipShearMatrix
GdipShearMatrix
関数変換行列にせん断(シアー)を適用する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipShearMatrix(
Matrix* matrix,
FLOAT shearX,
FLOAT shearY,
MatrixOrder order
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| matrix | Matrix* | inout | せん断変形を適用する対象の行列へのポインタ。 |
| shearX | FLOAT | in | X方向のせん断係数。水平方向の傾き量を指定する。 |
| shearY | FLOAT | in | Y方向のせん断係数。垂直方向の傾き量を指定する。 |
| order | MatrixOrder | in | せん断を前乗算するか後乗算するかを指定する列挙値。 |
戻り値の型: 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 varptr(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" var, float, float, int ; res = GdipShearMatrix(matrix, shearX, shearY, order) ; matrix : Matrix* in/out -> "var" ; shearX : FLOAT -> "float" ; shearY : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipShearMatrix "GdipShearMatrix" sptr, float, float, int ; res = GdipShearMatrix(varptr(matrix), shearX, shearY, order) ; matrix : Matrix* in/out -> "sptr" ; shearX : FLOAT -> "float" ; shearY : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipShearMatrix(Matrix* matrix, FLOAT shearX, FLOAT shearY, MatrixOrder order) #uselib "gdiplus.dll" #cfunc global GdipShearMatrix "GdipShearMatrix" var, float, float, int ; res = GdipShearMatrix(matrix, shearX, shearY, order) ; matrix : Matrix* in/out -> "var" ; shearX : FLOAT -> "float" ; shearY : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipShearMatrix(Matrix* matrix, FLOAT shearX, FLOAT shearY, MatrixOrder order) #uselib "gdiplus.dll" #cfunc global GdipShearMatrix "GdipShearMatrix" intptr, float, float, int ; res = GdipShearMatrix(varptr(matrix), shearX, shearY, order) ; matrix : Matrix* in/out -> "intptr" ; shearX : FLOAT -> "float" ; shearY : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
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)。const std = @import("std");
extern "gdiplus" fn GdipShearMatrix(
matrix: [*c]isize, // Matrix* in/out
shearX: f32, // FLOAT
shearY: f32, // FLOAT
order: i32 // MatrixOrder
) callconv(std.os.windows.WINAPI) i32;proc GdipShearMatrix(
matrix: ptr int, # Matrix* in/out
shearX: float32, # FLOAT
shearY: float32, # FLOAT
order: int32 # MatrixOrder
): int32 {.importc: "GdipShearMatrix", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipShearMatrix(
ptrdiff_t* matrix, // Matrix* in/out
float shearX, // FLOAT
float shearY, // FLOAT
int order // MatrixOrder
);ccall((:GdipShearMatrix, "gdiplus.dll"), stdcall, Int32,
(Ptr{Int}, Float32, Float32, Int32),
matrix, shearX, shearY, order)
# matrix : Matrix* in/out -> Ptr{Int}
# shearX : FLOAT -> Float32
# shearY : FLOAT -> Float32
# order : MatrixOrder -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipShearMatrix(
intptr_t* matrix,
float shearX,
float shearY,
int32_t order);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipShearMatrix(matrix, shearX, shearY, order)
-- matrix : Matrix* in/out
-- shearX : FLOAT
-- shearY : FLOAT
-- order : MatrixOrder
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipShearMatrix = lib.func('__stdcall', 'GdipShearMatrix', 'int32_t', ['intptr_t *', 'float', 'float', 'int32_t']);
// GdipShearMatrix(matrix, shearX, shearY, order)
// matrix : Matrix* in/out -> 'intptr_t *'
// shearX : FLOAT -> 'float'
// shearY : FLOAT -> 'float'
// order : MatrixOrder -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipShearMatrix: { parameters: ["pointer", "f32", "f32", "i32"], result: "i32" },
});
// lib.symbols.GdipShearMatrix(matrix, shearX, shearY, order)
// matrix : Matrix* in/out -> "pointer"
// shearX : FLOAT -> "f32"
// shearY : FLOAT -> "f32"
// order : MatrixOrder -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipShearMatrix(
intptr_t* matrix,
float shearX,
float shearY,
int32_t order);
C, "gdiplus.dll");
// $ffi->GdipShearMatrix(matrix, shearX, shearY, order);
// matrix : Matrix* in/out
// shearX : FLOAT
// shearY : FLOAT
// order : MatrixOrder
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Gdiplus extends StdCallLibrary {
Gdiplus INSTANCE = Native.load("gdiplus", Gdiplus.class);
int GdipShearMatrix(
LongByReference matrix, // Matrix* in/out
float shearX, // FLOAT
float shearY, // FLOAT
int order // MatrixOrder
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipShearMatrix = GdipShearMatrix(
matrix : LibC::SSizeT*, # Matrix* in/out
shearX : Float32, # FLOAT
shearY : Float32, # FLOAT
order : Int32 # MatrixOrder
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GdipShearMatrixNative = Int32 Function(Pointer<IntPtr>, Float, Float, Int32);
typedef GdipShearMatrixDart = int Function(Pointer<IntPtr>, double, double, int);
final GdipShearMatrix = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipShearMatrixNative, GdipShearMatrixDart>('GdipShearMatrix');
// matrix : Matrix* in/out -> Pointer<IntPtr>
// shearX : FLOAT -> Float
// shearY : FLOAT -> Float
// order : MatrixOrder -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipShearMatrix(
matrix: Pointer; // Matrix* in/out
shearX: Single; // FLOAT
shearY: Single; // FLOAT
order: Integer // MatrixOrder
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipShearMatrix';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipShearMatrix"
c_GdipShearMatrix :: Ptr CIntPtr -> CFloat -> CFloat -> Int32 -> IO Int32
-- matrix : Matrix* in/out -> Ptr CIntPtr
-- shearX : FLOAT -> CFloat
-- shearY : FLOAT -> CFloat
-- order : MatrixOrder -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipshearmatrix =
foreign "GdipShearMatrix"
((ptr intptr_t) @-> float @-> float @-> int32_t @-> returning int32_t)
(* matrix : Matrix* in/out -> (ptr intptr_t) *)
(* shearX : FLOAT -> float *)
(* shearY : FLOAT -> float *)
(* order : MatrixOrder -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)
(cffi:defcfun ("GdipShearMatrix" gdip-shear-matrix :convention :stdcall) :int32
(matrix :pointer) ; Matrix* in/out
(shear-x :float) ; FLOAT
(shear-y :float) ; FLOAT
(order :int32)) ; MatrixOrder
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipShearMatrix = Win32::API::More->new('gdiplus',
'int GdipShearMatrix(LPVOID matrix, float shearX, float shearY, int order)');
# my $ret = $GdipShearMatrix->Call($matrix, $shearX, $shearY, $order);
# matrix : Matrix* in/out -> LPVOID
# shearX : FLOAT -> float
# shearY : FLOAT -> float
# order : MatrixOrder -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。