QCanvasOffscreenCanvas Class
QCanvasOffscreenCanvas는 QCanvasPainter 가 타겟팅할 수 있는 화면 밖 캔버스를 나타냅니다. 더 보기...
| 헤더: | #include <QCanvasOffscreenCanvas> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS CanvasPainter)target_link_libraries(mytarget PRIVATE Qt6::CanvasPainter) |
| 이후 | Qt 6.11 |
| 상태: | 기술 미리보기 |
공용 형
공용 함수
| QCanvasOffscreenCanvas(const QCanvasOffscreenCanvas &canvas) | |
| ~QCanvasOffscreenCanvas() | |
| void | detach() |
| QColor | fillColor() const |
| QCanvasOffscreenCanvas::Flags | flags() const |
| bool | isNull() const |
| void | setFillColor(const QColor &color) |
| QRhiTexture * | texture() const |
| QCanvasOffscreenCanvas & | operator=(const QCanvasOffscreenCanvas &canvas) |
관련 비회원
| bool | operator!=(const QCanvasOffscreenCanvas &lhs, const QCanvasOffscreenCanvas &rhs) |
| bool | operator==(const QCanvasOffscreenCanvas &lhs, const QCanvasOffscreenCanvas &rhs) |
상세 설명
오프스크린 캔버스는 기본적으로 색상 버퍼( QRhiTexture)와 기타 관련 그래픽 리소스를 포함합니다. 콘텐츠가 캔버스의 색상 버퍼에 렌더링된 후 캔버스를 registered 으로 호출하여 drawImage() 호출 또는 image pattern 로 사용할 수 있는 QCanvasImage 을 가져올 수 있습니다.
화면 밖 캔버스를 만들려면 QCanvasPainter::createCanvas()를 호출합니다. 그리기 명령으로 화면 밖 캔버스를 대상으로 하려면 하위 수준 API로 작업할 때는 적절한 QCanvasRhiPaintDriver::beginPaint() 오버로드를 호출하고, 편의 위젯이나 Qt Quick 항목 클래스를 사용할 때는 QCanvasPainterWidget::beginCanvasPainting() 또는 QCanvasPainterItemRenderer::beginCanvasPainting()를 호출하세요.
QCanvasImage 및 QCanvasBrush 과 유사하게 QCanvasOffscreenCanvas는 명시적으로 공유됩니다. 자세한 내용은 암시적 데이터 공유 및 QSharedDataPointer 을 참조하세요.
참고: QCanvasImage 와 마찬가지로 QCanvasOffscreenCanvas는 단순히 핸들을 포함하는 객체로 볼 수 있습니다. 분리가 발생하더라도 실제 리소스(예: 기본 텍스처 및 그 안의 이미지 데이터)는 실제로 복사되거나 복제되지 않습니다. 실제 그래픽 리소스(예: QRhiTexture)의 실제 소유자는 createCanvas()를 통해 QCanvasOffscreenCanvas를 배포한 QCanvasPainter 입니다.
캔버스는 항상 캔버스를 만든 QCanvasPainter 에 속합니다. 캔버스를 수동으로 소멸하려면 destroyCanvas()를 호출하면 됩니다. 그러나 대부분의 경우 페인터가 자체적으로 캔버스를 소멸하는 동안 자동으로 캔버스를 소멸하므로 이 작업은 필요하지 않습니다.
멤버 유형 문서
열거형 클래스 QCanvasOffscreenCanvas::Flag
플래그 QCanvasOffscreenCanvas::Flags
캔버스의 플래그를 지정합니다.
| Constant | 값 | 설명 |
|---|---|---|
QCanvasOffscreenCanvas::Flag::PreserveContents | 0x01 | 캔버스에 페인팅할 때 캔버스의 내용이 보존됨을 나타냅니다. GPU 아키텍처에 따라 성능에 부정적인 영향을 미칠 수 있습니다. 자세한 내용은 QRhiTextureRenderTarget::PreserveColorContents 을 참조하십시오. 샘플 수가 1보다 큰 경우 이 플래그 설정은 지원되지 않습니다. |
QCanvasOffscreenCanvas::Flag::MipMaps | 0x02 | 캔버스의 배경 텍스처에 밉매핑이 활성화되어 있어야 함을 나타냅니다. 샘플 수가 1보다 큰 경우 이 플래그 설정은 지원되지 않습니다. GenerateMipmaps 플래그가 설정된 상태에서 addImage()를 호출하면 밉맵 시퀀스가 생성됩니다. 즉, 캔버스의 콘텐츠가 변경될 때마다 addImage()를 호출해야 밉맵 체인이 다시 생성된다는 의미입니다. 밉맵을 자주 생성하면 성능에 부정적인 영향을 미칠 수 있습니다. |
Flags 유형은 QFlags<Flag>에 대한 typedef입니다. 플래그 값의 OR 조합을 저장합니다.
멤버 함수 문서
QCanvasOffscreenCanvas::QCanvasOffscreenCanvas(const QCanvasOffscreenCanvas &canvas)
생성자 복사.
[noexcept] QCanvasOffscreenCanvas::~QCanvasOffscreenCanvas()
파괴자.
void QCanvasOffscreenCanvas::detach()
여러 캔버스가 공통 데이터를 공유하는 경우, 이 이미지는 데이터의 복사본을 만들고 공유 메커니즘에서 분리되어 이 이미지가 데이터를 참조하는 유일한 이미지가 되도록 합니다.
참조가 하나만 있는 경우에는 아무 작업도 수행되지 않습니다.
참고: 캔버스에는 기본 그래픽 리소스에 대한 핸들과 채우기 색상과 같은 데이터만 포함됩니다. QRhiTexture 와 같은 그래픽 리소스 자체는 복사되거나 복제되지 않습니다.
QColor QCanvasOffscreenCanvas::fillColor() const
현재 채우기 색을 반환합니다.
setFillColor()도 참조하세요 .
QCanvasOffscreenCanvas::Flags QCanvasOffscreenCanvas::flags() const
캔버스가 생성된 플래그를 반환합니다.
플래그는 변경할 수 없으며 캔버스가 생성된 후에는 변경할 수 없습니다.
bool QCanvasOffscreenCanvas::isNull() const
이 캔버스에 유효한 데이터가 있으면 참을 반환합니다.
일반적으로 이 함수는 항상 참입니다.
texture()도 참조하세요 .
void QCanvasOffscreenCanvas::setFillColor(const QColor &color)
채우기(지우기) 색상을 color 로 설정합니다.
기본적으로 createCanvas()에 전달된 값으로 설정됩니다.
fillColor()도 참조하세요 .
QRhiTexture *QCanvasOffscreenCanvas::texture() const
이 오프스크린 캔버스를 뒷받침하는 텍스처를 반환합니다.
isNull()도 참조하세요 .
QCanvasOffscreenCanvas &QCanvasOffscreenCanvas::operator=(const QCanvasOffscreenCanvas &canvas)
주어진 canvas 의 얕은 복사본을 이 캔버스에 할당하고 이 캔버스에 대한 참조를 반환합니다. 얕은 복사본에 대한 자세한 내용은 암시적 데이터 공유 설명서를 참조하세요.
참고: 기본 리소스인 QRhiTexture 과 같은 그래픽 리소스는 복사되거나 복제되지 않습니다.
관련 비회원
[noexcept] bool operator!=(const QCanvasOffscreenCanvas &lhs, const QCanvasOffscreenCanvas &rhs)
캔버스 핸들 lhs 이 rhs 과 다르면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.
operator==()도 참조하세요 .
[noexcept] bool operator==(const QCanvasOffscreenCanvas &lhs, const QCanvasOffscreenCanvas &rhs)
캔버스 핸들 lhs 이 rhs 과 같으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.
참고: 같다는 것은 두 캔버스 객체의 채우기 색상이 동일하고 동일한 그래픽 리소스를 참조한다는 의미입니다. 내용(픽셀 데이터)은 비교되지 않습니다.
operator!=()도 참조하세요 .
© 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.