ホーム › UI.ColorSystem › SetColorSpace
SetColorSpace
関数デバイスコンテキストに色空間を設定する。
シグネチャ
// GDI32.dll
#include <windows.h>
HCOLORSPACE SetColorSpace(
HDC hdc,
HCOLORSPACE hcs
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| hcs | HCOLORSPACE | in |
戻り値の型: HCOLORSPACE
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
HCOLORSPACE SetColorSpace(
HDC hdc,
HCOLORSPACE hcs
);[DllImport("GDI32.dll", ExactSpelling = true)]
static extern IntPtr SetColorSpace(
IntPtr hdc, // HDC
IntPtr hcs // HCOLORSPACE
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function SetColorSpace(
hdc As IntPtr, ' HDC
hcs As IntPtr ' HCOLORSPACE
) As IntPtr
End Function' hdc : HDC
' hcs : HCOLORSPACE
Declare PtrSafe Function SetColorSpace Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal hcs As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetColorSpace = ctypes.windll.gdi32.SetColorSpace
SetColorSpace.restype = ctypes.c_void_p
SetColorSpace.argtypes = [
wintypes.HANDLE, # hdc : HDC
wintypes.HANDLE, # hcs : HCOLORSPACE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
SetColorSpace = Fiddle::Function.new(
lib['SetColorSpace'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_VOIDP, # hcs : HCOLORSPACE
],
Fiddle::TYPE_VOIDP)#[link(name = "gdi32")]
extern "system" {
fn SetColorSpace(
hdc: *mut core::ffi::c_void, // HDC
hcs: *mut core::ffi::c_void // HCOLORSPACE
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll")]
public static extern IntPtr SetColorSpace(IntPtr hdc, IntPtr hcs);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_SetColorSpace' -Namespace Win32 -PassThru
# $api::SetColorSpace(hdc, hcs)#uselib "GDI32.dll"
#func global SetColorSpace "SetColorSpace" sptr, sptr
; SetColorSpace hdc, hcs ; 戻り値は stat
; hdc : HDC -> "sptr"
; hcs : HCOLORSPACE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GDI32.dll"
#cfunc global SetColorSpace "SetColorSpace" sptr, sptr
; res = SetColorSpace(hdc, hcs)
; hdc : HDC -> "sptr"
; hcs : HCOLORSPACE -> "sptr"; HCOLORSPACE SetColorSpace(HDC hdc, HCOLORSPACE hcs)
#uselib "GDI32.dll"
#cfunc global SetColorSpace "SetColorSpace" intptr, intptr
; res = SetColorSpace(hdc, hcs)
; hdc : HDC -> "intptr"
; hcs : HCOLORSPACE -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procSetColorSpace = gdi32.NewProc("SetColorSpace")
)
// hdc (HDC), hcs (HCOLORSPACE)
r1, _, err := procSetColorSpace.Call(
uintptr(hdc),
uintptr(hcs),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HCOLORSPACEfunction SetColorSpace(
hdc: THandle; // HDC
hcs: THandle // HCOLORSPACE
): THandle; stdcall;
external 'GDI32.dll' name 'SetColorSpace';result := DllCall("GDI32\SetColorSpace"
, "Ptr", hdc ; HDC
, "Ptr", hcs ; HCOLORSPACE
, "Ptr") ; return: HCOLORSPACE●SetColorSpace(hdc, hcs) = DLL("GDI32.dll", "void* SetColorSpace(void*, void*)")
# 呼び出し: SetColorSpace(hdc, hcs)
# hdc : HDC -> "void*"
# hcs : HCOLORSPACE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。