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