Gazebo Rendering

API Reference

9.5.0
Image.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17#ifndef GZ_RENDERING_IMAGE_HH_
18#define GZ_RENDERING_IMAGE_HH_
19
20#include <memory>
21
22#include <gz/utils/ImplPtr.hh>
23
24#include "gz/rendering/config.hh"
26#include "gz/rendering/Export.hh"
27
28namespace gz
29{
30 namespace rendering
31 {
32 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
33 //
36 class GZ_RENDERING_VISIBLE Image
37 {
39 public: Image();
40
45 public: Image(unsigned int _width, unsigned int _height,
46 PixelFormat _format);
47
58 public: Image(unsigned int _width, unsigned int _height,
59 PixelFormat _format, void *_data);
60
62 public: virtual ~Image();
63
66 public: unsigned int Width() const;
67
70 public: unsigned int Height() const;
71
74 public: PixelFormat Format() const;
75
78 public: unsigned int Depth() const;
79
82 public: unsigned int MemorySize() const;
83
86 public: const void *Data() const;
87
90 public: void *Data();
91
95 public: template <typename T>
96 const T *Data() const;
97
101 public: template <typename T>
102 T *Data();
103
104 GZ_UTILS_IMPL_PTR(dataPtr)
105 };
106
108 template <typename T>
109 const T *Image::Data() const
110 {
111 return static_cast<const T *>(this->Data());
112 }
113
115 template <typename T>
117 {
118 return static_cast<T *>(this->Data());
119 }
120 }
121 }
122}
123#endif