123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 | // Copyright (C) 2016 The Qt Company Ltd.// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only#ifndef QSURFACEFORMAT_H#define QSURFACEFORMAT_H#include <QtGui/qtguiglobal.h>#include <QtCore/qobjectdefs.h> QT_BEGIN_NAMESPACE class QColorSpace;class QOpenGLContext;class QSurfaceFormatPrivate;class Q_GUI_EXPORT QSurfaceFormat { Q_GADGET public:enum FormatOption { StereoBuffers =0x0001, DebugContext =0x0002, DeprecatedFunctions =0x0004, ResetNotification =0x0008, ProtectedContent =0x0010};Q_ENUM(FormatOption)Q_DECLARE_FLAGS(FormatOptions, FormatOption)enum SwapBehavior { DefaultSwapBehavior, SingleBuffer, DoubleBuffer, TripleBuffer };Q_ENUM(SwapBehavior)enum RenderableType { DefaultRenderableType =0x0, OpenGL =0x1, OpenGLES =0x2, OpenVG =0x4};Q_ENUM(RenderableType)enum OpenGLContextProfile { NoProfile, CoreProfile, CompatibilityProfile };Q_ENUM(OpenGLContextProfile)#if QT_DEPRECATED_SINCE(6,0)enum ColorSpace { DefaultColorSpace, sRGBColorSpace };Q_ENUM(ColorSpace)#endifenum ColorComponentType { FixedColorComponentType, FloatColorComponentType };Q_ENUM(ColorComponentType)QSurfaceFormat(); Q_IMPLICIT QSurfaceFormat(FormatOptions options);QSurfaceFormat(const QSurfaceFormat &other); QSurfaceFormat &operator=(const QSurfaceFormat &other);~QSurfaceFormat();voidsetDepthBufferSize(int size);intdepthBufferSize()const;voidsetStencilBufferSize(int size);intstencilBufferSize()const;voidsetRedBufferSize(int size);intredBufferSize()const;voidsetGreenBufferSize(int size);intgreenBufferSize()const;voidsetBlueBufferSize(int size);intblueBufferSize()const;voidsetAlphaBufferSize(int size);intalphaBufferSize()const;voidsetColorComponentType(ColorComponentType type); ColorComponentType colorComponentType()const;voidsetSamples(int numSamples);intsamples()const;voidsetSwapBehavior(SwapBehavior behavior); SwapBehavior swapBehavior()const;boolhasAlpha()const;voidsetProfile(OpenGLContextProfile profile); OpenGLContextProfile profile()const;voidsetRenderableType(RenderableType type); RenderableType renderableType()const;voidsetMajorVersion(int majorVersion);intmajorVersion()const;voidsetMinorVersion(int minorVersion);intminorVersion()const;std::pair<int,int>version()const;voidsetVersion(int major,int minor);boolstereo()const;voidsetStereo(bool enable);voidsetOptions(QSurfaceFormat::FormatOptions options);voidsetOption(FormatOption option,bool on =true);booltestOption(FormatOption option)const;QSurfaceFormat::FormatOptions options()const;intswapInterval()const;voidsetSwapInterval(int interval);const QColorSpace &colorSpace()const;voidsetColorSpace(const QColorSpace &colorSpace);#if QT_DEPRECATED_SINCE(6,0)Q_DECL_DEPRECATED_X("Use setColorSpace(QColorSpace) instead.")voidsetColorSpace(ColorSpace colorSpace);#endifstatic voidsetDefaultFormat(const QSurfaceFormat &format);static QSurfaceFormat defaultFormat();private: QSurfaceFormatPrivate *d;voiddetach();boolequals(const QSurfaceFormat &other)const noexcept;friend inlinebooloperator==(const QSurfaceFormat &lhs,const QSurfaceFormat &rhs) noexcept {return lhs.equals(rhs); }friend inlinebooloperator!=(const QSurfaceFormat &lhs,const QSurfaceFormat &rhs) noexcept {return!lhs.equals(rhs); }#ifndef QT_NO_DEBUG_STREAMfriend Q_GUI_EXPORT QDebug operator<<(QDebug,const QSurfaceFormat &);#endif};#ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug,const QSurfaceFormat &);#endifQ_DECLARE_OPERATORS_FOR_FLAGS(QSurfaceFormat::FormatOptions)inlineboolQSurfaceFormat::stereo()const{returntestOption(QSurfaceFormat::StereoBuffers);} QT_END_NAMESPACE #endif//QSURFACEFORMAT_H
|