Home » Developing U++ » U++ Developers corner » Some new functions
Some new functions [message #29820] |
Sat, 20 November 2010 01:01 |
|
koldo
Messages: 3398 Registered: August 2008
|
Senior Veteran |
|
|
Hello
Here there are a few functions that could be added to U++:
inline bool Odd(int val) {return val%2;}
inline bool Even(int val) {return !Odd(val);}
inline int RoundEven(int val) {return Even(val) ? val : val+1;}
template<class T>
inline int Sign(T a) {return (a > 0) - (a < 0);}
inline const RGBA *GetPixel(const Image &img, int x, int y) {
return img + x + y*img.GetWidth();
}
inline RGBA *GetPixel(ImageBuffer &img, int x, int y) {
return img + x + y*img.GetWidth();
}
Best regards
IƱaki
|
|
|
|
|
Some new functions
By: koldo on Sat, 20 November 2010 01:01
|
|
|
Re: Some new functions
By: Didier on Sat, 20 November 2010 17:22
|
|
|
Re: Some new functions
|
|
|
Re: Some new functions
By: koldo on Sat, 20 November 2010 23:22
|
|
|
Re: Some new functions
By: koldo on Sun, 21 November 2010 00:05
|
|
|
Re: Some new functions
|
|
|
Re: Some new functions
By: koldo on Sun, 21 November 2010 08:26
|
|
|
Re: Some new functions
By: Novo on Thu, 25 November 2010 16:43
|
|
|
Re: Some new functions
By: mirek on Sat, 20 November 2010 18:07
|
|
|
Re: Some new functions
By: mr_ped on Mon, 22 November 2010 09:09
|
|
|
Re: Some new functions
By: mirek on Sat, 04 December 2010 20:38
|
|
|
Re: Some new functions
By: koldo on Sat, 04 December 2010 23:44
|
Goto Forum:
Current Time: Thu Oct 31 23:46:20 CET 2024
Total time taken to generate the page: 0.02671 seconds
|