29 #ifndef PT_GFX_IMAGE_H
30 #define PT_GFX_IMAGE_H
32 #include <Pt/Gfx/Api.h>
33 #include <Pt/Gfx/ImageFormat.h>
34 #include <Pt/Gfx/View.h>
35 #include <Pt/Gfx/PixelView.h>
36 #include <Pt/Gfx/LineView.h>
37 #include <Pt/Gfx/ImageTraits.h>
50 template <
typename FormatT,
typename TraitsT>
54 typedef FormatT Format;
55 typedef TraitsT Traits;
64 BasicImage(Pt::ssize_t width, Pt::ssize_t height, Pt::ssize_t padding,
65 const Format& format = FormatT::get() );
70 const Format& format = FormatT::get() );
75 Pt::ssize_t padding,
const Format& format = FormatT::get() );
80 const Format& format = FormatT::get() );
98 const Format& format()
const
101 Pt::ssize_t padding()
const
102 {
return stride() - width() * pixelStride(); }
106 void reset(Pt::ssize_t width, Pt::ssize_t height,
107 Pt::ssize_t padding,
const Format& format);
109 void reset(Pt::ssize_t width, Pt::ssize_t height,
114 void reset(Pt::ssize_t width, Pt::ssize_t height,
115 Pt::ssize_t padding);
117 void reset(Pt::ssize_t width, Pt::ssize_t height);
122 Pt::ssize_t padding,
const Format& format);
130 Pt::ssize_t padding);
138 Pt::ssize_t pixelStride()
const;
140 std::size_t size()
const;
143 std::unique_ptr<FormatT> _format;
144 std::vector<Pt::uint8_t> _buffer;
150 template <
typename FormatT,
typename TraitsT>
154 typedef FormatT Format;
155 typedef TraitsT Traits;
161 Pt::ssize_t padding,
const Format& format = FormatT::get() );
164 const Format& format = FormatT::get() );
175 const Format& format()
const
178 Pt::ssize_t padding()
const
179 {
return stride() - width() * pixelStride(); }
188 Pt::ssize_t padding,
const Format& format);
190 void reset(
const Pt::uint8_t* data, Pt::ssize_t width, Pt::ssize_t height,
191 const Format& format);
196 Pt::ssize_t padding);
198 void reset(
const Pt::uint8_t* data, Pt::ssize_t width, Pt::ssize_t height);
202 Pt::ssize_t pixelStride()
const;
204 std::size_t size()
const;
207 std::unique_ptr<FormatT> _format;
217 #include <Pt/Gfx/Image.hpp>