...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::image2d — An OpenCL 2D image object.
// In header: <boost/compute/image/image2d.hpp> class image2d : public boost::compute::image_object { public: // public member functions image2d(); image2d(const context &, size_t, size_t, const image_format &, cl_mem_flags = read_write, void * = 0, size_t = 0); image2d(const image2d &); image2d & operator=(const image2d &); image2d(image2d &&) noexcept; image2d & operator=(image2d &&) noexcept; ~image2d(); extents< 2 > size() const; extents< 2 > origin() const; template<typename T> T get_info(cl_image_info) const; template<int Enum> unspecified get_info() const; image2d clone(command_queue &) const; // public static functions static std::vector< image_format > get_supported_formats(const context &, cl_mem_flags = read_write); static bool is_supported_format(const image_format &, const context &, cl_mem_flags = read_write); };
For example, to create a 640x480 8-bit RGBA image:
See Also: image_format, image3d
image2d
public member functionsimage2d();Creates a null image2d object.
image2d(const context & context, size_t image_width, size_t image_height, const image_format & format, cl_mem_flags flags = read_write, void * host_ptr = 0, size_t image_row_pitch = 0);
Creates a new image2d object.
See the documentation for
image2d(const image2d & other);Creates a new image2d as a copy of
other
. image2d & operator=(const image2d & other);Copies the image2d from
other
. image2d(image2d && other) noexcept;Move-constructs a new image object from
other
. image2d & operator=(image2d && other) noexcept;Move-assigns the image from
other
to *this
. ~image2d();Destroys the image2d object.
extents< 2 > size() const;Returns the size (width, height) of the image.
extents< 2 > origin() const;Returns the origin of the image (
0
, 0
). template<typename T> T get_info(cl_image_info info) const;
Returns information about the image.
See the documentation for
template<int Enum> unspecified get_info() const;This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
image2d clone(command_queue & queue) const;
Creates a new image with a copy of the data in *this
. Uses queue
to perform the copy operation.
image2d
public static functionsstatic std::vector< image_format > get_supported_formats(const context & context, cl_mem_flags flags = read_write);
Returns the supported image formats for the context.
See the documentation for
static bool is_supported_format(const image_format & format, const context & context, cl_mem_flags flags = read_write);
Returns true
if format
is a supported 2D image format for context
.