ホーム › Graphics.Imaging › WICImageParameters
WICImageParameters
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| PixelFormat | D2D1_PIXEL_FORMAT | 8 | +0 | +0 | エンコーダーに書き込まれる前に画像が処理されるピクセル形式です。 |
| DpiX | FLOAT | 4 | +8 | +8 | x 方向の DPI です。 |
| DpiY | FLOAT | 4 | +12 | +12 | y 方向の DPI です。 |
| Top | FLOAT | 4 | +16 | +16 | エンコード先に出力する画像領域の上端の位置 (ピクセル単位) です。 |
| Left | FLOAT | 4 | +20 | +20 | エンコード先に出力する画像領域の左端の位置 (ピクセル単位) です。 |
| PixelWidth | DWORD | 4 | +24 | +24 | 書き込む画像部分の幅 (ピクセル単位) です。 |
| PixelHeight | DWORD | 4 | +28 | +28 | 書き込む画像部分の高さ (ピクセル単位) です。 |
公式ドキュメント
画像をエンコードする際に通常使用される既定のパラメーターを上書きするためのパラメーターを定義します。
解説(Remarks)
このパラメーターがエンコード API に渡されない場合、エンコーダーは次の設定を使用します。
- ピクセル形式は (DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED) です。
- x および y の DPI は 96 です。
- 画像全体の範囲がエンコードに使用されます。
Note 指定されたパラメーターによって拡大縮小を行うことはできません。エンコーダーは、渡された DPI とピクセル単位の幅および高さに基づいて、入力画像のより大きな部分を使用する場合があります。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// D2D1_PIXEL_FORMAT (x64 8 / x86 8 バイト)
typedef struct D2D1_PIXEL_FORMAT {
DXGI_FORMAT format;
D2D1_ALPHA_MODE alphaMode;
} D2D1_PIXEL_FORMAT;
// WICImageParameters (x64 32 / x86 32 バイト)
typedef struct WICImageParameters {
D2D1_PIXEL_FORMAT PixelFormat;
FLOAT DpiX;
FLOAT DpiY;
FLOAT Top;
FLOAT Left;
DWORD PixelWidth;
DWORD PixelHeight;
} WICImageParameters;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D1_PIXEL_FORMAT
{
public int format;
public int alphaMode;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WICImageParameters
{
public D2D1_PIXEL_FORMAT PixelFormat;
public float DpiX;
public float DpiY;
public float Top;
public float Left;
public uint PixelWidth;
public uint PixelHeight;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D1_PIXEL_FORMAT
Public format As Integer
Public alphaMode As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WICImageParameters
Public PixelFormat As D2D1_PIXEL_FORMAT
Public DpiX As Single
Public DpiY As Single
Public Top As Single
Public Left As Single
Public PixelWidth As UInteger
Public PixelHeight As UInteger
End Structureimport ctypes
from ctypes import wintypes
class D2D1_PIXEL_FORMAT(ctypes.Structure):
_fields_ = [
("format", ctypes.c_int),
("alphaMode", ctypes.c_int),
]
class WICImageParameters(ctypes.Structure):
_fields_ = [
("PixelFormat", D2D1_PIXEL_FORMAT),
("DpiX", ctypes.c_float),
("DpiY", ctypes.c_float),
("Top", ctypes.c_float),
("Left", ctypes.c_float),
("PixelWidth", wintypes.DWORD),
("PixelHeight", wintypes.DWORD),
]#[repr(C)]
pub struct D2D1_PIXEL_FORMAT {
pub format: i32,
pub alphaMode: i32,
}
#[repr(C)]
pub struct WICImageParameters {
pub PixelFormat: D2D1_PIXEL_FORMAT,
pub DpiX: f32,
pub DpiY: f32,
pub Top: f32,
pub Left: f32,
pub PixelWidth: u32,
pub PixelHeight: u32,
}import "golang.org/x/sys/windows"
type D2D1_PIXEL_FORMAT struct {
format int32
alphaMode int32
}
type WICImageParameters struct {
PixelFormat D2D1_PIXEL_FORMAT
DpiX float32
DpiY float32
Top float32
Left float32
PixelWidth uint32
PixelHeight uint32
}type
D2D1_PIXEL_FORMAT = record
format: Integer;
alphaMode: Integer;
end;
WICImageParameters = record
PixelFormat: D2D1_PIXEL_FORMAT;
DpiX: Single;
DpiY: Single;
Top: Single;
Left: Single;
PixelWidth: DWORD;
PixelHeight: DWORD;
end;const D2D1_PIXEL_FORMAT = extern struct {
format: i32,
alphaMode: i32,
};
const WICImageParameters = extern struct {
PixelFormat: D2D1_PIXEL_FORMAT,
DpiX: f32,
DpiY: f32,
Top: f32,
Left: f32,
PixelWidth: u32,
PixelHeight: u32,
};type
D2D1_PIXEL_FORMAT {.bycopy.} = object
format: int32
alphaMode: int32
WICImageParameters {.bycopy.} = object
PixelFormat: D2D1_PIXEL_FORMAT
DpiX: float32
DpiY: float32
Top: float32
Left: float32
PixelWidth: uint32
PixelHeight: uint32struct D2D1_PIXEL_FORMAT
{
int format;
int alphaMode;
}
struct WICImageParameters
{
D2D1_PIXEL_FORMAT PixelFormat;
float DpiX;
float DpiY;
float Top;
float Left;
uint PixelWidth;
uint PixelHeight;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WICImageParameters サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; PixelFormat : D2D1_PIXEL_FORMAT (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; DpiX : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; DpiY : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Top : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Left : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; PixelWidth : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; PixelHeight : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D2D1_PIXEL_FORMAT
#field int format
#field int alphaMode
#endstruct
#defstruct global WICImageParameters
#field D2D1_PIXEL_FORMAT PixelFormat
#field float DpiX
#field float DpiY
#field float Top
#field float Left
#field int PixelWidth
#field int PixelHeight
#endstruct
stdim st, WICImageParameters ; NSTRUCT 変数を確保
st->DpiX = 100
mes "DpiX=" + st->DpiX