CVB++ 15.0
detail_plane.hpp
1#pragma once
2
3#include "../_decl/decl_plane.hpp"
4#include "../_decl/decl_image_plane.hpp"
5#include "../_decl/decl_image.hpp"
6
7namespace Cvb
8{
9
10 CVB_BEGIN_INLINE_NS
11
12 inline Plane::Plane(const ImagePlane &imagePlane, PlaneRole role)
13 : handle_(0)
14 , shared_(0)
15 {
16 auto &image = imagePlane.Parent();
17 std::array<CExports::cvbint64_t, 2> lengths = {image.Width(), image.Height()};
18 auto linearAccess = imagePlane.LinearAccess();
19 std::array<intptr_t, 2> increments = {linearAccess.XInc(), linearAccess.YInc()};
20 CExports::CVPLANE plane = nullptr;
21 CVB_CALL_CAPI_CHECKED(CVCCreatePlaneFromPointer(
22 imagePlane.DataType().NativeDescriptor(), static_cast<CExports::CVCPlaneRole>(role), linearAccess.BasePtr(), 2,
23 lengths.data(), increments.data(), [](void *, void *) {}, nullptr, plane));
24 handle_ = std::move(HandleGuard<Plane>(plane));
25 CVB_CALL_CAPI_CHECKED(ShareObject(imagePlane.Handle()));
26 shared_ = std::move(ReleaseObjectGuard(imagePlane.Handle()));
27 }
28
29 CVB_END_INLINE_NS
30
31} // namespace Cvb
int NativeDescriptor() const noexcept
Native data type descriptor.
Definition data_type.hpp:312
Image plane information container.
Definition decl_image_plane.hpp:29
class DataType DataType() const noexcept override
Data type descriptor for this array.
Definition detail_image_plane.hpp:337
LinearAccessData LinearAccess() const
Attempt a linear access on the plane's pixels.
Definition detail_image_plane.hpp:79
void * Handle() const noexcept override
Classic API image handle.
Definition detail_image_plane.hpp:35
const Image & Parent() const noexcept
Image to which this plane descriptor refers to.
Definition detail_image_plane.hpp:87
cvbbool_t ShareObject(OBJ Object)
T move(T... args)
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
PlaneRole
A plane role describes the components of the plane. They can coarsely be separated in two sets.
Definition global.hpp:411