ホーム › Graphics.GdiPlus › GdipCreateTexture
GdipCreateTexture
関数画像を元にテクスチャブラシを作成する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipCreateTexture(
GpImage* image,
WrapMode wrapmode,
GpTexture** texture
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| image | GpImage* | inout |
| wrapmode | WrapMode | in |
| texture | GpTexture** | inout |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipCreateTexture(
GpImage* image,
WrapMode wrapmode,
GpTexture** texture
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipCreateTexture(
IntPtr image, // GpImage* in/out
int wrapmode, // WrapMode
IntPtr texture // GpTexture** in/out
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipCreateTexture(
image As IntPtr, ' GpImage* in/out
wrapmode As Integer, ' WrapMode
texture As IntPtr ' GpTexture** in/out
) As Integer
End Function' image : GpImage* in/out
' wrapmode : WrapMode
' texture : GpTexture** in/out
Declare PtrSafe Function GdipCreateTexture Lib "gdiplus" ( _
ByVal image As LongPtr, _
ByVal wrapmode As Long, _
ByVal texture As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipCreateTexture = ctypes.windll.gdiplus.GdipCreateTexture
GdipCreateTexture.restype = ctypes.c_int
GdipCreateTexture.argtypes = [
ctypes.c_void_p, # image : GpImage* in/out
ctypes.c_int, # wrapmode : WrapMode
ctypes.c_void_p, # texture : GpTexture** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipCreateTexture = Fiddle::Function.new(
lib['GdipCreateTexture'],
[
Fiddle::TYPE_VOIDP, # image : GpImage* in/out
Fiddle::TYPE_INT, # wrapmode : WrapMode
Fiddle::TYPE_VOIDP, # texture : GpTexture** in/out
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipCreateTexture(
image: *mut GpImage, // GpImage* in/out
wrapmode: i32, // WrapMode
texture: *mut *mut GpTexture // GpTexture** in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipCreateTexture(IntPtr image, int wrapmode, IntPtr texture);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipCreateTexture' -Namespace Win32 -PassThru
# $api::GdipCreateTexture(image, wrapmode, texture)#uselib "gdiplus.dll"
#func global GdipCreateTexture "GdipCreateTexture" sptr, sptr, sptr
; GdipCreateTexture varptr(image), wrapmode, varptr(texture) ; 戻り値は stat
; image : GpImage* in/out -> "sptr"
; wrapmode : WrapMode -> "sptr"
; texture : GpTexture** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipCreateTexture "GdipCreateTexture" var, int, var ; res = GdipCreateTexture(image, wrapmode, texture) ; image : GpImage* in/out -> "var" ; wrapmode : WrapMode -> "int" ; texture : GpTexture** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipCreateTexture "GdipCreateTexture" sptr, int, sptr ; res = GdipCreateTexture(varptr(image), wrapmode, varptr(texture)) ; image : GpImage* in/out -> "sptr" ; wrapmode : WrapMode -> "int" ; texture : GpTexture** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipCreateTexture(GpImage* image, WrapMode wrapmode, GpTexture** texture) #uselib "gdiplus.dll" #cfunc global GdipCreateTexture "GdipCreateTexture" var, int, var ; res = GdipCreateTexture(image, wrapmode, texture) ; image : GpImage* in/out -> "var" ; wrapmode : WrapMode -> "int" ; texture : GpTexture** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipCreateTexture(GpImage* image, WrapMode wrapmode, GpTexture** texture) #uselib "gdiplus.dll" #cfunc global GdipCreateTexture "GdipCreateTexture" intptr, int, intptr ; res = GdipCreateTexture(varptr(image), wrapmode, varptr(texture)) ; image : GpImage* in/out -> "intptr" ; wrapmode : WrapMode -> "int" ; texture : GpTexture** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipCreateTexture = gdiplus.NewProc("GdipCreateTexture")
)
// image (GpImage* in/out), wrapmode (WrapMode), texture (GpTexture** in/out)
r1, _, err := procGdipCreateTexture.Call(
uintptr(image),
uintptr(wrapmode),
uintptr(texture),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipCreateTexture(
image: Pointer; // GpImage* in/out
wrapmode: Integer; // WrapMode
texture: Pointer // GpTexture** in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipCreateTexture';result := DllCall("gdiplus\GdipCreateTexture"
, "Ptr", image ; GpImage* in/out
, "Int", wrapmode ; WrapMode
, "Ptr", texture ; GpTexture** in/out
, "Int") ; return: Status●GdipCreateTexture(image, wrapmode, texture) = DLL("gdiplus.dll", "int GdipCreateTexture(void*, int, void*)")
# 呼び出し: GdipCreateTexture(image, wrapmode, texture)
# image : GpImage* in/out -> "void*"
# wrapmode : WrapMode -> "int"
# texture : GpTexture** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。