ホーム › Graphics.Gdi › GetGlyphOutlineA
GetGlyphOutlineA
関数文字のグリフ輪郭やビットマップを取得する。
シグネチャ
// GDI32.dll (ANSI / -A)
#include <windows.h>
DWORD GetGlyphOutlineA(
HDC hdc,
DWORD uChar,
GET_GLYPH_OUTLINE_FORMAT fuFormat,
GLYPHMETRICS* lpgm,
DWORD cjBuffer,
void* pvBuffer, // optional
const MAT2* lpmat2
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| uChar | DWORD | in |
| fuFormat | GET_GLYPH_OUTLINE_FORMAT | in |
| lpgm | GLYPHMETRICS* | out |
| cjBuffer | DWORD | in |
| pvBuffer | void* | outoptional |
| lpmat2 | MAT2* | in |
戻り値の型: DWORD
各言語での呼び出し定義
// GDI32.dll (ANSI / -A)
#include <windows.h>
DWORD GetGlyphOutlineA(
HDC hdc,
DWORD uChar,
GET_GLYPH_OUTLINE_FORMAT fuFormat,
GLYPHMETRICS* lpgm,
DWORD cjBuffer,
void* pvBuffer, // optional
const MAT2* lpmat2
);[DllImport("GDI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint GetGlyphOutlineA(
IntPtr hdc, // HDC
uint uChar, // DWORD
uint fuFormat, // GET_GLYPH_OUTLINE_FORMAT
IntPtr lpgm, // GLYPHMETRICS* out
uint cjBuffer, // DWORD
IntPtr pvBuffer, // void* optional, out
IntPtr lpmat2 // MAT2*
);<DllImport("GDI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function GetGlyphOutlineA(
hdc As IntPtr, ' HDC
uChar As UInteger, ' DWORD
fuFormat As UInteger, ' GET_GLYPH_OUTLINE_FORMAT
lpgm As IntPtr, ' GLYPHMETRICS* out
cjBuffer As UInteger, ' DWORD
pvBuffer As IntPtr, ' void* optional, out
lpmat2 As IntPtr ' MAT2*
) As UInteger
End Function' hdc : HDC
' uChar : DWORD
' fuFormat : GET_GLYPH_OUTLINE_FORMAT
' lpgm : GLYPHMETRICS* out
' cjBuffer : DWORD
' pvBuffer : void* optional, out
' lpmat2 : MAT2*
Declare PtrSafe Function GetGlyphOutlineA Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal uChar As Long, _
ByVal fuFormat As Long, _
ByVal lpgm As LongPtr, _
ByVal cjBuffer As Long, _
ByVal pvBuffer As LongPtr, _
ByVal lpmat2 As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetGlyphOutlineA = ctypes.windll.gdi32.GetGlyphOutlineA
GetGlyphOutlineA.restype = wintypes.DWORD
GetGlyphOutlineA.argtypes = [
wintypes.HANDLE, # hdc : HDC
wintypes.DWORD, # uChar : DWORD
wintypes.DWORD, # fuFormat : GET_GLYPH_OUTLINE_FORMAT
ctypes.c_void_p, # lpgm : GLYPHMETRICS* out
wintypes.DWORD, # cjBuffer : DWORD
ctypes.POINTER(None), # pvBuffer : void* optional, out
ctypes.c_void_p, # lpmat2 : MAT2*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
GetGlyphOutlineA = Fiddle::Function.new(
lib['GetGlyphOutlineA'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
-Fiddle::TYPE_INT, # uChar : DWORD
-Fiddle::TYPE_INT, # fuFormat : GET_GLYPH_OUTLINE_FORMAT
Fiddle::TYPE_VOIDP, # lpgm : GLYPHMETRICS* out
-Fiddle::TYPE_INT, # cjBuffer : DWORD
Fiddle::TYPE_VOIDP, # pvBuffer : void* optional, out
Fiddle::TYPE_VOIDP, # lpmat2 : MAT2*
],
-Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn GetGlyphOutlineA(
hdc: *mut core::ffi::c_void, // HDC
uChar: u32, // DWORD
fuFormat: u32, // GET_GLYPH_OUTLINE_FORMAT
lpgm: *mut GLYPHMETRICS, // GLYPHMETRICS* out
cjBuffer: u32, // DWORD
pvBuffer: *mut (), // void* optional, out
lpmat2: *const MAT2 // MAT2*
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll", CharSet = CharSet.Ansi)]
public static extern uint GetGlyphOutlineA(IntPtr hdc, uint uChar, uint fuFormat, IntPtr lpgm, uint cjBuffer, IntPtr pvBuffer, IntPtr lpmat2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_GetGlyphOutlineA' -Namespace Win32 -PassThru
# $api::GetGlyphOutlineA(hdc, uChar, fuFormat, lpgm, cjBuffer, pvBuffer, lpmat2)#uselib "GDI32.dll"
#func global GetGlyphOutlineA "GetGlyphOutlineA" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GetGlyphOutlineA hdc, uChar, fuFormat, varptr(lpgm), cjBuffer, pvBuffer, varptr(lpmat2) ; 戻り値は stat
; hdc : HDC -> "sptr"
; uChar : DWORD -> "sptr"
; fuFormat : GET_GLYPH_OUTLINE_FORMAT -> "sptr"
; lpgm : GLYPHMETRICS* out -> "sptr"
; cjBuffer : DWORD -> "sptr"
; pvBuffer : void* optional, out -> "sptr"
; lpmat2 : MAT2* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global GetGlyphOutlineA "GetGlyphOutlineA" sptr, int, int, var, int, sptr, var ; res = GetGlyphOutlineA(hdc, uChar, fuFormat, lpgm, cjBuffer, pvBuffer, lpmat2) ; hdc : HDC -> "sptr" ; uChar : DWORD -> "int" ; fuFormat : GET_GLYPH_OUTLINE_FORMAT -> "int" ; lpgm : GLYPHMETRICS* out -> "var" ; cjBuffer : DWORD -> "int" ; pvBuffer : void* optional, out -> "sptr" ; lpmat2 : MAT2* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global GetGlyphOutlineA "GetGlyphOutlineA" sptr, int, int, sptr, int, sptr, sptr ; res = GetGlyphOutlineA(hdc, uChar, fuFormat, varptr(lpgm), cjBuffer, pvBuffer, varptr(lpmat2)) ; hdc : HDC -> "sptr" ; uChar : DWORD -> "int" ; fuFormat : GET_GLYPH_OUTLINE_FORMAT -> "int" ; lpgm : GLYPHMETRICS* out -> "sptr" ; cjBuffer : DWORD -> "int" ; pvBuffer : void* optional, out -> "sptr" ; lpmat2 : MAT2* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD GetGlyphOutlineA(HDC hdc, DWORD uChar, GET_GLYPH_OUTLINE_FORMAT fuFormat, GLYPHMETRICS* lpgm, DWORD cjBuffer, void* pvBuffer, MAT2* lpmat2) #uselib "GDI32.dll" #cfunc global GetGlyphOutlineA "GetGlyphOutlineA" intptr, int, int, var, int, intptr, var ; res = GetGlyphOutlineA(hdc, uChar, fuFormat, lpgm, cjBuffer, pvBuffer, lpmat2) ; hdc : HDC -> "intptr" ; uChar : DWORD -> "int" ; fuFormat : GET_GLYPH_OUTLINE_FORMAT -> "int" ; lpgm : GLYPHMETRICS* out -> "var" ; cjBuffer : DWORD -> "int" ; pvBuffer : void* optional, out -> "intptr" ; lpmat2 : MAT2* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD GetGlyphOutlineA(HDC hdc, DWORD uChar, GET_GLYPH_OUTLINE_FORMAT fuFormat, GLYPHMETRICS* lpgm, DWORD cjBuffer, void* pvBuffer, MAT2* lpmat2) #uselib "GDI32.dll" #cfunc global GetGlyphOutlineA "GetGlyphOutlineA" intptr, int, int, intptr, int, intptr, intptr ; res = GetGlyphOutlineA(hdc, uChar, fuFormat, varptr(lpgm), cjBuffer, pvBuffer, varptr(lpmat2)) ; hdc : HDC -> "intptr" ; uChar : DWORD -> "int" ; fuFormat : GET_GLYPH_OUTLINE_FORMAT -> "int" ; lpgm : GLYPHMETRICS* out -> "intptr" ; cjBuffer : DWORD -> "int" ; pvBuffer : void* optional, out -> "intptr" ; lpmat2 : MAT2* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procGetGlyphOutlineA = gdi32.NewProc("GetGlyphOutlineA")
)
// hdc (HDC), uChar (DWORD), fuFormat (GET_GLYPH_OUTLINE_FORMAT), lpgm (GLYPHMETRICS* out), cjBuffer (DWORD), pvBuffer (void* optional, out), lpmat2 (MAT2*)
r1, _, err := procGetGlyphOutlineA.Call(
uintptr(hdc),
uintptr(uChar),
uintptr(fuFormat),
uintptr(lpgm),
uintptr(cjBuffer),
uintptr(pvBuffer),
uintptr(lpmat2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction GetGlyphOutlineA(
hdc: THandle; // HDC
uChar: DWORD; // DWORD
fuFormat: DWORD; // GET_GLYPH_OUTLINE_FORMAT
lpgm: Pointer; // GLYPHMETRICS* out
cjBuffer: DWORD; // DWORD
pvBuffer: Pointer; // void* optional, out
lpmat2: Pointer // MAT2*
): DWORD; stdcall;
external 'GDI32.dll' name 'GetGlyphOutlineA';result := DllCall("GDI32\GetGlyphOutlineA"
, "Ptr", hdc ; HDC
, "UInt", uChar ; DWORD
, "UInt", fuFormat ; GET_GLYPH_OUTLINE_FORMAT
, "Ptr", lpgm ; GLYPHMETRICS* out
, "UInt", cjBuffer ; DWORD
, "Ptr", pvBuffer ; void* optional, out
, "Ptr", lpmat2 ; MAT2*
, "UInt") ; return: DWORD●GetGlyphOutlineA(hdc, uChar, fuFormat, lpgm, cjBuffer, pvBuffer, lpmat2) = DLL("GDI32.dll", "dword GetGlyphOutlineA(void*, dword, dword, void*, dword, void*, void*)")
# 呼び出し: GetGlyphOutlineA(hdc, uChar, fuFormat, lpgm, cjBuffer, pvBuffer, lpmat2)
# hdc : HDC -> "void*"
# uChar : DWORD -> "dword"
# fuFormat : GET_GLYPH_OUTLINE_FORMAT -> "dword"
# lpgm : GLYPHMETRICS* out -> "void*"
# cjBuffer : DWORD -> "dword"
# pvBuffer : void* optional, out -> "void*"
# lpmat2 : MAT2* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。