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::LittleEndian) |
詳しい説明
Qt では、グラフィックスバッファ内のピクセルのレイアウトを表現する必要がよくあります。内部的にはQPixelFormatはすべてを64ビットのデータ構造に格納します。これによりパフォーマンスが向上しますが、いくつかの制限もあります。
QPixelFormatは5つのカラーチャンネルと1つのアルファチャンネルを記述することができ、それぞれがカラーチャンネルのサイズを記述するために6ビットを使用することができます。
アルファ・チャンネルの位置は別の列挙型で記述する。これは、ARGB32のようなQImage 、RBGA8888のような典型的なOpenGLフォーマットを記述できるようにするためです。
ピクセルがどのように読み込まれるかは、TypeInterpretation enumによって決定される。これは、色値がバイトごとに読み込まれるのか、ピクセルが完全なintとして読み込まれ、その後マスクされるのかを記述します。
YUVのマクロピクセルを記述するためのサポートはありません。その代わりにYUVフォーマットのリストが作られています。QPixelFormat が YUV フォーマットを記述している場合、bitsPerPixel の値は YUV Layout enum によって推測されます。また、色チャンネルは、bitsPerPixel の値を格納する5番目の色チャンネルを除いて、すべてゼロに設定する必要があります。
TypeInterpretationも参照のこと 。
メンバ型ドキュメント
enum QPixelFormat::AlphaPosition
この列挙型は、カラーチャンネルに対するアルファチャンネルの相対的な位置を表すのに使われる。
定数 | 値 | 説明 |
---|---|---|
QPixelFormat::AtBeginning | 0 | アルファチャンネルは色チャンネルの前に置かれます。例えば ARGB。 |
QPixelFormat::AtEnd | 1 | アルファチャンネルは色チャンネルの後ろに置かれます。例: RGBA。 |
enum QPixelFormat::AlphaPremultiplied
この列挙型は、アルファチャンネルがカラーチャンネルに乗算されるかどうかのブール状態を記述する。
定数 | 値 | 説明 |
---|---|---|
QPixelFormat::NotPremultiplied | 0 | アルファチャンネルはカラーチャンネルに乗算されない。 |
QPixelFormat::Premultiplied | 1 | アルファチャンネルはカラーチャンネルに乗算される。 |
enum QPixelFormat::AlphaUsage
この列挙型はアルファチャンネルを使用するかどうかを記述する。pixelformatはアルファチャンネルのサイズを持つが、ピクセルフォーマットは実際にはアルファチャンネルを使用しないことがある。例えば RGB32 はそのようなフォーマットです。RGBチャンネルはそれぞれ8ビットで、アルファチャンネルはありません。しかし、各ピクセルの完全なサイズは32です。したがってアルファ・チャンネルのサイズは8ですが、アルファ・チャンネルは無視されます。このような状況では、アルファチャンネルの位置が重要であることに注意することが重要です。
定数 | 値 | 説明 |
---|---|---|
QPixelFormat::IgnoresAlpha | 1 | アルファチャンネルは使用されません。 |
QPixelFormat::UsesAlpha | 0 | アルファチャンネルが使用される。 |
enum QPixelFormat::ByteOrder
この enum はピクセルフォーマットの ByteOrder を記述する。このenumはほとんど無視されるが、YUVフォーマットでは使用例がある。BGR フォーマットは独自のカラーモデルを持っており、RGB フォーマットに反対のエンディアンを使用して記述すべきではありません。
定数 | 値 | 説明 |
---|---|---|
QPixelFormat::LittleEndian | 0 | バイトオーダーはリトルエンディアン。 |
QPixelFormat::BigEndian | 1 | バイトオーダーはビッグエンディアン。 |
QPixelFormat::CurrentSystemEndian | 2 | この列挙型は保存されず、コンストラクタで現在のシステムの列挙型に一致するエンディアン列挙型に変換されます。 |
enum QPixelFormat::ColorModel
この列挙型は、pixelformatのカラーモデルを記述するために使用される。Alphaは5.5で追加されました。
定数 | 値 | 説明 |
---|---|---|
QPixelFormat::RGB | 0 | カラーモデルはRGBです。 |
QPixelFormat::BGR | 1 | これは論理的にはRGBの逆エンディアン版です。しかし、使いやすくするために独自のモデルを持っています。 |
QPixelFormat::Indexed | 2 | カラーモデルはカラーパレットを使用します。 |
QPixelFormat::Grayscale | 3 | カラーモデルはグレースケールです。 |
QPixelFormat::CMYK | 4 | カラーモデルはCMYKです。 |
QPixelFormat::HSL | 5 | カラーモデルは HSL です。 |
QPixelFormat::HSV | 6 | カラーモデルは HSV。 |
QPixelFormat::YUV | 7 | カラーモデルはYUVです。 |
QPixelFormat::Alpha | 8 | カラーモデルはなく、アルファのみが使用されます。 |
enum QPixelFormat::TypeInterpretation
この列挙型は、各ピクセルがどのように解釈されるかを記述する。ピクセルを完全な32ビット符号なし整数として読み込んでから各チャンネルをマスクアウトする場合、または各バイトを符号なしchar値として読み込む場合。通常、QImage フォーマットは、1 つのピクセルを符号なし整数として解釈し、カラー・チャンネルをマスクします。一方、OpenGLは通常、ピクセルを「1バイトずつ」、つまり符号なしバイトとして解釈します。
QImage また、Format_RGBA8888(およびその派生)というフォーマットもあり、そこではピクセルは符号なしバイトとして解釈されます。OpenGLには拡張機能があり、符号なし整数形式でピクセルバッファをアップロードすることができます。
上の画像は、メモリ上のARGBピクセルを符号なし整数として読み込んだものです。しかし、このピクセルをリトルエンディアン・システムでバイトごとに読み込むと、最初のバイトはBチャンネルを含むバイトになります。次のバイトはGチャンネルで、次にRチャンネル、最後にAチャンネルとなる。これは、リトルエンディアン・システムでは、各ピクセルがどのように解釈されるかが整数フォーマットにとって重要であることを示している。ビッグエンディアンシステムではそうではありません。
定数 | 値 |
---|---|
QPixelFormat::UnsignedInteger | 0 |
QPixelFormat::UnsignedShort | 1 |
QPixelFormat::UnsignedByte | 2 |
QPixelFormat::FloatingPoint | 3 |
enum QPixelFormat::YUVLayout
YUVは色チャンネルの大きさを記述することによって表現されない。これは、YUVがマクロピクセルを使用することが多く、個別のカラーチャンネルという概念が無効だからである。その代わりに、異なるYUVレイアウトはこの列挙型で記述されます。
定数 | 値 |
---|---|
QPixelFormat::YUV444 | 0 |
QPixelFormat::YUV422 | 1 |
QPixelFormat::YUV411 | 2 |
QPixelFormat::YUV420P | 3 |
QPixelFormat::YUV420SP | 4 |
QPixelFormat::YV12 | 5 |
QPixelFormat::UYVY | 6 |
QPixelFormat::YUYV | 7 |
QPixelFormat::NV12 | 8 |
QPixelFormat::NV21 | 9 |
QPixelFormat::IMC1 | 10 |
QPixelFormat::IMC2 | 11 |
QPixelFormat::IMC3 | 12 |
QPixelFormat::IMC4 | 13 |
QPixelFormat::Y8 | 14 |
QPixelFormat::Y16 | 15 |
メンバ関数ドキュメント
[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
subEnum は、colorModels に enum を追加して余分な情報を格納する必要がある場合に使用します。これはYUVがYUVタイプを格納するために使用します。デフォルト値は0です。
[constexpr noexcept]
QPixelFormat::AlphaPosition QPixelFormat::alphaPosition() const
alphaPosition のアクセサ関数。
[constexpr noexcept]
uchar QPixelFormat::alphaSize() const
アルファチャンネルサイズを表すアクセサ関数。
[constexpr noexcept]
QPixelFormat::AlphaUsage QPixelFormat::alphaUsage() const
alphaUsage のアクセサ関数。
[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
バイトオーダーはほとんどの場合、現在のシステムのバイトオーダーが設定される。しかし、いくつかのYUVフォーマットを記述するのに便利なこともある。この値はコンストラクタでエンディアン値に変換されるため、この関数は決してQPixelFormat::CurrentSystemEndian を返してはならない。
[constexpr noexcept]
uchar QPixelFormat::channelCount() const
channelCount を取得するためのアクセサ関数。チャンネル数は、サイズが0を超えるカラーチャンネル、およびアルファチャンネルのサイズが0を超える場合に推論される。
[constexpr noexcept]
QPixelFormat::ColorModel QPixelFormat::colorModel() const
colorModel を取得するためのアクセサ関数です。
[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
AlphaPremultiplied enum のアクセサ関数。これは、アルファチャンネルがカラーチャンネルに乗算されるかどうかを示します。
[constexpr noexcept]
uchar QPixelFormat::redSize() const
赤の色チャンネルのサイズに関するアクセサ関数。
[constexpr noexcept]
uchar QPixelFormat::saturationSize() const
飽和チャンネルサイズのアクセサ関数。
[constexpr noexcept]
QPixelFormat::TypeInterpretation QPixelFormat::typeInterpretation() const
色チャネルまたはピクセルの型表現のためのアクセサ関数。
TypeInterpretationも参照してください 。
[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 を、FloatingPoint にtypeInterpretation を渡すことで、各ピクセルをダブル値で記述する非常に正確なアルファフォーマットを定義することも可能です。
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 alphaPosition とtypeInterpretation はすべて、同じ名前のアクセサでアクセスできます。
QPixelFormat::TypeInterpretationも参照 。
[constexpr noexcept]
QPixelFormat qPixelFormatGrayscale(uchar channelSize, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)
グレースケールフォーマットを作成するコンストラクタ関数。モノクロフォーマットは、channelSize に 1 を渡すことで記述できます。また、channelSize に 8 を、FloatingPoint にtypeInterpretation を渡すことで、各ピクセルを記述するために倍数を使用して、非常に正確なグレースケール・フォーマットを定義することも可能です。
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 になります。
channelSize は と を同じ値に設定します。hueSize saturationSize lightnessSize
alphaUsage alphaPosition とtypeInterpretation はすべて同じ名前のアクセサでアクセスできます。
[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 になります。
channelSize は と を同じ値に設定します。hueSize saturationSize brightnessSize
alphaUsage alphaPosition とtypeInterpretation はすべて同じ名前のアクセサでアクセスできます。
[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に設定し、alphaUsage をIgnoresAlpha に設定することで、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::LittleEndian)
yuvLayout でYUVフォーマットを記述したQPixelFormat を作成するためのコンストラクタ関数。alphaSize で潜在的なアルファチャンネルのサイズを記述し、その位置はalphaPosition で記述する。第1" "第2" ... "第5 "チャンネルはすべて0に設定されます。alphaUsage premultiplied typeInterpretation とbyteOrder は他のフォーマットと同様に動作します。
© 2025 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.