30 #ifndef _D_SHARED_IMAGE_HPP
31 #define _D_SHARED_IMAGE_HPP
33 #include "Core/include/private/DImage.hpp"
34 #include "Core/include/DErrors.h"
54 typedef typename Image<T>::lineType lineType;
60 this->className =
"SharedImage";
67 this->className =
"SharedImage";
73 SharedImage(lineType dataPtr,
size_t width,
size_t height,
size_t depth=1)
76 this->className =
"SharedImage";
79 this->attach(dataPtr, width, height, depth);
85 this->className =
"SharedImage";
96 SharedImage<T>& operator = (
const SharedImage<T> &rhs)
104 virtual RES_T attach(lineType dataPtr,
size_t width,
size_t height,
size_t depth=1)
108 ERR_MSG(
"Source image isn't allocated");
111 else if (dataPtr==this->pixels && width==this->width
112 && height==this->height
113 && depth==this->depth)
122 this->pixels = dataPtr;
123 this->
setSize(width, height, depth);
127 this->attached =
true;
128 this->allocated =
true;
134 virtual RES_T attach(
const Image<T> &im)
136 return attach(im.getPixels(), im.getWidth(), im.getHeight(), im.getDepth());
139 virtual RES_T attach(lineType dataPtr)
141 return attach(dataPtr, this->width, this->height, this->depth);
144 virtual RES_T detach()
150 delete[] this->slices;
152 delete[] this->lines;
162 this->attached =
false;
163 this->allocated =
false;
169 virtual RES_T clone(
const SharedImage<T> &rhs)
171 return attach(rhs.getPixels(), rhs.getWidth(), rhs.getHeight(), rhs.getDepth());
178 virtual RES_T
setSize(
size_t w,
size_t h,
size_t d = 1,
bool =
true)
184 this->sliceCount = d;
185 this->lineCount = d * h;
186 this->pixelCount = this->lineCount * w;
189 this->viewer->setImage(*
this);
198 return RES_ERR_BAD_ALLOCATION;
203 return RES_ERR_BAD_ALLOCATION;
Base Smil Object.
Definition: DBaseObject.h:52
Main Image class.
Definition: DImage.hpp:57
virtual void clone(const Image< T > &rhs)
Clone from a given image (set same size and copy content)
virtual void modified()
Trigger modified event (allows to force display update)
Image()
Default constructor.
Image that uses an existing (1D) data pointer.
Definition: DSharedImage.hpp:51
virtual RES_T setSize(size_t w, size_t h, size_t d=1, bool=true)
Set the size of image.
Definition: DSharedImage.hpp:178
SharedImage()
Default constructor.
Definition: DSharedImage.hpp:57
virtual RES_T allocate()
Allocate image.
Definition: DSharedImage.hpp:196
virtual RES_T deallocate()
Deallocate image.
Definition: DSharedImage.hpp:201