Newbie questions. Which Compiler to start with? Real Time behaviour? Has anyone converted CImg yet?
John Carter
john.carter at taitradio.com
Sun Sep 1 18:55:48 PDT 2013
Thanks for your reply!
On Monday, 2 September 2013 at 00:32:52 UTC, bearophile wrote:
> I didn't know it uses significant macros. Could you show some
> of such code pieces?
Here is the documentation...
http://cimg.sourceforge.net/reference/group__cimg__loops.html
// Macros to perform various image loops.
//
// These macros are simpler to use than loops with C++ iterators.
#define cimg_for(img,ptrs,T_ptrs) for (T_ptrs *ptrs =
(img)._data, *_max##ptrs = (img)._data + (img).size();
ptrs<_max##ptrs; ++ptrs)
Probably more interesting are the neighbourhood ops like...
#define cimg_for2(bound,i) \
for (int i = 0, _n1##i = 1>=(bound)?(int)(bound)-1:1; \
_n1##i<(int)(bound) || i==--_n1##i; \
++i, ++_n1##i)
#define cimg_for2x2(img,x,y,z,c,I,T) \
cimg_for2((img)._height,y) for (int x = 0, \
_n1##x = (int)( \
(I[0] = (T)(img)(0,y,z,c)), \
(I[2] = (T)(img)(0,_n1##y,z,c)), \
1>=(img)._width?(img).width()-1:1); \
(_n1##x<(img).width() && ( \
(I[1] = (T)(img)(_n1##x,y,z,c)), \
(I[3] = (T)(img)(_n1##x,_n1##y,z,c)),1)) || \
x==--_n1##x; \
I[0] = I[1], \
I[2] = I[3], \
++x, ++_n1##x)
> I don't know but perhaps the conversion CImg to D could take a
> year or two of work for a person that knows D :-)
I guess one of the interesting questions it would answer is "How
easy is it to convert both C++ programs and C++ programmers to D?"
More information about the Digitalmars-d-learn
mailing list