ホーム › Graphics.GdiPlus › GdipBitmapApplyEffect
GdipBitmapApplyEffect
関数ビットマップにエフェクトを適用する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipBitmapApplyEffect(
GpBitmap* bitmap,
CGpEffect* effect,
RECT* roi,
BOOL useAuxData,
void** auxData,
INT* auxDataSize
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| bitmap | GpBitmap* | inout | 効果を適用する対象のGpBitmapオブジェクトへのポインタ。 |
| effect | CGpEffect* | inout | 適用するエフェクトを表すCGpEffectオブジェクトへのポインタ。 |
| roi | RECT* | inout | 効果を適用する対象領域を示すRECT構造体へのポインタ。NULLで全体。 |
| useAuxData | BOOL | in | 補助データを取得するかを示すBOOL(TRUEで取得)。 |
| auxData | void** | inout | 確保された補助データのポインタを受け取る出力先(void**)。 |
| auxDataSize | INT* | inout | 補助データのバイト数を受け取る出力先INTポインタ。 |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipBitmapApplyEffect(
GpBitmap* bitmap,
CGpEffect* effect,
RECT* roi,
BOOL useAuxData,
void** auxData,
INT* auxDataSize
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipBitmapApplyEffect(
IntPtr bitmap, // GpBitmap* in/out
ref IntPtr effect, // CGpEffect* in/out
IntPtr roi, // RECT* in/out
bool useAuxData, // BOOL
IntPtr auxData, // void** in/out
ref int auxDataSize // INT* in/out
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipBitmapApplyEffect(
bitmap As IntPtr, ' GpBitmap* in/out
ByRef effect As IntPtr, ' CGpEffect* in/out
roi As IntPtr, ' RECT* in/out
useAuxData As Boolean, ' BOOL
auxData As IntPtr, ' void** in/out
ByRef auxDataSize As Integer ' INT* in/out
) As Integer
End Function' bitmap : GpBitmap* in/out
' effect : CGpEffect* in/out
' roi : RECT* in/out
' useAuxData : BOOL
' auxData : void** in/out
' auxDataSize : INT* in/out
Declare PtrSafe Function GdipBitmapApplyEffect Lib "gdiplus" ( _
ByVal bitmap As LongPtr, _
ByRef effect As LongPtr, _
ByVal roi As LongPtr, _
ByVal useAuxData As Long, _
ByVal auxData As LongPtr, _
ByRef auxDataSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipBitmapApplyEffect = ctypes.windll.gdiplus.GdipBitmapApplyEffect
GdipBitmapApplyEffect.restype = ctypes.c_int
GdipBitmapApplyEffect.argtypes = [
ctypes.c_void_p, # bitmap : GpBitmap* in/out
ctypes.c_void_p, # effect : CGpEffect* in/out
ctypes.c_void_p, # roi : RECT* in/out
wintypes.BOOL, # useAuxData : BOOL
ctypes.c_void_p, # auxData : void** in/out
ctypes.POINTER(ctypes.c_int), # auxDataSize : INT* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipBitmapApplyEffect = Fiddle::Function.new(
lib['GdipBitmapApplyEffect'],
[
Fiddle::TYPE_VOIDP, # bitmap : GpBitmap* in/out
Fiddle::TYPE_VOIDP, # effect : CGpEffect* in/out
Fiddle::TYPE_VOIDP, # roi : RECT* in/out
Fiddle::TYPE_INT, # useAuxData : BOOL
Fiddle::TYPE_VOIDP, # auxData : void** in/out
Fiddle::TYPE_VOIDP, # auxDataSize : INT* in/out
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipBitmapApplyEffect(
bitmap: *mut GpBitmap, // GpBitmap* in/out
effect: *mut isize, // CGpEffect* in/out
roi: *mut RECT, // RECT* in/out
useAuxData: i32, // BOOL
auxData: *mut *mut (), // void** in/out
auxDataSize: *mut i32 // INT* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipBitmapApplyEffect(IntPtr bitmap, ref IntPtr effect, IntPtr roi, bool useAuxData, IntPtr auxData, ref int auxDataSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipBitmapApplyEffect' -Namespace Win32 -PassThru
# $api::GdipBitmapApplyEffect(bitmap, effect, roi, useAuxData, auxData, auxDataSize)#uselib "gdiplus.dll"
#func global GdipBitmapApplyEffect "GdipBitmapApplyEffect" sptr, sptr, sptr, sptr, sptr, sptr
; GdipBitmapApplyEffect varptr(bitmap), varptr(effect), varptr(roi), useAuxData, auxData, varptr(auxDataSize) ; 戻り値は stat
; bitmap : GpBitmap* in/out -> "sptr"
; effect : CGpEffect* in/out -> "sptr"
; roi : RECT* in/out -> "sptr"
; useAuxData : BOOL -> "sptr"
; auxData : void** in/out -> "sptr"
; auxDataSize : INT* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipBitmapApplyEffect "GdipBitmapApplyEffect" var, var, var, int, sptr, var ; res = GdipBitmapApplyEffect(bitmap, effect, roi, useAuxData, auxData, auxDataSize) ; bitmap : GpBitmap* in/out -> "var" ; effect : CGpEffect* in/out -> "var" ; roi : RECT* in/out -> "var" ; useAuxData : BOOL -> "int" ; auxData : void** in/out -> "sptr" ; auxDataSize : INT* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipBitmapApplyEffect "GdipBitmapApplyEffect" sptr, sptr, sptr, int, sptr, sptr ; res = GdipBitmapApplyEffect(varptr(bitmap), varptr(effect), varptr(roi), useAuxData, auxData, varptr(auxDataSize)) ; bitmap : GpBitmap* in/out -> "sptr" ; effect : CGpEffect* in/out -> "sptr" ; roi : RECT* in/out -> "sptr" ; useAuxData : BOOL -> "int" ; auxData : void** in/out -> "sptr" ; auxDataSize : INT* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipBitmapApplyEffect(GpBitmap* bitmap, CGpEffect* effect, RECT* roi, BOOL useAuxData, void** auxData, INT* auxDataSize) #uselib "gdiplus.dll" #cfunc global GdipBitmapApplyEffect "GdipBitmapApplyEffect" var, var, var, int, intptr, var ; res = GdipBitmapApplyEffect(bitmap, effect, roi, useAuxData, auxData, auxDataSize) ; bitmap : GpBitmap* in/out -> "var" ; effect : CGpEffect* in/out -> "var" ; roi : RECT* in/out -> "var" ; useAuxData : BOOL -> "int" ; auxData : void** in/out -> "intptr" ; auxDataSize : INT* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipBitmapApplyEffect(GpBitmap* bitmap, CGpEffect* effect, RECT* roi, BOOL useAuxData, void** auxData, INT* auxDataSize) #uselib "gdiplus.dll" #cfunc global GdipBitmapApplyEffect "GdipBitmapApplyEffect" intptr, intptr, intptr, int, intptr, intptr ; res = GdipBitmapApplyEffect(varptr(bitmap), varptr(effect), varptr(roi), useAuxData, auxData, varptr(auxDataSize)) ; bitmap : GpBitmap* in/out -> "intptr" ; effect : CGpEffect* in/out -> "intptr" ; roi : RECT* in/out -> "intptr" ; useAuxData : BOOL -> "int" ; auxData : void** in/out -> "intptr" ; auxDataSize : INT* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipBitmapApplyEffect = gdiplus.NewProc("GdipBitmapApplyEffect")
)
// bitmap (GpBitmap* in/out), effect (CGpEffect* in/out), roi (RECT* in/out), useAuxData (BOOL), auxData (void** in/out), auxDataSize (INT* in/out)
r1, _, err := procGdipBitmapApplyEffect.Call(
uintptr(bitmap),
uintptr(effect),
uintptr(roi),
uintptr(useAuxData),
uintptr(auxData),
uintptr(auxDataSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipBitmapApplyEffect(
bitmap: Pointer; // GpBitmap* in/out
effect: Pointer; // CGpEffect* in/out
roi: Pointer; // RECT* in/out
useAuxData: BOOL; // BOOL
auxData: Pointer; // void** in/out
auxDataSize: Pointer // INT* in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipBitmapApplyEffect';result := DllCall("gdiplus\GdipBitmapApplyEffect"
, "Ptr", bitmap ; GpBitmap* in/out
, "Ptr", effect ; CGpEffect* in/out
, "Ptr", roi ; RECT* in/out
, "Int", useAuxData ; BOOL
, "Ptr", auxData ; void** in/out
, "Ptr", auxDataSize ; INT* in/out
, "Int") ; return: Status●GdipBitmapApplyEffect(bitmap, effect, roi, useAuxData, auxData, auxDataSize) = DLL("gdiplus.dll", "int GdipBitmapApplyEffect(void*, void*, void*, bool, void*, void*)")
# 呼び出し: GdipBitmapApplyEffect(bitmap, effect, roi, useAuxData, auxData, auxDataSize)
# bitmap : GpBitmap* in/out -> "void*"
# effect : CGpEffect* in/out -> "void*"
# roi : RECT* in/out -> "void*"
# useAuxData : BOOL -> "bool"
# auxData : void** in/out -> "void*"
# auxDataSize : INT* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdiplus" fn GdipBitmapApplyEffect(
bitmap: [*c]GpBitmap, // GpBitmap* in/out
effect: [*c]isize, // CGpEffect* in/out
roi: [*c]RECT, // RECT* in/out
useAuxData: i32, // BOOL
auxData: ?*anyopaque, // void** in/out
auxDataSize: [*c]i32 // INT* in/out
) callconv(std.os.windows.WINAPI) i32;proc GdipBitmapApplyEffect(
bitmap: ptr GpBitmap, # GpBitmap* in/out
effect: ptr int, # CGpEffect* in/out
roi: ptr RECT, # RECT* in/out
useAuxData: int32, # BOOL
auxData: pointer, # void** in/out
auxDataSize: ptr int32 # INT* in/out
): int32 {.importc: "GdipBitmapApplyEffect", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipBitmapApplyEffect(
GpBitmap* bitmap, // GpBitmap* in/out
ptrdiff_t* effect, // CGpEffect* in/out
RECT* roi, // RECT* in/out
int useAuxData, // BOOL
void** auxData, // void** in/out
int* auxDataSize // INT* in/out
);ccall((:GdipBitmapApplyEffect, "gdiplus.dll"), stdcall, Int32,
(Ptr{GpBitmap}, Ptr{Int}, Ptr{RECT}, Int32, Ptr{Cvoid}, Ptr{Int32}),
bitmap, effect, roi, useAuxData, auxData, auxDataSize)
# bitmap : GpBitmap* in/out -> Ptr{GpBitmap}
# effect : CGpEffect* in/out -> Ptr{Int}
# roi : RECT* in/out -> Ptr{RECT}
# useAuxData : BOOL -> Int32
# auxData : void** in/out -> Ptr{Cvoid}
# auxDataSize : INT* in/out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipBitmapApplyEffect(
void* bitmap,
intptr_t* effect,
void* roi,
int32_t useAuxData,
void** auxData,
int32_t* auxDataSize);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipBitmapApplyEffect(bitmap, effect, roi, useAuxData, auxData, auxDataSize)
-- bitmap : GpBitmap* in/out
-- effect : CGpEffect* in/out
-- roi : RECT* in/out
-- useAuxData : BOOL
-- auxData : void** in/out
-- auxDataSize : INT* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipBitmapApplyEffect = lib.func('__stdcall', 'GdipBitmapApplyEffect', 'int32_t', ['void *', 'intptr_t *', 'void *', 'int32_t', 'void *', 'int32_t *']);
// GdipBitmapApplyEffect(bitmap, effect, roi, useAuxData, auxData, auxDataSize)
// bitmap : GpBitmap* in/out -> 'void *'
// effect : CGpEffect* in/out -> 'intptr_t *'
// roi : RECT* in/out -> 'void *'
// useAuxData : BOOL -> 'int32_t'
// auxData : void** in/out -> 'void *'
// auxDataSize : INT* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipBitmapApplyEffect: { parameters: ["pointer", "pointer", "pointer", "i32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.GdipBitmapApplyEffect(bitmap, effect, roi, useAuxData, auxData, auxDataSize)
// bitmap : GpBitmap* in/out -> "pointer"
// effect : CGpEffect* in/out -> "pointer"
// roi : RECT* in/out -> "pointer"
// useAuxData : BOOL -> "i32"
// auxData : void** in/out -> "pointer"
// auxDataSize : INT* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipBitmapApplyEffect(
void* bitmap,
intptr_t* effect,
void* roi,
int32_t useAuxData,
void** auxData,
int32_t* auxDataSize);
C, "gdiplus.dll");
// $ffi->GdipBitmapApplyEffect(bitmap, effect, roi, useAuxData, auxData, auxDataSize);
// bitmap : GpBitmap* in/out
// effect : CGpEffect* in/out
// roi : RECT* in/out
// useAuxData : BOOL
// auxData : void** in/out
// auxDataSize : INT* 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 GdipBitmapApplyEffect(
Pointer bitmap, // GpBitmap* in/out
LongByReference effect, // CGpEffect* in/out
Pointer roi, // RECT* in/out
boolean useAuxData, // BOOL
Pointer auxData, // void** in/out
IntByReference auxDataSize // INT* in/out
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipBitmapApplyEffect = GdipBitmapApplyEffect(
bitmap : GpBitmap*, # GpBitmap* in/out
effect : LibC::SSizeT*, # CGpEffect* in/out
roi : RECT*, # RECT* in/out
useAuxData : Int32, # BOOL
auxData : Void**, # void** in/out
auxDataSize : Int32* # INT* 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 GdipBitmapApplyEffectNative = Int32 Function(Pointer<Void>, Pointer<IntPtr>, Pointer<Void>, Int32, Pointer<Void>, Pointer<Int32>);
typedef GdipBitmapApplyEffectDart = int Function(Pointer<Void>, Pointer<IntPtr>, Pointer<Void>, int, Pointer<Void>, Pointer<Int32>);
final GdipBitmapApplyEffect = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipBitmapApplyEffectNative, GdipBitmapApplyEffectDart>('GdipBitmapApplyEffect');
// bitmap : GpBitmap* in/out -> Pointer<Void>
// effect : CGpEffect* in/out -> Pointer<IntPtr>
// roi : RECT* in/out -> Pointer<Void>
// useAuxData : BOOL -> Int32
// auxData : void** in/out -> Pointer<Void>
// auxDataSize : INT* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipBitmapApplyEffect(
bitmap: Pointer; // GpBitmap* in/out
effect: Pointer; // CGpEffect* in/out
roi: Pointer; // RECT* in/out
useAuxData: BOOL; // BOOL
auxData: Pointer; // void** in/out
auxDataSize: Pointer // INT* in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipBitmapApplyEffect';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipBitmapApplyEffect"
c_GdipBitmapApplyEffect :: Ptr () -> Ptr CIntPtr -> Ptr () -> CInt -> Ptr () -> Ptr Int32 -> IO Int32
-- bitmap : GpBitmap* in/out -> Ptr ()
-- effect : CGpEffect* in/out -> Ptr CIntPtr
-- roi : RECT* in/out -> Ptr ()
-- useAuxData : BOOL -> CInt
-- auxData : void** in/out -> Ptr ()
-- auxDataSize : INT* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipbitmapapplyeffect =
foreign "GdipBitmapApplyEffect"
((ptr void) @-> (ptr intptr_t) @-> (ptr void) @-> int32_t @-> (ptr void) @-> (ptr int32_t) @-> returning int32_t)
(* bitmap : GpBitmap* in/out -> (ptr void) *)
(* effect : CGpEffect* in/out -> (ptr intptr_t) *)
(* roi : RECT* in/out -> (ptr void) *)
(* useAuxData : BOOL -> int32_t *)
(* auxData : void** in/out -> (ptr void) *)
(* auxDataSize : INT* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)
(cffi:defcfun ("GdipBitmapApplyEffect" gdip-bitmap-apply-effect :convention :stdcall) :int32
(bitmap :pointer) ; GpBitmap* in/out
(effect :pointer) ; CGpEffect* in/out
(roi :pointer) ; RECT* in/out
(use-aux-data :int32) ; BOOL
(aux-data :pointer) ; void** in/out
(aux-data-size :pointer)) ; INT* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipBitmapApplyEffect = Win32::API::More->new('gdiplus',
'int GdipBitmapApplyEffect(LPVOID bitmap, LPVOID effect, LPVOID roi, BOOL useAuxData, LPVOID auxData, LPVOID auxDataSize)');
# my $ret = $GdipBitmapApplyEffect->Call($bitmap, $effect, $roi, $useAuxData, $auxData, $auxDataSize);
# bitmap : GpBitmap* in/out -> LPVOID
# effect : CGpEffect* in/out -> LPVOID
# roi : RECT* in/out -> LPVOID
# useAuxData : BOOL -> BOOL
# auxData : void** in/out -> LPVOID
# auxDataSize : INT* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。