Gazebo Rendering

API Reference

8.3.0
PixelBuffer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2026 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_PIXELBUFFER_HH_
18 #define GZ_RENDERING_PIXELBUFFER_HH_
19 
20 #include <cstddef>
21 
22 #include <gz/utils/ImplPtr.hh>
23 
24 #include "gz/rendering/config.hh"
25 #include "gz/rendering/Export.hh"
27 
28 namespace gz
29 {
30  namespace rendering
31  {
32  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
33  //
34  class Image;
35 
50  class GZ_RENDERING_VISIBLE PixelBuffer
51  {
58  public: PixelBuffer(unsigned int _width, unsigned int _height,
59  PixelFormat _format, void *_data, std::size_t _size);
60 
64  public: explicit PixelBuffer(Image &_image);
65 
68  public: PixelBuffer(const PixelBuffer &_other);
69 
71  public: PixelBuffer &operator=(const PixelBuffer &) = delete;
72 
74  public: PixelBuffer &operator=(PixelBuffer &&) = delete;
75 
77  public: ~PixelBuffer();
78 
81  public: unsigned int Width() const;
82 
85  public: unsigned int Height() const;
86 
89  public: PixelFormat Format() const;
90 
93  public: std::size_t Size() const;
94 
97  public: std::size_t MemorySize() const;
98 
102  public: bool Valid() const;
103 
108  public: unsigned char *Data() const;
109 
112  GZ_UTILS_IMPL_PTR(dataPtr)
113  };
114  }
115  }
116 }
117 #endif