このページでは

QPixelFormat Class

QPixelFormat は、グラフィックスバッファ内のさまざまなピクセルレイアウトを記述するためのクラスです。詳細...

ヘッダー #include <QPixelFormat>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui

パブリックな型

enum AlphaPosition { AtBeginning, AtEnd }
enum AlphaPremultiplied { NotPremultiplied, Premultiplied }
enum AlphaUsage { IgnoresAlpha, UsesAlpha }
enum ByteOrder { LittleEndian, BigEndian, CurrentSystemEndian }
enum ColorModel { RGB, BGR, Indexed, Grayscale, CMYK, …, Alpha }
enum TypeInterpretation { UnsignedInteger, UnsignedShort, UnsignedByte, FloatingPoint }
enum YUVLayout { YUV444, YUV422, YUV411, YUV420P, YUV420SP, …, Y16 }

パブリック関数

QPixelFormat()
QPixelFormat(QPixelFormat::ColorModel colorModel, uchar firstSize, uchar secondSize, uchar thirdSize, uchar fourthSize, uchar fifthSize, uchar alphaSize, QPixelFormat::AlphaUsage alphaUsage, QPixelFormat::AlphaPosition alphaPosition, QPixelFormat::AlphaPremultiplied premultiplied, QPixelFormat::TypeInterpretation typeInterpretation, QPixelFormat::ByteOrder byteOrder = CurrentSystemEndian, uchar subEnum = 0)
QPixelFormat::AlphaPosition alphaPosition() const
uchar alphaSize() const
QPixelFormat::AlphaUsage alphaUsage() const
uchar bitsPerPixel() const
uchar blackSize() const
uchar blueSize() const
uchar brightnessSize() const
QPixelFormat::ByteOrder byteOrder() const
uchar channelCount() const
QPixelFormat::ColorModel colorModel() const
uchar cyanSize() const
uchar greenSize() const
uchar hueSize() const
uchar lightnessSize() const
uchar magentaSize() const
QPixelFormat::AlphaPremultiplied premultiplied() const
uchar redSize() const
uchar saturationSize() const
QPixelFormat::TypeInterpretation typeInterpretation() const
uchar yellowSize() const
QPixelFormat::YUVLayout yuvLayout() const
QPixelFormat qPixelFormatAlpha(uchar channelSize, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)
QPixelFormat qPixelFormatCmyk(uchar channelSize, uchar alphaSize = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)
QPixelFormat qPixelFormatGrayscale(uchar channelSize, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)
QPixelFormat qPixelFormatHsl(uchar channelSize, uchar alphaSize = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::FloatingPoint)
QPixelFormat qPixelFormatHsv(uchar channelSize, uchar alphaSize = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::FloatingPoint)
QPixelFormat qPixelFormatRgba(uchar redSize, uchar greenSize, uchar blueSize, uchar alphaSize, QPixelFormat::AlphaUsage alphaUsage, QPixelFormat::AlphaPosition alphaPosition, QPixelFormat::AlphaPremultiplied premultiplied = QPixelFormat::NotPremultiplied, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)
QPixelFormat qPixelFormatYuv(QPixelFormat::YUVLayout yuvLayout, uchar alphaSize = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::AlphaPremultiplied premultiplied = QPixelFormat::NotPremultiplied, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedByte, QPixelFormat::ByteOrder byteOrder = QPixelFormat::BigEndian)

詳細説明

Qt では、グラフィックスバッファ内のピクセルのレイアウトを表現する必要がよくあります。QPixelFormatは、最大5つのカラーチャンネルと1つのアルファチャンネルを記述することができます。

typeInterpretation() とbyteOrder() は各ピクセルの読み取り/解釈方法を決定し、alphaSize(),alphaUsage(),alphaPosition(),premultiplied() は可能なアルファ・チャンネルの位置とプロパティを記述します。

YUVのマクロピクセルを記述するためのサポートはありません。代わりにYUV formats のリストが提供されます。QPixelFormat が YUV フォーマットを記述している場合、bitsPerPixel() の値は YUV レイアウトから推測されます。

メンバ型ドキュメント

enum QPixelFormat::AlphaPosition

この列挙型は、ピクセルフォーマットのalpha position を記述する。

定数説明
QPixelFormat::AtBeginning0アルファチャンネルは色チャンネルの前に置かれます。例: ARGB。
QPixelFormat::AtEnd1アルファチャンネルは色チャンネルの後ろに置かれます。例:RGBA。

alphaSize(),alphaUsage(),premultiplied()も参照

enum QPixelFormat::AlphaPremultiplied

この列挙型は、ピクセルフォーマットのアルファチャンネルがカラーチャンネルにpremultiplied されるかどうかを記述する。

定数説明
QPixelFormat::NotPremultiplied0アルファチャンネルは色チャンネルに乗算されない。
QPixelFormat::Premultiplied1アルファチャンネルは色チャンネルに乗算される。

alphaSize(),alphaUsage(),alphaPosition()も参照

enum QPixelFormat::AlphaUsage

この列挙型は、ピクセルフォーマットのalpha usage を記述する。

定数説明
QPixelFormat::IgnoresAlpha1アルファチャンネルは使用されない。
QPixelFormat::UsesAlpha0アルファチャンネルが使用される。

alphaSize(),alphaPosition(),premultiplied()も参照

enum QPixelFormat::ByteOrder

この列挙型は、ピクセルフォーマットのbyte order を記述する。

定数説明
QPixelFormat::LittleEndian0バイトオーダーはリトルエンディアン。
QPixelFormat::BigEndian1バイトオーダーはビッグエンディアン。
QPixelFormat::CurrentSystemEndian2この列挙型は保存されず、コンストラクタで現在のシステムの列挙型にマッチするエンディアン列挙型に変換されます。

typeInterpretation()も参照のこと

enum QPixelFormat::ColorModel

この列挙型は、ピクセルフォーマットのcolor model を記述する。

定数説明
QPixelFormat::RGB0カラーモデルはRGBです。
QPixelFormat::BGR1これは論理的にはRGBの逆エンディアン版です。しかし、使いやすくするために独自のモデルを持っています。
QPixelFormat::Indexed2カラーモデルはカラーパレットを使用します。
QPixelFormat::Grayscale3カラーモデルはグレースケールです。
QPixelFormat::CMYK4カラーモデルはCMYKです。
QPixelFormat::HSL5カラーモデルは HSL です。
QPixelFormat::HSV6カラーモデルは HSV。
QPixelFormat::YUV7カラーモデルはYUVです。
QPixelFormat::Alpha8[5.5以降] カラーモデルはなく、アルファのみが使用されます。

enum QPixelFormat::TypeInterpretation

この列挙型は、ピクセルフォーマットのtype interpretation を記述する。

定数説明
QPixelFormat::UnsignedInteger0ピクセルは1つ以上のunsigned int として読まれるべきである。
QPixelFormat::UnsignedShort1ピクセルは1つ以上のunsigned short として読まれるべきである。
QPixelFormat::UnsignedByte2ピクセルは1つ以上のbyte として読み込まれるべきである。
QPixelFormat::FloatingPoint3qfloat16 float ピクセルは1つ以上の浮動小数点数として読み込まれるべきであり,具体的な型は色/アルファチャンネルによって定義される.

byteOrder()も参照

enum QPixelFormat::YUVLayout

こ の enum は、 ピ ク セル形式がQPixelFormat::YUV の色モデルを持つ場合のYUV layout を記述する。

定数
QPixelFormat::YUV4440
QPixelFormat::YUV4221
QPixelFormat::YUV4112
QPixelFormat::YUV420P3
QPixelFormat::YUV420SP4
QPixelFormat::YV125
QPixelFormat::UYVY6
QPixelFormat::YUYV7
QPixelFormat::NV128
QPixelFormat::NV219
QPixelFormat::IMC110
QPixelFormat::IMC211
QPixelFormat::IMC312
QPixelFormat::IMC413
QPixelFormat::Y814
QPixelFormat::Y1615

メンバ関数ドキュメント

[constexpr noexcept] QPixelFormat::QPixelFormat()

null pixelformat を作成します。このフォーマッ トはQImage::Format_Invalid にマップされます。

[constexpr noexcept] QPixelFormat::QPixelFormat(QPixelFormat::ColorModel colorModel, uchar firstSize, uchar secondSize, uchar thirdSize, uchar fourthSize, uchar fifthSize, uchar alphaSize, QPixelFormat::AlphaUsage alphaUsage, QPixelFormat::AlphaPosition alphaPosition, QPixelFormat::AlphaPremultiplied premultiplied, QPixelFormat::TypeInterpretation typeInterpretation, QPixelFormat::ByteOrder byteOrder = CurrentSystemEndian, uchar subEnum = 0)

データを属性に割り当てるQPixelFormatを作成します。colorModel 、4ビット長のバッファに入れられます。

firstSize secondSize thirdSize fourthSize fifthSize alphaSize はすべて、チャネルのサイズを表すものです。チャンネルは、colorModel によって異なる用途に使用されます。 RGB の場合、firstSize は赤チャンネルを表します。CMYKの場合はシアン・チャンネルの値を表します。

alphaUsage はアルファチャンネルを使うかどうかを表します。

alphaPosition はアルファチャンネルの位置。

premultiplied はアルファチャンネルがすでに色チャンネルと掛け合わされているかどうかを表します。

typeInterpretation はピクセルの解釈方法を表します。

byteOrder は pixelformat のエンディアンを表します。デフォルトはCurrentSystemEndian で、 バイ ト 順序でない形式の場合はシステムのエンディアンに解決され、QPixelFormat::UnsignedByte の場合はQPixelFormat::BigEndian になります。

subEnum は、特別な enum を与えて特別な情報を保存する必要がある colorModels に使用されます。これは YUV が YUV タイプを格納するために使用する。

注意: BGRフォーマットは独自のカラーモデルを持っており、RGBフォーマットと反対のエンディアンを使って記述してはいけません。

[constexpr noexcept] QPixelFormat::AlphaPosition QPixelFormat::alphaPosition() const

カラーチャンネルに対するアルファチャンネルの相対位置のためのアクセサ関数。

個々のチャンネルが個々の単位にマッピングされているフォーマットでは、アルファ位置はこれらの単位からの相対位置となります。たとえばQPixelFormat::AtEnd のアルファ位置を持つQImage::Format_RGBA16FPx4 の場合、 アルファ位置は最後に読み込んだqfloat16 となります。

複数のチャンネルが1つのユニットにパックされているフォーマットの場合、QPixelFormat::AtBeginningQPixelFormat::AtEnd の値は、フォーマット自身のbyteOrder() を基準として、パックされたユニットの最上位ビットと最下位ビットにマッピングされる。

た と えば、QPixelFormat::UnsignedInteger の型解釈 と 、 ホ ス ト シ ス テ ム と つねに一致す るbyteOrder () を持つQImage::Format_ARGB32 の場合、QPixelFormat::AtBeginning のアルフ ァ 位置は、 アルフ ァ がつねに0xFF000000 にあ る こ と を意味 し ます。

ピクセル・フォーマットとホストのエンディアンが一致しない場合は、ピクセル・フォーマットのレイアウトをホストのメモリ・レイアウトに正しくマッピングするように注意しなければならない。

alphaUsage()、alphaSize()、premultiplied()も参照のこと

[constexpr noexcept] uchar QPixelFormat::alphaSize() const

アルファチャンネルサイズを表すアクセサ関数。

[constexpr noexcept] QPixelFormat::AlphaUsage QPixelFormat::alphaUsage() const

アルファチャンネルを使用するかどうかのアクセサ関数。

ピクセル・フォーマットがアルファ・チャンネル用の場所を確保することがあるので、alphaSize() は > 0 を返すが、アルファ・チャンネルは使用されない/無視される。

たとえば、QImage::Format_RGB32 の場合、アルファ・チャネルのサイズは8であるため、bitsPerPixel() は32となるが、alphaUsage() はQPixelFormat::IgnoresAlpha を反映する。

このような状況では、未使用のアルファチャンネルのposition は、カラーチャンネルの配置に影響するため、依然として重要であることに注意。

alphaPosition(),alphaSize(),premultiplied()も参照

[constexpr noexcept] uchar QPixelFormat::bitsPerPixel() const

ピクセルあたりの使用ビット数を表すアクセサ関数。この関数は、すべてのカラーチャンネルの合計とアルファチャンネルのサイズを返します。

[constexpr noexcept] uchar QPixelFormat::blackSize() const

黒/キーカラーチャンネルのアクセサー機能。

[constexpr noexcept] uchar QPixelFormat::blueSize() const

青色チャンネルのサイズに関するアクセサ関数。

[constexpr noexcept] uchar QPixelFormat::brightnessSize() const

輝度チャンネルサイズのアクセサー関数。

[constexpr noexcept] QPixelFormat::ByteOrder QPixelFormat::byteOrder() const

ピクセルフォーマットのバイトオーダーは、typeInterpretation ()で記述されるように、個々のタイプユニットのメモリレイアウトを決定する。

この値はコンストラクタでシステムのエンディアン値に変換されるため、この関数がQPixelFormat::CurrentSystemEndian を返すことはない。

typeInterpretation()QPixelFormat::UnsignedByte を持つピクセルフォーマットの場合、これは通常QPixelFormat::BigEndian となり、その他の型解釈は通常現在のシステムのエンディアンを反映する。

ピクセルフォーマットのバイトオーダーが現在のシステムと一致する場合、ホストシステムのエンディアンに関係なく、個々の型ユニットは同じビットマスクと操作を使って読み取りと操作ができます。例えば、QPixelFormat::UnsignedInteger の型解釈を持つQImage::Format_ARGB32 では、ホストのエンディアンに関係なく、unsigned int0xFF000000 でマスクすることで、常にアルファを読み取ることができる。

ピクセル・フォーマットとホストのエンディアンが一致しない場合は、これを考慮する必要があります。QImage のようなクラスは、このような場合、ホストシステムのエンディアンに合わせて内部ビットを入れ替えません。

typeInterpretation() およびalphaPosition()も参照の こと。

[constexpr noexcept] uchar QPixelFormat::channelCount() const

チャンネルカウントのアクセサ関数。

チャンネルカウントは、サイズが0以上のチャンネル(カラーとアルファ)を表す。

[constexpr noexcept] QPixelFormat::ColorModel QPixelFormat::colorModel() const

カラーモデル用アクセサ関数。

QPixelFormat::YUV 、個々のマクロピクセルは記述できないことに注意。代わりにYUV formats のリストが提供され、bitsPerPixel() の値はYUVレイアウトから推測される。

[constexpr noexcept] uchar QPixelFormat::cyanSize() const

シアン色チャンネルのアクセサ関数。

[constexpr noexcept] uchar QPixelFormat::greenSize() const

緑色カラーチャンネルのサイズに関するアクセサ関数。

[constexpr noexcept] uchar QPixelFormat::hueSize() const

色相チャンネルサイズのアクセサ関数。

[constexpr noexcept] uchar QPixelFormat::lightnessSize() const

明度チャンネルサイズのアクセサ関数。

[constexpr noexcept] uchar QPixelFormat::magentaSize() const

メガエンタ色チャンネル用のアクセサ関数。

[constexpr noexcept] QPixelFormat::AlphaPremultiplied QPixelFormat::premultiplied() const

アルファチャンネルをカラーチャンネルに乗算するかどうかを指定するアクセサ関数。

[constexpr noexcept] uchar QPixelFormat::redSize() const

赤の色チャンネルのサイズに関するアクセサ関数。

[constexpr noexcept] uchar QPixelFormat::saturationSize() const

飽和チャンネルサイズのアクセサ関数。

[constexpr noexcept] QPixelFormat::TypeInterpretation QPixelFormat::typeInterpretation() const

型の解釈は、各ピクセルをどのように読み取るかを決定する。

各ピクセルは、指定された型の1つまたは複数のユニットとして表現され、メモリ上に順次配置される。

注: ピクセル・フォーマットのbyte order とホスト・システムのエンディアンは、読み込まれる各ユニットのメモリ・レイアウトに影響するだけで、ユニットの相対的な順序には影響しない

例えば、QImage::Format_Mono は、ピクセルあたり1ビットのpixel format と、QPixelFormat::UnsignedByte のタイプ解釈を持っており、これは単一のbyte として読み込まれるべきである。同様に、QImage::Format_RGB888 は、ピクセルあたり24ビットのpixel format と、QPixelFormat::UnsignedByte タイプの解釈を持っており、これは3つの連続したbyteとして読むべきである。

QImage formats の多くは32ビットで、型解釈はQPixelFormat::UnsignedInteger であり、単一のunsigned int として読むべきである。

QImage::Format_RGBA16FPx4QImage::Format_RGBA32FPx4 のようなQPixelFormat::FloatingPoint フォーマットの場合、タイプは個々のカラー/アルファ・チャンネルのサイズに基づいて決定され、16ビットのハーフ・フロート・フォーマットにはqfloat16 、32ビットのフル・フロート・フォーマットにはfloat となる。

byteOrder()も参照

[constexpr noexcept] uchar QPixelFormat::yellowSize() const

黄色のカラーチャンネル用のアクセサ関数。

[constexpr noexcept] QPixelFormat::YUVLayout QPixelFormat::yuvLayout() const

YUVLayout 。 YUVカラーモデルはマクロピクセルを使用するため、YUVピクセルフォーマットのカラーチャンネルを記述することは困難である。その代わりに、ピクセルのレイアウトはenumとして保存される。

関連する非会員

[constexpr noexcept] QPixelFormat qPixelFormatAlpha(uchar channelSize, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)

アルファフォーマットを作成するコンストラクタ関数。マスクフォーマットを記述するには、channelSize に 1 を渡します。 また、channelSize に 8 を、FloatingPointtypeInterpretation を渡すことで、各ピクセルを記述するために倍数を使用して非常に正確なアルファフォーマットを定義することも可能です。

QPixelFormat::TypeInterpretationも参照して ください。

[constexpr noexcept] QPixelFormat qPixelFormatCmyk(uchar channelSize, uchar alphaSize = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)

CMYKフォーマットを作成するコンストラクタ関数。チャンネル数は、alphaSize がゼロより大きいかどうかに応じて 4 か 5 になります。CMYK カラーチャンネルはすべてchannelSize の値に設定されます。

alphaUsage alphaPositiontypeInterpretation はすべて、同じ名前のアクセサでアクセスできます。

QPixelFormat::TypeInterpretationも参照

[constexpr noexcept] QPixelFormat qPixelFormatGrayscale(uchar channelSize, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)

グレースケールフォーマットを作成するコンストラクタ関数。モノクロフォーマットは、channelSize に 1 を渡すことで記述できます。また、channelSize に 8 を、FloatingPointtypeInterpretation を渡すことで、各ピクセルを記述するために倍数を使用して非常に正確なグレースケール・フォーマットを定義することも可能です。

QPixelFormat::TypeInterpretationも参照してください

[constexpr noexcept] QPixelFormat qPixelFormatHsl(uchar channelSize, uchar alphaSize = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::FloatingPoint)

HSL フォーマットを作成するコンストラクタ関数。チャンネル数は、alphaSize が 0 より大きいかどうかに応じて 3 または 4 になります。

channelSizehueSize saturationSizelightnessSize を同じ値に設定します。

alphaUsage alphaPositiontypeInterpretation はすべて同じ名前のアクセサでアクセスできます。

[constexpr noexcept] QPixelFormat qPixelFormatHsv(uchar channelSize, uchar alphaSize = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::FloatingPoint)

HSV フォーマットを作成するコンストラクタ関数。チャンネル数は、alphaSize が 0 より大きいかどうかに応じて 3 または 4 になります。

channelSizehueSize saturationSizebrightnessSize を同じ値に設定します。

alphaUsage alphaPositiontypeInterpretation はすべて同じ名前のアクセサでアクセスできます。

[constexpr noexcept] QPixelFormat qPixelFormatRgba(uchar redSize, uchar greenSize, uchar blueSize, uchar alphaSize, QPixelFormat::AlphaUsage alphaUsage, QPixelFormat::AlphaPosition alphaPosition, QPixelFormat::AlphaPremultiplied premultiplied = QPixelFormat::NotPremultiplied, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)

RGB pixelformatを作成するコンストラクタ関数です。redSize greenSize blueSize は各カラーチャンネルのサイズを表します。alphaSize はアルファチャンネルのサイズを記述し、その位置はalphaPosition で記述します。alphaUsage はアルファチャンネルを使用するかどうかを決定するために使用します。アルファチャンネルサイズを8に設定し、alphaUsageIgnoresAlpha に設定することで、rgbチャンネルが24ビットしか使用しない32ビットフォーマットを作成することができます。premultiplied typeInterpretation は、同じ名前のアクセサでアクセスできます。

QPixelFormat::TypeInterpretationも参照して ください。

QPixelFormat qPixelFormatYuv(QPixelFormat::YUVLayout yuvLayout, uchar alphaSize = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::AlphaPremultiplied premultiplied = QPixelFormat::NotPremultiplied, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedByte, QPixelFormat::ByteOrder byteOrder = QPixelFormat::BigEndian)

yuvLayout でYUVフォーマットを記述したQPixelFormat を作成するためのコンストラクタ関数。alphaSize で潜在的なアルファチャンネルのサイズを記述し、その位置はalphaPosition で記述する。第1" "第2" ... "第5 "チャンネルはすべて0に設定されます。alphaUsage premultiplied typeInterpretationbyteOrder は他のフォーマットと同様に動作します。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.