The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

684 lines
30KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-9 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  19. #define __JUCE_GRAPHICS_JUCEHEADER__
  20. #include "../fonts/juce_Font.h"
  21. #include "../geometry/juce_Rectangle.h"
  22. #include "../geometry/juce_PathStrokeType.h"
  23. #include "../geometry/juce_Line.h"
  24. #include "../colour/juce_Colours.h"
  25. #include "juce_FillType.h"
  26. #include "juce_RectanglePlacement.h"
  27. class LowLevelGraphicsContext;
  28. class Image;
  29. class RectangleList;
  30. //==============================================================================
  31. /**
  32. A graphics context, used for drawing a component or image.
  33. When a Component needs painting, a Graphics context is passed to its
  34. Component::paint() method, and this you then call methods within this
  35. object to actually draw the component's content.
  36. A Graphics can also be created from an image, to allow drawing directly onto
  37. that image.
  38. @see Component::paint
  39. */
  40. class JUCE_API Graphics
  41. {
  42. public:
  43. //==============================================================================
  44. /** Creates a Graphics object to draw directly onto the given image.
  45. The graphics object that is created will be set up to draw onto the image,
  46. with the context's clipping area being the entire size of the image, and its
  47. origin being the image's origin. To draw into a subsection of an image, use the
  48. reduceClipRegion() and setOrigin() methods.
  49. Obviously you shouldn't delete the image before this context is deleted.
  50. */
  51. Graphics (Image& imageToDrawOnto) throw();
  52. /** Destructor. */
  53. ~Graphics() throw();
  54. //==============================================================================
  55. /** Changes the current drawing colour.
  56. This sets the colour that will now be used for drawing operations - it also
  57. sets the opacity to that of the colour passed-in.
  58. If a brush is being used when this method is called, the brush will be deselected,
  59. and any subsequent drawing will be done with a solid colour brush instead.
  60. @see setOpacity
  61. */
  62. void setColour (const Colour& newColour) throw();
  63. /** Changes the opacity to use with the current colour.
  64. If a solid colour is being used for drawing, this changes its opacity
  65. to this new value (i.e. it doesn't multiply the colour's opacity by this amount).
  66. If a gradient is being used, this will have no effect on it.
  67. A value of 0.0 is completely transparent, 1.0 is completely opaque.
  68. */
  69. void setOpacity (const float newOpacity) throw();
  70. /** Sets the context to use a gradient for its fill pattern.
  71. */
  72. void setGradientFill (const ColourGradient& gradient) throw();
  73. /** Sets the context to use a tiled image pattern for filling.
  74. Make sure that you don't delete this image while it's still being used by
  75. this context!
  76. */
  77. void setTiledImageFill (const Image& imageToUse,
  78. int anchorX,
  79. int anchorY,
  80. float opacity) throw();
  81. /** Changes the current fill settings.
  82. @see setColour, setGradientFill, setTiledImageFill
  83. */
  84. void setFillType (const FillType& newFill) throw();
  85. //==============================================================================
  86. /** Changes the font to use for subsequent text-drawing functions.
  87. Note there's also a setFont (float, int) method to quickly change the size and
  88. style of the current font.
  89. @see drawSingleLineText, drawMultiLineText, drawTextAsPath, drawText, drawFittedText
  90. */
  91. void setFont (const Font& newFont) throw();
  92. /** Changes the size and style of the currently-selected font.
  93. This is a convenient shortcut that changes the context's current font to a
  94. different size or style. The typeface won't be changed.
  95. @see Font
  96. */
  97. void setFont (float newFontHeight,
  98. int fontStyleFlags = Font::plain) throw();
  99. /** Draws a one-line text string.
  100. This will use the current colour (or brush) to fill the text. The font is the last
  101. one specified by setFont().
  102. @param text the string to draw
  103. @param startX the position to draw the left-hand edge of the text
  104. @param baselineY the position of the text's baseline
  105. @see drawMultiLineText, drawText, drawFittedText, GlyphArrangement::addLineOfText
  106. */
  107. void drawSingleLineText (const String& text,
  108. int startX, int baselineY) const throw();
  109. /** Draws text across multiple lines.
  110. This will break the text onto a new line where there's a new-line or
  111. carriage-return character, or at a word-boundary when the text becomes wider
  112. than the size specified by the maximumLineWidth parameter.
  113. @see setFont, drawSingleLineText, drawFittedText, GlyphArrangement::addJustifiedText
  114. */
  115. void drawMultiLineText (const String& text,
  116. int startX, int baselineY,
  117. int maximumLineWidth) const throw();
  118. /** Renders a string of text as a vector path.
  119. This allows a string to be transformed with an arbitrary AffineTransform and
  120. rendered using the current colour/brush. It's much slower than the normal text methods
  121. but more accurate.
  122. @see setFont
  123. */
  124. void drawTextAsPath (const String& text,
  125. const AffineTransform& transform) const throw();
  126. /** Draws a line of text within a specified rectangle.
  127. The text will be positioned within the rectangle based on the justification
  128. flags passed-in. If the string is too long to fit inside the rectangle, it will
  129. either be truncated or will have ellipsis added to its end (if the useEllipsesIfTooBig
  130. flag is true).
  131. @see drawSingleLineText, drawFittedText, drawMultiLineText, GlyphArrangement::addJustifiedText
  132. */
  133. void drawText (const String& text,
  134. int x, int y, int width, int height,
  135. const Justification& justificationType,
  136. bool useEllipsesIfTooBig) const throw();
  137. /** Tries to draw a text string inside a given space.
  138. This does its best to make the given text readable within the specified rectangle,
  139. so it useful for labelling things.
  140. If the text is too big, it'll be squashed horizontally or broken over multiple lines
  141. if the maximumLinesToUse value allows this. If the text just won't fit into the space,
  142. it'll cram as much as possible in there, and put some ellipsis at the end to show that
  143. it's been truncated.
  144. A Justification parameter lets you specify how the text is laid out within the rectangle,
  145. both horizontally and vertically.
  146. The minimumHorizontalScale parameter specifies how much the text can be squashed horizontally
  147. to try to squeeze it into the space. If you don't want any horizontal scaling to occur, you
  148. can set this value to 1.0f.
  149. @see GlyphArrangement::addFittedText
  150. */
  151. void drawFittedText (const String& text,
  152. int x, int y, int width, int height,
  153. const Justification& justificationFlags,
  154. int maximumNumberOfLines,
  155. float minimumHorizontalScale = 0.7f) const throw();
  156. //==============================================================================
  157. /** Fills the context's entire clip region with the current colour or brush.
  158. (See also the fillAll (const Colour&) method which is a quick way of filling
  159. it with a given colour).
  160. */
  161. void fillAll() const throw();
  162. /** Fills the context's entire clip region with a given colour.
  163. This leaves the context's current colour and brush unchanged, it just
  164. uses the specified colour temporarily.
  165. */
  166. void fillAll (const Colour& colourToUse) const throw();
  167. //==============================================================================
  168. /** Fills a rectangle with the current colour or brush.
  169. @see drawRect, fillRoundedRectangle
  170. */
  171. void fillRect (int x, int y, int width, int height) const throw();
  172. /** Fills a rectangle with the current colour or brush. */
  173. void fillRect (const Rectangle<int>& rectangle) const throw();
  174. /** Fills a rectangle with the current colour or brush.
  175. This uses sub-pixel positioning so is slower than the fillRect method which
  176. takes integer co-ordinates.
  177. */
  178. void fillRect (float x, float y, float width, float height) const throw();
  179. /** Uses the current colour or brush to fill a rectangle with rounded corners.
  180. @see drawRoundedRectangle, Path::addRoundedRectangle
  181. */
  182. void fillRoundedRectangle (float x, float y, float width, float height,
  183. float cornerSize) const throw();
  184. /** Uses the current colour or brush to fill a rectangle with rounded corners.
  185. @see drawRoundedRectangle, Path::addRoundedRectangle
  186. */
  187. void fillRoundedRectangle (const Rectangle<int>& rectangle,
  188. float cornerSize) const throw();
  189. /** Fills a rectangle with a checkerboard pattern, alternating between two colours.
  190. */
  191. void fillCheckerBoard (int x, int y, int width, int height,
  192. int checkWidth, int checkHeight,
  193. const Colour& colour1, const Colour& colour2) const throw();
  194. /** Draws four lines to form a rectangular outline, using the current colour or brush.
  195. The lines are drawn inside the given rectangle, and greater line thicknesses
  196. extend inwards.
  197. @see fillRect
  198. */
  199. void drawRect (int x, int y, int width, int height,
  200. int lineThickness = 1) const throw();
  201. /** Draws four lines to form a rectangular outline, using the current colour or brush.
  202. The lines are drawn inside the given rectangle, and greater line thicknesses
  203. extend inwards.
  204. @see fillRect
  205. */
  206. void drawRect (float x, float y, float width, float height,
  207. float lineThickness = 1.0f) const throw();
  208. /** Draws four lines to form a rectangular outline, using the current colour or brush.
  209. The lines are drawn inside the given rectangle, and greater line thicknesses
  210. extend inwards.
  211. @see fillRect
  212. */
  213. void drawRect (const Rectangle<int>& rectangle,
  214. int lineThickness = 1) const throw();
  215. /** Uses the current colour or brush to draw the outline of a rectangle with rounded corners.
  216. @see fillRoundedRectangle, Path::addRoundedRectangle
  217. */
  218. void drawRoundedRectangle (float x, float y, float width, float height,
  219. float cornerSize, float lineThickness) const throw();
  220. /** Uses the current colour or brush to draw the outline of a rectangle with rounded corners.
  221. @see fillRoundedRectangle, Path::addRoundedRectangle
  222. */
  223. void drawRoundedRectangle (const Rectangle<int>& rectangle,
  224. float cornerSize, float lineThickness) const throw();
  225. /** Draws a 3D raised (or indented) bevel using two colours.
  226. The bevel is drawn inside the given rectangle, and greater bevel thicknesses
  227. extend inwards.
  228. The top-left colour is used for the top- and left-hand edges of the
  229. bevel; the bottom-right colour is used for the bottom- and right-hand
  230. edges.
  231. If useGradient is true, then the bevel fades out to make it look more curved
  232. and less angular. If sharpEdgeOnOutside is true, the outside of the bevel is
  233. sharp, and it fades towards the centre; if sharpEdgeOnOutside is false, then
  234. the centre edges are sharp and it fades towards the outside.
  235. */
  236. void drawBevel (int x, int y, int width, int height,
  237. int bevelThickness,
  238. const Colour& topLeftColour = Colours::white,
  239. const Colour& bottomRightColour = Colours::black,
  240. bool useGradient = true,
  241. bool sharpEdgeOnOutside = true) const throw();
  242. /** Draws a pixel using the current colour or brush.
  243. */
  244. void setPixel (int x, int y) const throw();
  245. //==============================================================================
  246. /** Fills an ellipse with the current colour or brush.
  247. The ellipse is drawn to fit inside the given rectangle.
  248. @see drawEllipse, Path::addEllipse
  249. */
  250. void fillEllipse (float x, float y, float width, float height) const throw();
  251. /** Draws an elliptical stroke using the current colour or brush.
  252. @see fillEllipse, Path::addEllipse
  253. */
  254. void drawEllipse (float x, float y, float width, float height,
  255. float lineThickness) const throw();
  256. //==============================================================================
  257. /** Draws a line between two points.
  258. The line is 1 pixel wide and drawn with the current colour or brush.
  259. */
  260. void drawLine (float startX,
  261. float startY,
  262. float endX,
  263. float endY) const throw();
  264. /** Draws a line between two points with a given thickness.
  265. @see Path::addLineSegment
  266. */
  267. void drawLine (float startX,
  268. float startY,
  269. float endX,
  270. float endY,
  271. float lineThickness) const throw();
  272. /** Draws a line between two points.
  273. The line is 1 pixel wide and drawn with the current colour or brush.
  274. */
  275. void drawLine (const Line& line) const throw();
  276. /** Draws a line between two points with a given thickness.
  277. @see Path::addLineSegment
  278. */
  279. void drawLine (const Line& line,
  280. float lineThickness) const throw();
  281. /** Draws a dashed line using a custom set of dash-lengths.
  282. @param startX the line's start x co-ordinate
  283. @param startY the line's start y co-ordinate
  284. @param endX the line's end x co-ordinate
  285. @param endY the line's end y co-ordinate
  286. @param dashLengths a series of lengths to specify the on/off lengths - e.g.
  287. { 4, 5, 6, 7 } will draw a line of 4 pixels, skip 5 pixels,
  288. draw 6 pixels, skip 7 pixels, and then repeat.
  289. @param numDashLengths the number of elements in the array (this must be an even number).
  290. @param lineThickness the thickness of the line to draw
  291. @see PathStrokeType::createDashedStroke
  292. */
  293. void drawDashedLine (float startX,
  294. float startY,
  295. float endX,
  296. float endY,
  297. const float* dashLengths,
  298. int numDashLengths,
  299. float lineThickness = 1.0f) const throw();
  300. /** Draws a vertical line of pixels at a given x position.
  301. The x position is an integer, but the top and bottom of the line can be sub-pixel
  302. positions, and these will be anti-aliased if necessary.
  303. */
  304. void drawVerticalLine (int x, float top, float bottom) const throw();
  305. /** Draws a horizontal line of pixels at a given y position.
  306. The y position is an integer, but the left and right ends of the line can be sub-pixel
  307. positions, and these will be anti-aliased if necessary.
  308. */
  309. void drawHorizontalLine (int y, float left, float right) const throw();
  310. //==============================================================================
  311. /** Fills a path using the currently selected colour or brush.
  312. */
  313. void fillPath (const Path& path,
  314. const AffineTransform& transform = AffineTransform::identity) const throw();
  315. /** Draws a path's outline using the currently selected colour or brush.
  316. */
  317. void strokePath (const Path& path,
  318. const PathStrokeType& strokeType,
  319. const AffineTransform& transform = AffineTransform::identity) const throw();
  320. /** Draws a line with an arrowhead.
  321. @param startX the line's start x co-ordinate
  322. @param startY the line's start y co-ordinate
  323. @param endX the line's end x co-ordinate (the tip of the arrowhead)
  324. @param endY the line's end y co-ordinate (the tip of the arrowhead)
  325. @param lineThickness the thickness of the line
  326. @param arrowheadWidth the width of the arrow head (perpendicular to the line)
  327. @param arrowheadLength the length of the arrow head (along the length of the line)
  328. */
  329. void drawArrow (float startX,
  330. float startY,
  331. float endX,
  332. float endY,
  333. float lineThickness,
  334. float arrowheadWidth,
  335. float arrowheadLength) const throw();
  336. //==============================================================================
  337. /** Types of rendering quality that can be specified when drawing images.
  338. @see blendImage, Graphics::setImageResamplingQuality
  339. */
  340. enum ResamplingQuality
  341. {
  342. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  343. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  344. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  345. };
  346. /** Changes the quality that will be used when resampling images.
  347. By default a Graphics object will be set to mediumRenderingQuality.
  348. @see Graphics::drawImage, Graphics::drawImageTransformed, Graphics::drawImageWithin
  349. */
  350. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  351. /** Draws an image.
  352. This will draw the whole of an image, positioning its top-left corner at the
  353. given co-ordinates, and keeping its size the same. This is the simplest image
  354. drawing method - the others give more control over the scaling and clipping
  355. of the images.
  356. Images are composited using the context's current opacity, so if you
  357. don't want it to be drawn semi-transparently, be sure to call setOpacity (1.0f)
  358. (or setColour() with an opaque colour) before drawing images.
  359. */
  360. void drawImageAt (const Image* const imageToDraw,
  361. int topLeftX, int topLeftY,
  362. bool fillAlphaChannelWithCurrentBrush = false) const throw();
  363. /** Draws part of an image, rescaling it to fit in a given target region.
  364. The specified area of the source image is rescaled and drawn to fill the
  365. specifed destination rectangle.
  366. Images are composited using the context's current opacity, so if you
  367. don't want it to be drawn semi-transparently, be sure to call setOpacity (1.0f)
  368. (or setColour() with an opaque colour) before drawing images.
  369. @param imageToDraw the image to overlay
  370. @param destX the left of the destination rectangle
  371. @param destY the top of the destination rectangle
  372. @param destWidth the width of the destination rectangle
  373. @param destHeight the height of the destination rectangle
  374. @param sourceX the left of the rectangle to copy from the source image
  375. @param sourceY the top of the rectangle to copy from the source image
  376. @param sourceWidth the width of the rectangle to copy from the source image
  377. @param sourceHeight the height of the rectangle to copy from the source image
  378. @param fillAlphaChannelWithCurrentBrush if true, then instead of drawing the source image's pixels,
  379. the source image's alpha channel is used as a mask with
  380. which to fill the destination using the current colour
  381. or brush. (If the source is has no alpha channel, then
  382. it will just fill the target with a solid rectangle)
  383. @see setImageResamplingQuality, drawImageAt, drawImageWithin, fillAlphaMap
  384. */
  385. void drawImage (const Image* const imageToDraw,
  386. int destX,
  387. int destY,
  388. int destWidth,
  389. int destHeight,
  390. int sourceX,
  391. int sourceY,
  392. int sourceWidth,
  393. int sourceHeight,
  394. bool fillAlphaChannelWithCurrentBrush = false) const throw();
  395. /** Draws part of an image, having applied an affine transform to it.
  396. This lets you throw the image around in some wacky ways, rotate it, shear,
  397. scale it, etc.
  398. A subregion is specified within the source image, and all transformations
  399. will be treated as relative to the origin of this sub-region. So, for example if
  400. your subregion is (50, 50, 100, 100), and your transform is a translation of (20, 20),
  401. the resulting pixel drawn at (20, 20) in the destination context is from (50, 50) in
  402. your image. If you want to use the whole image, then Image::getBounds() returns a
  403. suitable rectangle to use as the imageSubRegion parameter.
  404. Images are composited using the context's current opacity, so if you
  405. don't want it to be drawn semi-transparently, be sure to call setOpacity (1.0f)
  406. (or setColour() with an opaque colour) before drawing images.
  407. If fillAlphaChannelWithCurrentBrush is set to true, then the image's RGB channels
  408. are ignored and it is filled with the current brush, masked by its alpha channel.
  409. @see setImageResamplingQuality, drawImage
  410. */
  411. void drawImageTransformed (const Image* imageToDraw,
  412. const Rectangle<int>& imageSubRegion,
  413. const AffineTransform& transform,
  414. bool fillAlphaChannelWithCurrentBrush = false) const throw();
  415. /** Draws an image to fit within a designated rectangle.
  416. If the image is too big or too small for the space, it will be rescaled
  417. to fit as nicely as it can do without affecting its aspect ratio. It will
  418. then be placed within the target rectangle according to the justification flags
  419. specified.
  420. @param imageToDraw the source image to draw
  421. @param destX top-left of the target rectangle to fit it into
  422. @param destY top-left of the target rectangle to fit it into
  423. @param destWidth size of the target rectangle to fit the image into
  424. @param destHeight size of the target rectangle to fit the image into
  425. @param placementWithinTarget this specifies how the image should be positioned
  426. within the target rectangle - see the RectanglePlacement
  427. class for more details about this.
  428. @param fillAlphaChannelWithCurrentBrush if true, then instead of drawing the image, just its
  429. alpha channel will be used as a mask with which to
  430. draw with the current brush or colour. This is
  431. similar to fillAlphaMap(), and see also drawImage()
  432. @see setImageResamplingQuality, drawImage, drawImageTransformed, drawImageAt, RectanglePlacement
  433. */
  434. void drawImageWithin (const Image* imageToDraw,
  435. int destX, int destY, int destWidth, int destHeight,
  436. const RectanglePlacement& placementWithinTarget,
  437. bool fillAlphaChannelWithCurrentBrush = false) const throw();
  438. //==============================================================================
  439. /** Returns the position of the bounding box for the current clipping region.
  440. @see getClipRegion, clipRegionIntersects
  441. */
  442. const Rectangle<int> getClipBounds() const throw();
  443. /** Checks whether a rectangle overlaps the context's clipping region.
  444. If this returns false, no part of the given area can be drawn onto, so this
  445. method can be used to optimise a component's paint() method, by letting it
  446. avoid drawing complex objects that aren't within the region being repainted.
  447. */
  448. bool clipRegionIntersects (int x, int y, int width, int height) const throw();
  449. /** Intersects the current clipping region with another region.
  450. @returns true if the resulting clipping region is non-zero in size
  451. @see setOrigin, clipRegionIntersects
  452. */
  453. bool reduceClipRegion (int x, int y, int width, int height) throw();
  454. /** Intersects the current clipping region with a rectangle list region.
  455. @returns true if the resulting clipping region is non-zero in size
  456. @see setOrigin, clipRegionIntersects
  457. */
  458. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  459. /** Intersects the current clipping region with a path.
  460. @returns true if the resulting clipping region is non-zero in size
  461. @see reduceClipRegion
  462. */
  463. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  464. /** Intersects the current clipping region with an image's alpha-channel.
  465. The current clipping path is intersected with the area covered by this image's
  466. alpha-channel, after the image has been transformed by the specified matrix.
  467. @param image the image whose alpha-channel should be used. If the image doesn't
  468. have an alpha-channel, it is treated as entirely opaque.
  469. @param sourceClipRegion a subsection of the image that should be used. To use the
  470. entire image, just pass a rectangle of bounds
  471. (0, 0, image.getWidth(), image.getHeight()).
  472. @param transform a matrix to apply to the image
  473. @returns true if the resulting clipping region is non-zero in size
  474. @see reduceClipRegion
  475. */
  476. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  477. const AffineTransform& transform) throw();
  478. /** Excludes a rectangle to stop it being drawn into. */
  479. void excludeClipRegion (const Rectangle<int>& rectangleToExclude) throw();
  480. /** Returns true if no drawing can be done because the clip region is zero. */
  481. bool isClipEmpty() const throw();
  482. /** Saves the current graphics state on an internal stack.
  483. To restore the state, use restoreState().
  484. */
  485. void saveState() throw();
  486. /** Restores a graphics state that was previously saved with saveState().
  487. */
  488. void restoreState() throw();
  489. /** Moves the position of the context's origin.
  490. This changes the position that the context considers to be (0, 0) to
  491. the specified position.
  492. So if you call setOrigin (100, 100), then the position that was previously
  493. referred to as (100, 100) will subsequently be considered to be (0, 0).
  494. @see reduceClipRegion
  495. */
  496. void setOrigin (int newOriginX, int newOriginY) throw();
  497. /** Resets the current colour, brush, and font to default settings. */
  498. void resetToDefaultState() throw();
  499. /** Returns true if this context is drawing to a vector-based device, such as a printer. */
  500. bool isVectorDevice() const throw();
  501. //==============================================================================
  502. juce_UseDebuggingNewOperator
  503. /** Create a graphics that uses a given low-level renderer.
  504. For internal use only.
  505. NB. The context will NOT be deleted by this object when it is deleted.
  506. */
  507. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  508. /** @internal */
  509. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  510. private:
  511. //==============================================================================
  512. LowLevelGraphicsContext* const context;
  513. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  514. bool saveStatePending;
  515. void saveStateIfPending() throw();
  516. Graphics (const Graphics&);
  517. Graphics& operator= (const Graphics& other);
  518. };
  519. #endif // __JUCE_GRAPHICS_JUCEHEADER__