QPixelFormat Class

QPixelFormat은 그래픽 버퍼의 다양한 픽셀 레이아웃을 설명하는 클래스입니다. 더 보기...

Header: #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 열거형에 의해 결정됩니다. 이는 색상 값을 바이트 단위로 읽어야 하는지, 아니면 픽셀을 완전한 정수로 읽은 다음 마스킹해야 하는지를 설명합니다.

YUV의 매크로 픽셀에 대한 설명은 지원되지 않습니다. 대신 YUV 형식의 목록이 만들어졌습니다. QPixelFormat이 YUV 형식을 설명하는 경우, bitsPerPixel 값은 YUV 레이아웃 열거형에 의해 추론되었습니다. 또한 bitsPerPixel 값을 저장해야 하는 다섯 번째 색상 채널을 제외한 색상 채널은 모두 0으로 설정해야 합니다.

TypeInterpretation참조하세요 .

멤버 유형 문서

enum QPixelFormat::AlphaPosition

이 열거형 유형은 색상 채널에 대한 알파 채널 위치를 설명하는 데 사용됩니다.

Constant설명
QPixelFormat::AtBeginning0알파 채널이 컬러 채널 앞에 배치됩니다. 예: ARGB.
QPixelFormat::AtEnd1알파 채널이 컬러 채널의 뒤에 배치됩니다. 예: RGBA.

enum QPixelFormat::AlphaPremultiplied

이 열거형 유형은 알파 채널이 컬러 채널에 곱해졌는지 여부에 대한 부울 상태를 설명합니다.

Constant설명
QPixelFormat::NotPremultiplied0알파 채널이 컬러 채널에 곱해지지 않습니다.
QPixelFormat::Premultiplied1알파 채널이 컬러 채널에 곱해집니다.

enum QPixelFormat::AlphaUsage

이 열거형은 알파 채널 사용 여부를 설명합니다. 픽셀 포맷에 알파 채널의 크기가 있지만 실제로는 알파 채널을 사용하지 않는 픽셀 포맷이 있는 경우도 있습니다. 예를 들어 RGB32가 이러한 형식입니다. RGB 채널은 각각 8비트이며 알파 채널이 없습니다. 하지만 각 픽셀의 전체 크기는 32입니다. 따라서 알파 채널 크기는 8이지만 알파 채널은 무시됩니다. 이러한 상황에서는 알파 채널의 위치가 중요하다는 점에 유의해야 합니다.

상수설명
QPixelFormat::IgnoresAlpha1알파 채널이 사용되지 않습니다.
QPixelFormat::UsesAlpha0알파 채널이 사용됩니다.

enum QPixelFormat::ByteOrder

이 열거형은 픽셀 형식의 바이트 순서를 설명합니다. 이 열거형은 대부분 무시되지만 YUV 형식에 대한 몇 가지 사용 사례가 있습니다. RGB 형식에는 고유한 색상 모델이 있으므로 RGB 형식의 반대 엔디안을 사용하여 설명해서는 안 됩니다.

Constant설명
QPixelFormat::LittleEndian0바이트 순서는 리틀 엔디안입니다.
QPixelFormat::BigEndian1바이트 순서는 빅 엔디안입니다.
QPixelFormat::CurrentSystemEndian2이 열거형은 저장되지 않고 생성자에서 현재 시스템의 열거형과 일치하는 엔디안 열거형으로 변환됩니다.

enum QPixelFormat::ColorModel

이 열거형 유형은 픽셀 형식의 색상 모델을 설명하는 데 사용됩니다. 알파는 5.5에 추가되었습니다.

Constant설명
QPixelFormat::RGB0색상 모델은 RGB입니다.
QPixelFormat::BGR1이것은 논리적으로 RGB의 반대 엔디안 버전입니다. 그러나 사용 편의성을 위해 자체 모델이 있습니다.
QPixelFormat::Indexed2색상 모델은 색상 팔레트를 사용합니다.
QPixelFormat::Grayscale3색상 모델은 그레이스케일입니다.
QPixelFormat::CMYK4색상 모델은 CMYK입니다.
QPixelFormat::HSL5색상 모델은 HSL입니다.
QPixelFormat::HSV6색상 모델은 HSV입니다.
QPixelFormat::YUV7색상 모델이 YUV입니다.
QPixelFormat::Alpha8색상 모델이 없으며 알파만 사용됩니다.

enum QPixelFormat::TypeInterpretation

이 열거형은 각 픽셀이 해석되는 방식을 설명합니다. 픽셀을 전체 32비트 부호 없는 정수로 읽은 다음 각 채널을 마스크 처리하거나 각 바이트를 부호 없는 문자 값으로 읽는 경우입니다. 일반적으로 QImage 형식은 하나의 픽셀을 부호가 없는 정수로 해석한 다음 색상 채널을 마스킹합니다. 반면 OpenGL은 일반적으로 픽셀을 "한 바이트씩", 즉 부호 없는 바이트로 해석합니다.

QImage 또한 픽셀이 부호 없는 바이트로 해석되는 Format_RGBA8888(및 그 파생 형식)이 있습니다. OpenGL에는 부호 없는 정수 형식으로 픽셀 버퍼를 업로드할 수 있는 확장 기능이 있습니다.

An unsigned integer ARGB32 pixel.

위 이미지는 부호 없는 정수로 읽은 메모리 내 ARGB 픽셀을 보여줍니다. 그러나 이 픽셀을 리틀 엔디안 시스템에서 바이트 단위로 읽으면 첫 번째 바이트는 B 채널이 포함된 바이트가 됩니다. 다음 바이트는 G 채널, 그 다음 바이트는 R 채널, 마지막 바이트는 A 채널이 됩니다. 이는 리틀 엔디안 시스템에서 각 픽셀이 해석되는 방식이 정수 형식에 중요하다는 것을 보여줍니다. 빅 엔디안 시스템에서는 그렇지 않습니다.

상수
QPixelFormat::UnsignedInteger0
QPixelFormat::UnsignedShort1
QPixelFormat::UnsignedByte2
QPixelFormat::FloatingPoint3

enum QPixelFormat::YUVLayout

YUV는 컬러 채널의 크기를 설명하는 것으로 표현되지 않습니다. 이는 YUV가 매크로 픽셀을 사용하는 경우가 많아 별도의 색상 채널 개념이 유효하지 않기 때문입니다. 대신 이 열거형을 사용하여 다양한 YUV 레이아웃을 설명합니다.

Constant
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()

널 픽셀 포맷을 생성합니다. 이 형식은 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의 경우 첫 번째 크기는 빨간색 채널을 나타냅니다. CMYK에서는 시안 채널의 값을 나타냅니다.

alphaUsage 는 알파 채널의 사용 여부를 나타냅니다.

alphaPosition 는 알파 채널의 위치입니다.

premultiplied 알파 채널에 이미 컬러 채널이 곱해져 있는지 여부를 나타냅니다.

typeInterpretation 픽셀이 해석되는 방식입니다.

byteOrder 픽셀 형식의 엔디안을 나타냅니다. 기본값은 CurrentSystemEndian 입니다.

subEnum 는 추가 열거형을 제공하여 추가 정보를 저장해야 하는 컬러 모델에 사용됩니다. YUV에서 YUV 유형을 저장하는 데 사용됩니다. 기본값은 0입니다.

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

알파포지션에 대한 접근자 함수입니다.

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

알파 채널 크기에 대한 접근자 함수입니다.

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

알파에 대한 접근자 함수입니다.

[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

채널 수를 구하기 위한 접근자 함수입니다. 채널 수는 크기가 0보다 큰 색상 채널과 알파 채널의 크기가 0보다 큰 경우 추론됩니다.

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

컬러모델을 가져오기 위한 접근자 함수입니다.

[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 열거형에 대한 접근자 함수입니다. 알파 채널이 색상 채널에 곱해지는지 여부를 나타냅니다.

[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 픽셀 형식의 색상 채널을 설명하기 어렵습니다. 대신 픽셀의 레이아웃이 열거형으로 저장됩니다.

관련 비회원

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

알파 포맷을 생성하는 생성자 함수입니다. 마스크 형식은 channelSize 에 1을 전달하여 설명할 수 있습니다. 또한 8을 channelSize 으로, 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 이 0보다 큰지 여부에 따라 4 또는 5가 됩니다. CMYK 색상 채널은 모두 channelSize 의 값으로 설정됩니다.

alphaUsage alphaPositiontypeInterpretation 는 모두 같은 이름의 접근자로 액세스할 수 있습니다.

QPixelFormat::TypeInterpretation참조하세요 .

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

그레이 스케일 포맷을 생성하는 생성자 함수입니다. 흑백 형식은 channelSize 에 1을 전달하여 설명할 수 있습니다. 8을 channelSize 으로, 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)

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::LittleEndian)

생성자 함수는 yuvLayout 으로 YUV 포맷을 설명하는 QPixelFormat 을 생성하고 alphaSize 으로 잠재적 알파 채널의 크기를 설명하며 alphaPosition 으로 위치를 설명합니다. "첫 번째" "두 번째" ... "다섯 번째" 채널은 모두 0으로 설정됩니다. alphaUsage premultiplied typeInterpretationbyteOrder 은 다른 포맷과 마찬가지로 작동합니다.

© 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.