Pepper_56_C++_interfaces
Pepper_56_C++_interfaces
 All Classes Namespaces Files Functions Typedefs Enumerations Macros Groups
graphics_2d.h
Go to the documentation of this file.
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PPAPI_CPP_GRAPHICS_2D_H_
6 #define PPAPI_CPP_GRAPHICS_2D_H_
7 
8 #include "ppapi/c/pp_stdint.h"
9 #include "ppapi/cpp/resource.h"
10 #include "ppapi/cpp/size.h"
11 
12 
15 namespace pp {
16 
17 class CompletionCallback;
18 class ImageData;
19 class InstanceHandle;
20 class Point;
21 class Rect;
22 
23 class Graphics2D : public Resource {
24  public:
27  Graphics2D();
28 
34  Graphics2D(const Graphics2D& other);
35 
55  Graphics2D(const InstanceHandle& instance,
56  const Size& size,
57  bool is_always_opaque);
58 
63  virtual ~Graphics2D();
64 
73  Graphics2D& operator=(const Graphics2D& other);
74 
78  const Size& size() const { return size_; }
79 
105  void PaintImageData(const ImageData& image,
106  const Point& top_left);
107 
144  void PaintImageData(const ImageData& image,
145  const Point& top_left,
146  const Rect& src_rect);
147 
163  void Scroll(const Rect& clip, const Point& amount);
164 
194  void ReplaceContents(ImageData* image);
195 
255 
256  // TODO(darin): We should ensure that the completion callback always runs, so
257  // that it is easier for consumers to manage memory referenced by a callback.
258 
259  // TODO(): Add back in the synchronous mode description once we have support
260  // for it.
261  int32_t Flush(const CompletionCallback& cc);
262 
277  bool SetScale(float scale);
278 
285  float GetScale();
286 
287  bool SetLayerTransform(float scale,
288  const Point& origin,
289  const Point& translate);
290  private:
291  Size size_;
292 };
293 
294 } // namespace pp
295 
296 #endif // PPAPI_CPP_GRAPHICS_2D_H_
const Size & size() const
Definition: graphics_2d.h:78
Definition: image_data.h:22
A 2 dimensional point with 0,0 being the upper-left starting coordinate.
Definition: point.h:18
Definition: rect.h:21
Graphics2D & operator=(const Graphics2D &other)
Definition: graphics_2d.h:23
Definition: completion_callback.h:26
A size of an object based on width and height.
Definition: size.h:18
void ReplaceContents(ImageData *image)
virtual ~Graphics2D()
Definition: instance_handle.h:44
bool SetScale(float scale)
void PaintImageData(const ImageData &image, const Point &top_left)
int32_t Flush(const CompletionCallback &cc)
A reference counted module resource.
Definition: resource.h:20
void Scroll(const Rect &clip, const Point &amount)
float GetScale()