ホーム › Graphics.GdiPlus › GdipTranslateWorldTransform
GdipTranslateWorldTransform
関数Graphicsのワールド変換に平行移動を適用する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipTranslateWorldTransform(
GpGraphics* graphics,
FLOAT dx,
FLOAT dy,
MatrixOrder order
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| graphics | GpGraphics* | inout | 対象のGpGraphicsオブジェクトへのポインタ。 |
| dx | FLOAT | in | ワールド変換に適用する水平方向の平行移動量。 |
| dy | FLOAT | in | ワールド変換に適用する垂直方向の平行移動量。 |
| order | MatrixOrder | in | 変換の適用順序を示すMatrixOrder列挙値(Prepend/Append)。 |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipTranslateWorldTransform(
GpGraphics* graphics,
FLOAT dx,
FLOAT dy,
MatrixOrder order
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipTranslateWorldTransform(
IntPtr graphics, // GpGraphics* in/out
float dx, // FLOAT
float dy, // FLOAT
int order // MatrixOrder
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipTranslateWorldTransform(
graphics As IntPtr, ' GpGraphics* in/out
dx As Single, ' FLOAT
dy As Single, ' FLOAT
order As Integer ' MatrixOrder
) As Integer
End Function' graphics : GpGraphics* in/out
' dx : FLOAT
' dy : FLOAT
' order : MatrixOrder
Declare PtrSafe Function GdipTranslateWorldTransform Lib "gdiplus" ( _
ByVal graphics As LongPtr, _
ByVal dx As Single, _
ByVal dy 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
GdipTranslateWorldTransform = ctypes.windll.gdiplus.GdipTranslateWorldTransform
GdipTranslateWorldTransform.restype = ctypes.c_int
GdipTranslateWorldTransform.argtypes = [
ctypes.c_void_p, # graphics : GpGraphics* in/out
ctypes.c_float, # dx : FLOAT
ctypes.c_float, # dy : FLOAT
ctypes.c_int, # order : MatrixOrder
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipTranslateWorldTransform = Fiddle::Function.new(
lib['GdipTranslateWorldTransform'],
[
Fiddle::TYPE_VOIDP, # graphics : GpGraphics* in/out
Fiddle::TYPE_FLOAT, # dx : FLOAT
Fiddle::TYPE_FLOAT, # dy : FLOAT
Fiddle::TYPE_INT, # order : MatrixOrder
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipTranslateWorldTransform(
graphics: *mut GpGraphics, // GpGraphics* in/out
dx: f32, // FLOAT
dy: f32, // FLOAT
order: i32 // MatrixOrder
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipTranslateWorldTransform(IntPtr graphics, float dx, float dy, int order);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipTranslateWorldTransform' -Namespace Win32 -PassThru
# $api::GdipTranslateWorldTransform(graphics, dx, dy, order)#uselib "gdiplus.dll"
#func global GdipTranslateWorldTransform "GdipTranslateWorldTransform" sptr, float, float, sptr
; GdipTranslateWorldTransform varptr(graphics), dx, dy, order ; 戻り値は stat
; graphics : GpGraphics* in/out -> "sptr"
; dx : FLOAT -> "float"
; dy : FLOAT -> "float"
; order : MatrixOrder -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipTranslateWorldTransform "GdipTranslateWorldTransform" var, float, float, int ; res = GdipTranslateWorldTransform(graphics, dx, dy, order) ; graphics : GpGraphics* in/out -> "var" ; dx : FLOAT -> "float" ; dy : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipTranslateWorldTransform "GdipTranslateWorldTransform" sptr, float, float, int ; res = GdipTranslateWorldTransform(varptr(graphics), dx, dy, order) ; graphics : GpGraphics* in/out -> "sptr" ; dx : FLOAT -> "float" ; dy : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipTranslateWorldTransform(GpGraphics* graphics, FLOAT dx, FLOAT dy, MatrixOrder order) #uselib "gdiplus.dll" #cfunc global GdipTranslateWorldTransform "GdipTranslateWorldTransform" var, float, float, int ; res = GdipTranslateWorldTransform(graphics, dx, dy, order) ; graphics : GpGraphics* in/out -> "var" ; dx : FLOAT -> "float" ; dy : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipTranslateWorldTransform(GpGraphics* graphics, FLOAT dx, FLOAT dy, MatrixOrder order) #uselib "gdiplus.dll" #cfunc global GdipTranslateWorldTransform "GdipTranslateWorldTransform" intptr, float, float, int ; res = GdipTranslateWorldTransform(varptr(graphics), dx, dy, order) ; graphics : GpGraphics* in/out -> "intptr" ; dx : FLOAT -> "float" ; dy : FLOAT -> "float" ; order : MatrixOrder -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipTranslateWorldTransform = gdiplus.NewProc("GdipTranslateWorldTransform")
)
// graphics (GpGraphics* in/out), dx (FLOAT), dy (FLOAT), order (MatrixOrder)
r1, _, err := procGdipTranslateWorldTransform.Call(
uintptr(graphics),
uintptr(math.Float32bits(dx)),
uintptr(math.Float32bits(dy)),
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 GdipTranslateWorldTransform(
graphics: Pointer; // GpGraphics* in/out
dx: Single; // FLOAT
dy: Single; // FLOAT
order: Integer // MatrixOrder
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipTranslateWorldTransform';result := DllCall("gdiplus\GdipTranslateWorldTransform"
, "Ptr", graphics ; GpGraphics* in/out
, "Float", dx ; FLOAT
, "Float", dy ; FLOAT
, "Int", order ; MatrixOrder
, "Int") ; return: Status●GdipTranslateWorldTransform(graphics, dx, dy, order) = DLL("gdiplus.dll", "int GdipTranslateWorldTransform(void*, float, float, int)")
# 呼び出し: GdipTranslateWorldTransform(graphics, dx, dy, order)
# graphics : GpGraphics* in/out -> "void*"
# dx : FLOAT -> "float"
# dy : FLOAT -> "float"
# order : MatrixOrder -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdiplus" fn GdipTranslateWorldTransform(
graphics: [*c]GpGraphics, // GpGraphics* in/out
dx: f32, // FLOAT
dy: f32, // FLOAT
order: i32 // MatrixOrder
) callconv(std.os.windows.WINAPI) i32;proc GdipTranslateWorldTransform(
graphics: ptr GpGraphics, # GpGraphics* in/out
dx: float32, # FLOAT
dy: float32, # FLOAT
order: int32 # MatrixOrder
): int32 {.importc: "GdipTranslateWorldTransform", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipTranslateWorldTransform(
GpGraphics* graphics, // GpGraphics* in/out
float dx, // FLOAT
float dy, // FLOAT
int order // MatrixOrder
);ccall((:GdipTranslateWorldTransform, "gdiplus.dll"), stdcall, Int32,
(Ptr{GpGraphics}, Float32, Float32, Int32),
graphics, dx, dy, order)
# graphics : GpGraphics* in/out -> Ptr{GpGraphics}
# dx : FLOAT -> Float32
# dy : FLOAT -> Float32
# order : MatrixOrder -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipTranslateWorldTransform(
void* graphics,
float dx,
float dy,
int32_t order);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipTranslateWorldTransform(graphics, dx, dy, order)
-- graphics : GpGraphics* in/out
-- dx : FLOAT
-- dy : FLOAT
-- order : MatrixOrder
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipTranslateWorldTransform = lib.func('__stdcall', 'GdipTranslateWorldTransform', 'int32_t', ['void *', 'float', 'float', 'int32_t']);
// GdipTranslateWorldTransform(graphics, dx, dy, order)
// graphics : GpGraphics* in/out -> 'void *'
// dx : FLOAT -> 'float'
// dy : FLOAT -> 'float'
// order : MatrixOrder -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipTranslateWorldTransform: { parameters: ["pointer", "f32", "f32", "i32"], result: "i32" },
});
// lib.symbols.GdipTranslateWorldTransform(graphics, dx, dy, order)
// graphics : GpGraphics* in/out -> "pointer"
// dx : FLOAT -> "f32"
// dy : FLOAT -> "f32"
// order : MatrixOrder -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipTranslateWorldTransform(
void* graphics,
float dx,
float dy,
int32_t order);
C, "gdiplus.dll");
// $ffi->GdipTranslateWorldTransform(graphics, dx, dy, order);
// graphics : GpGraphics* in/out
// dx : FLOAT
// dy : 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 GdipTranslateWorldTransform(
Pointer graphics, // GpGraphics* in/out
float dx, // FLOAT
float dy, // FLOAT
int order // MatrixOrder
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipTranslateWorldTransform = GdipTranslateWorldTransform(
graphics : GpGraphics*, # GpGraphics* in/out
dx : Float32, # FLOAT
dy : 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 GdipTranslateWorldTransformNative = Int32 Function(Pointer<Void>, Float, Float, Int32);
typedef GdipTranslateWorldTransformDart = int Function(Pointer<Void>, double, double, int);
final GdipTranslateWorldTransform = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipTranslateWorldTransformNative, GdipTranslateWorldTransformDart>('GdipTranslateWorldTransform');
// graphics : GpGraphics* in/out -> Pointer<Void>
// dx : FLOAT -> Float
// dy : FLOAT -> Float
// order : MatrixOrder -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipTranslateWorldTransform(
graphics: Pointer; // GpGraphics* in/out
dx: Single; // FLOAT
dy: Single; // FLOAT
order: Integer // MatrixOrder
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipTranslateWorldTransform';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipTranslateWorldTransform"
c_GdipTranslateWorldTransform :: Ptr () -> CFloat -> CFloat -> Int32 -> IO Int32
-- graphics : GpGraphics* in/out -> Ptr ()
-- dx : FLOAT -> CFloat
-- dy : FLOAT -> CFloat
-- order : MatrixOrder -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdiptranslateworldtransform =
foreign "GdipTranslateWorldTransform"
((ptr void) @-> float @-> float @-> int32_t @-> returning int32_t)
(* graphics : GpGraphics* in/out -> (ptr void) *)
(* dx : FLOAT -> float *)
(* dy : 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 ("GdipTranslateWorldTransform" gdip-translate-world-transform :convention :stdcall) :int32
(graphics :pointer) ; GpGraphics* in/out
(dx :float) ; FLOAT
(dy :float) ; FLOAT
(order :int32)) ; MatrixOrder
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipTranslateWorldTransform = Win32::API::More->new('gdiplus',
'int GdipTranslateWorldTransform(LPVOID graphics, float dx, float dy, int order)');
# my $ret = $GdipTranslateWorldTransform->Call($graphics, $dx, $dy, $order);
# graphics : GpGraphics* in/out -> LPVOID
# dx : FLOAT -> float
# dy : FLOAT -> float
# order : MatrixOrder -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。