38 #define NCBI_USE_ERRCODE_X Util_Image
64 _TRACE(
"CImage::Init(): " << width <<
", " << height <<
", " <<
depth);
73 string msg(
"CImage::Init(): depth = ");
75 msg +=
" not implemented";
116 if (add_if_unavailable) {
120 "CImage::SetAlpha(): attempt to set alpha in "
144 TImageStrip::const_iterator from_data =
m_Data.begin();
145 TImageStrip::iterator to_data =
m_Data.begin();
146 for ( ; from_data !=
m_Data.end(); ) {
147 *to_data++ = *from_data++;
148 *to_data++ = *from_data++;
149 *to_data++ = *from_data++;
171 TImageStrip::const_reverse_iterator from_data(
m_Data.end());
172 TImageStrip::const_reverse_iterator end_data (
m_Data.begin());
173 TImageStrip::reverse_iterator to_data (
m_Data.end());
178 for ( ; from_data != end_data; ) {
184 *to_data++ = *from_data++;
185 *to_data++ = *from_data++;
186 *to_data++ = *from_data++;
194 string msg(
"CImage::SetDepth(): invalid depth: ");
214 "CImage::SetChannel(): channel out of bounds");
217 TImageStrip::iterator
data =
m_Data.begin() + channel;
218 TImageStrip::iterator end =
236 "CImage::GetSubImage(): image is empty");
240 string msg(
"CImage::GetSubImage(): invalid starting pos: ");
258 const unsigned char* from_data =
GetData() +
260 unsigned char* to_data = image->
SetData();
263 size_t to_stride = w *
m_Depth;
265 for (
size_t i = 0;
i < h; ++
i) {
266 memcpy(to_data, from_data, w *
m_Depth);
267 to_data += to_stride;
268 from_data += from_stride;
281 unsigned char* from =
SetData();
286 for (
size_t pos = 0; pos < stride; ++pos) {
size_t GetDepth(void) const
const unsigned char * GetData(void) const
float GetAspectRatio(void) const
void SetAlpha(unsigned char val, bool add_channel=false)
CImage * GetSubImage(size_t x, size_t y, size_t w, size_t h) const
void Init(size_t width, size_t height, size_t depth)
void SetChannel(size_t channel, unsigned char val)
void SetDepth(size_t depth, bool update_image=true)
unsigned char * SetData(void)
static unsigned char depth[2 *(256+1+29)+1]
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition of all error codes used in util (xutil.lib).
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)