Pepper_56_C++_interfaces
Pepper_56_C++_interfaces
 All Classes Namespaces Files Functions Typedefs Enumerations Macros Groups
image_data.h
Go to the documentation of this file.
1 // Copyright (c) 2011 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_IMAGE_DATA_H_
6 #define PPAPI_CPP_IMAGE_DATA_H_
7 
8 #include <stdint.h>
9 
10 #include "ppapi/c/ppb_image_data.h"
11 #include "ppapi/cpp/point.h"
12 #include "ppapi/cpp/resource.h"
13 #include "ppapi/cpp/size.h"
14 
18 namespace pp {
19 
20 class InstanceHandle;
21 
22 class ImageData : public Resource {
23  public:
26  ImageData();
27 
32  ImageData(PassRef, PP_Resource resource);
33 
39  ImageData(const ImageData& other);
40 
62  ImageData(const InstanceHandle& instance,
63  PP_ImageDataFormat format,
64  const Size& size,
65  bool init_to_zero);
66 
75  ImageData& operator=(const ImageData& other);
76 
87  static bool IsImageDataFormatSupported(PP_ImageDataFormat format);
88 
94  static PP_ImageDataFormat GetNativeImageDataFormat();
95 
99  PP_ImageDataFormat format() const { return desc_.format; }
100 
104  pp::Size size() const { return desc_.size; }
105 
109  int32_t stride() const { return desc_.stride; }
110 
114  void* data() const { return data_; }
115 
123  const uint32_t* GetAddr32(const Point& coord) const;
124 
132  uint32_t* GetAddr32(const Point& coord);
133 
134  private:
135  void InitData();
136 
137  PP_ImageDataDesc desc_;
138  void* data_;
139 };
140 
141 } // namespace pp
142 
143 #endif // PPAPI_CPP_IMAGE_DATA_H_
void * data() const
Definition: image_data.h:114
PP_ImageDataFormat format() const
Definition: image_data.h:99
static bool IsImageDataFormatSupported(PP_ImageDataFormat format)
Definition: image_data.h:22
A 2 dimensional point with 0,0 being the upper-left starting coordinate.
Definition: point.h:18
ImageData & operator=(const ImageData &other)
A size of an object based on width and height.
Definition: size.h:18
pp::Size size() const
Definition: image_data.h:104
Definition: instance_handle.h:44
PassRef
Definition: pass_ref.h:17
int32_t stride() const
Definition: image_data.h:109
const uint32_t * GetAddr32(const Point &coord) const
A reference counted module resource.
Definition: resource.h:20
static PP_ImageDataFormat GetNativeImageDataFormat()