1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00
JUCE/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.h
2011-11-15 17:10:48 +00:00

86 lines
3.3 KiB
C++

/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#ifndef __JUCE_OPENGLGRAPHICSCONTEXT_JUCEHEADER__
#define __JUCE_OPENGLGRAPHICSCONTEXT_JUCEHEADER__
//==============================================================================
/** A LowLevelGraphicsContext for rendering into an OpenGL framebuffer or window.
*/
class JUCE_API OpenGLRenderer : public LowLevelGraphicsContext
{
public:
explicit OpenGLRenderer (OpenGLComponent& target);
explicit OpenGLRenderer (OpenGLFrameBuffer& target);
OpenGLRenderer (unsigned int frameBufferID, int width, int height);
~OpenGLRenderer();
bool isVectorDevice() const;
void setOrigin (int x, int y);
void addTransform (const AffineTransform&);
float getScaleFactor();
bool clipToRectangle (const Rectangle<int>&);
bool clipToRectangleList (const RectangleList&);
void excludeClipRectangle (const Rectangle<int>&);
void clipToPath (const Path& path, const AffineTransform&);
void clipToImageAlpha (const Image& sourceImage, const AffineTransform&);
bool clipRegionIntersects (const Rectangle<int>&);
Rectangle<int> getClipBounds() const;
bool isClipEmpty() const;
void saveState();
void restoreState();
void beginTransparencyLayer (float opacity);
void endTransparencyLayer();
void setFill (const FillType& fillType);
void setOpacity (float newOpacity);
void setInterpolationQuality (Graphics::ResamplingQuality);
void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
void fillPath (const Path& path, const AffineTransform& transform);
void drawImage (const Image& sourceImage, const AffineTransform& transform);
void drawLine (const Line <float>& line);
void drawVerticalLine (int x, float top, float bottom);
void drawHorizontalLine (int y, float left, float right);
void setFont (const Font&);
Font getFont();
void drawGlyph (int glyphNumber, const AffineTransform&);
#ifndef DOXYGEN
class SavedState;
class GLState;
#endif
private:
ScopedPointer<GLState> glState;
RenderingHelpers::SavedStateStack<SavedState> stack;
};
#endif // __JUCE_OPENGLGRAPHICSCONTEXT_JUCEHEADER__