ホーム › Graphics.GdiPlus › GdipCreateTexture2I
GdipCreateTexture2I
関数画像の整数領域からテクスチャブラシを作成する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipCreateTexture2I(
GpImage* image,
WrapMode wrapmode,
INT x,
INT y,
INT width,
INT height,
GpTexture** texture
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| image | GpImage* | inout | テクスチャの元となる画像オブジェクトへのポインタ。 |
| wrapmode | WrapMode | in | 画像の繰り返し方法を指定する列挙値。 |
| x | INT | in | 使用する画像領域の左上X座標(整数)。 |
| y | INT | in | 使用する画像領域の左上Y座標(整数)。 |
| width | INT | in | 使用する画像領域の幅(整数)。 |
| height | INT | in | 使用する画像領域の高さ(整数)。 |
| texture | GpTexture** | inout | 生成されたテクスチャブラシを受け取るポインタのアドレス。 |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipCreateTexture2I(
GpImage* image,
WrapMode wrapmode,
INT x,
INT y,
INT width,
INT height,
GpTexture** texture
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipCreateTexture2I(
IntPtr image, // GpImage* in/out
int wrapmode, // WrapMode
int x, // INT
int y, // INT
int width, // INT
int height, // INT
IntPtr texture // GpTexture** in/out
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipCreateTexture2I(
image As IntPtr, ' GpImage* in/out
wrapmode As Integer, ' WrapMode
x As Integer, ' INT
y As Integer, ' INT
width As Integer, ' INT
height As Integer, ' INT
texture As IntPtr ' GpTexture** in/out
) As Integer
End Function' image : GpImage* in/out
' wrapmode : WrapMode
' x : INT
' y : INT
' width : INT
' height : INT
' texture : GpTexture** in/out
Declare PtrSafe Function GdipCreateTexture2I Lib "gdiplus" ( _
ByVal image As LongPtr, _
ByVal wrapmode As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal width As Long, _
ByVal height 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
GdipCreateTexture2I = ctypes.windll.gdiplus.GdipCreateTexture2I
GdipCreateTexture2I.restype = ctypes.c_int
GdipCreateTexture2I.argtypes = [
ctypes.c_void_p, # image : GpImage* in/out
ctypes.c_int, # wrapmode : WrapMode
ctypes.c_int, # x : INT
ctypes.c_int, # y : INT
ctypes.c_int, # width : INT
ctypes.c_int, # height : INT
ctypes.c_void_p, # texture : GpTexture** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipCreateTexture2I = Fiddle::Function.new(
lib['GdipCreateTexture2I'],
[
Fiddle::TYPE_VOIDP, # image : GpImage* in/out
Fiddle::TYPE_INT, # wrapmode : WrapMode
Fiddle::TYPE_INT, # x : INT
Fiddle::TYPE_INT, # y : INT
Fiddle::TYPE_INT, # width : INT
Fiddle::TYPE_INT, # height : INT
Fiddle::TYPE_VOIDP, # texture : GpTexture** in/out
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipCreateTexture2I(
image: *mut GpImage, // GpImage* in/out
wrapmode: i32, // WrapMode
x: i32, // INT
y: i32, // INT
width: i32, // INT
height: i32, // INT
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 GdipCreateTexture2I(IntPtr image, int wrapmode, int x, int y, int width, int height, IntPtr texture);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipCreateTexture2I' -Namespace Win32 -PassThru
# $api::GdipCreateTexture2I(image, wrapmode, x, y, width, height, texture)#uselib "gdiplus.dll"
#func global GdipCreateTexture2I "GdipCreateTexture2I" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GdipCreateTexture2I varptr(image), wrapmode, x, y, width, height, varptr(texture) ; 戻り値は stat
; image : GpImage* in/out -> "sptr"
; wrapmode : WrapMode -> "sptr"
; x : INT -> "sptr"
; y : INT -> "sptr"
; width : INT -> "sptr"
; height : INT -> "sptr"
; texture : GpTexture** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipCreateTexture2I "GdipCreateTexture2I" var, int, int, int, int, int, var ; res = GdipCreateTexture2I(image, wrapmode, x, y, width, height, texture) ; image : GpImage* in/out -> "var" ; wrapmode : WrapMode -> "int" ; x : INT -> "int" ; y : INT -> "int" ; width : INT -> "int" ; height : INT -> "int" ; texture : GpTexture** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipCreateTexture2I "GdipCreateTexture2I" sptr, int, int, int, int, int, sptr ; res = GdipCreateTexture2I(varptr(image), wrapmode, x, y, width, height, varptr(texture)) ; image : GpImage* in/out -> "sptr" ; wrapmode : WrapMode -> "int" ; x : INT -> "int" ; y : INT -> "int" ; width : INT -> "int" ; height : INT -> "int" ; texture : GpTexture** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipCreateTexture2I(GpImage* image, WrapMode wrapmode, INT x, INT y, INT width, INT height, GpTexture** texture) #uselib "gdiplus.dll" #cfunc global GdipCreateTexture2I "GdipCreateTexture2I" var, int, int, int, int, int, var ; res = GdipCreateTexture2I(image, wrapmode, x, y, width, height, texture) ; image : GpImage* in/out -> "var" ; wrapmode : WrapMode -> "int" ; x : INT -> "int" ; y : INT -> "int" ; width : INT -> "int" ; height : INT -> "int" ; texture : GpTexture** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipCreateTexture2I(GpImage* image, WrapMode wrapmode, INT x, INT y, INT width, INT height, GpTexture** texture) #uselib "gdiplus.dll" #cfunc global GdipCreateTexture2I "GdipCreateTexture2I" intptr, int, int, int, int, int, intptr ; res = GdipCreateTexture2I(varptr(image), wrapmode, x, y, width, height, varptr(texture)) ; image : GpImage* in/out -> "intptr" ; wrapmode : WrapMode -> "int" ; x : INT -> "int" ; y : INT -> "int" ; width : INT -> "int" ; height : INT -> "int" ; texture : GpTexture** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipCreateTexture2I = gdiplus.NewProc("GdipCreateTexture2I")
)
// image (GpImage* in/out), wrapmode (WrapMode), x (INT), y (INT), width (INT), height (INT), texture (GpTexture** in/out)
r1, _, err := procGdipCreateTexture2I.Call(
uintptr(image),
uintptr(wrapmode),
uintptr(x),
uintptr(y),
uintptr(width),
uintptr(height),
uintptr(texture),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipCreateTexture2I(
image: Pointer; // GpImage* in/out
wrapmode: Integer; // WrapMode
x: Integer; // INT
y: Integer; // INT
width: Integer; // INT
height: Integer; // INT
texture: Pointer // GpTexture** in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipCreateTexture2I';result := DllCall("gdiplus\GdipCreateTexture2I"
, "Ptr", image ; GpImage* in/out
, "Int", wrapmode ; WrapMode
, "Int", x ; INT
, "Int", y ; INT
, "Int", width ; INT
, "Int", height ; INT
, "Ptr", texture ; GpTexture** in/out
, "Int") ; return: Status●GdipCreateTexture2I(image, wrapmode, x, y, width, height, texture) = DLL("gdiplus.dll", "int GdipCreateTexture2I(void*, int, int, int, int, int, void*)")
# 呼び出し: GdipCreateTexture2I(image, wrapmode, x, y, width, height, texture)
# image : GpImage* in/out -> "void*"
# wrapmode : WrapMode -> "int"
# x : INT -> "int"
# y : INT -> "int"
# width : INT -> "int"
# height : INT -> "int"
# texture : GpTexture** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdiplus" fn GdipCreateTexture2I(
image: [*c]GpImage, // GpImage* in/out
wrapmode: i32, // WrapMode
x: i32, // INT
y: i32, // INT
width: i32, // INT
height: i32, // INT
texture: [*c][*c]GpTexture // GpTexture** in/out
) callconv(std.os.windows.WINAPI) i32;proc GdipCreateTexture2I(
image: ptr GpImage, # GpImage* in/out
wrapmode: int32, # WrapMode
x: int32, # INT
y: int32, # INT
width: int32, # INT
height: int32, # INT
texture: ptr GpTexture # GpTexture** in/out
): int32 {.importc: "GdipCreateTexture2I", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipCreateTexture2I(
GpImage* image, // GpImage* in/out
int wrapmode, // WrapMode
int x, // INT
int y, // INT
int width, // INT
int height, // INT
GpTexture** texture // GpTexture** in/out
);ccall((:GdipCreateTexture2I, "gdiplus.dll"), stdcall, Int32,
(Ptr{GpImage}, Int32, Int32, Int32, Int32, Int32, Ptr{GpTexture}),
image, wrapmode, x, y, width, height, texture)
# image : GpImage* in/out -> Ptr{GpImage}
# wrapmode : WrapMode -> Int32
# x : INT -> Int32
# y : INT -> Int32
# width : INT -> Int32
# height : INT -> Int32
# texture : GpTexture** in/out -> Ptr{GpTexture}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipCreateTexture2I(
void* image,
int32_t wrapmode,
int32_t x,
int32_t y,
int32_t width,
int32_t height,
void* texture);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipCreateTexture2I(image, wrapmode, x, y, width, height, texture)
-- image : GpImage* in/out
-- wrapmode : WrapMode
-- x : INT
-- y : INT
-- width : INT
-- height : INT
-- texture : GpTexture** in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipCreateTexture2I = lib.func('__stdcall', 'GdipCreateTexture2I', 'int32_t', ['void *', 'int32_t', 'int32_t', 'int32_t', 'int32_t', 'int32_t', 'void *']);
// GdipCreateTexture2I(image, wrapmode, x, y, width, height, texture)
// image : GpImage* in/out -> 'void *'
// wrapmode : WrapMode -> 'int32_t'
// x : INT -> 'int32_t'
// y : INT -> 'int32_t'
// width : INT -> 'int32_t'
// height : INT -> 'int32_t'
// texture : GpTexture** in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipCreateTexture2I: { parameters: ["pointer", "i32", "i32", "i32", "i32", "i32", "pointer"], result: "i32" },
});
// lib.symbols.GdipCreateTexture2I(image, wrapmode, x, y, width, height, texture)
// image : GpImage* in/out -> "pointer"
// wrapmode : WrapMode -> "i32"
// x : INT -> "i32"
// y : INT -> "i32"
// width : INT -> "i32"
// height : INT -> "i32"
// texture : GpTexture** in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipCreateTexture2I(
void* image,
int32_t wrapmode,
int32_t x,
int32_t y,
int32_t width,
int32_t height,
void* texture);
C, "gdiplus.dll");
// $ffi->GdipCreateTexture2I(image, wrapmode, x, y, width, height, texture);
// image : GpImage* in/out
// wrapmode : WrapMode
// x : INT
// y : INT
// width : INT
// height : INT
// texture : GpTexture** in/out
// 構造体/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 GdipCreateTexture2I(
Pointer image, // GpImage* in/out
int wrapmode, // WrapMode
int x, // INT
int y, // INT
int width, // INT
int height, // INT
Pointer texture // GpTexture** in/out
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipCreateTexture2I = GdipCreateTexture2I(
image : GpImage*, # GpImage* in/out
wrapmode : Int32, # WrapMode
x : Int32, # INT
y : Int32, # INT
width : Int32, # INT
height : Int32, # INT
texture : GpTexture** # GpTexture** in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GdipCreateTexture2INative = Int32 Function(Pointer<Void>, Int32, Int32, Int32, Int32, Int32, Pointer<Void>);
typedef GdipCreateTexture2IDart = int Function(Pointer<Void>, int, int, int, int, int, Pointer<Void>);
final GdipCreateTexture2I = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipCreateTexture2INative, GdipCreateTexture2IDart>('GdipCreateTexture2I');
// image : GpImage* in/out -> Pointer<Void>
// wrapmode : WrapMode -> Int32
// x : INT -> Int32
// y : INT -> Int32
// width : INT -> Int32
// height : INT -> Int32
// texture : GpTexture** in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipCreateTexture2I(
image: Pointer; // GpImage* in/out
wrapmode: Integer; // WrapMode
x: Integer; // INT
y: Integer; // INT
width: Integer; // INT
height: Integer; // INT
texture: Pointer // GpTexture** in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipCreateTexture2I';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipCreateTexture2I"
c_GdipCreateTexture2I :: Ptr () -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Ptr () -> IO Int32
-- image : GpImage* in/out -> Ptr ()
-- wrapmode : WrapMode -> Int32
-- x : INT -> Int32
-- y : INT -> Int32
-- width : INT -> Int32
-- height : INT -> Int32
-- texture : GpTexture** in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipcreatetexture2i =
foreign "GdipCreateTexture2I"
((ptr void) @-> int32_t @-> int32_t @-> int32_t @-> int32_t @-> int32_t @-> (ptr void) @-> returning int32_t)
(* image : GpImage* in/out -> (ptr void) *)
(* wrapmode : WrapMode -> int32_t *)
(* x : INT -> int32_t *)
(* y : INT -> int32_t *)
(* width : INT -> int32_t *)
(* height : INT -> int32_t *)
(* texture : GpTexture** in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)
(cffi:defcfun ("GdipCreateTexture2I" gdip-create-texture2-i :convention :stdcall) :int32
(image :pointer) ; GpImage* in/out
(wrapmode :int32) ; WrapMode
(x :int32) ; INT
(y :int32) ; INT
(width :int32) ; INT
(height :int32) ; INT
(texture :pointer)) ; GpTexture** in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipCreateTexture2I = Win32::API::More->new('gdiplus',
'int GdipCreateTexture2I(LPVOID image, int wrapmode, int x, int y, int width, int height, LPVOID texture)');
# my $ret = $GdipCreateTexture2I->Call($image, $wrapmode, $x, $y, $width, $height, $texture);
# image : GpImage* in/out -> LPVOID
# wrapmode : WrapMode -> int
# x : INT -> int
# y : INT -> int
# width : INT -> int
# height : INT -> int
# texture : GpTexture** in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。