diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-10-03 08:58:41 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-10-03 08:58:41 -0300 |
commit | af4a97bef9bfb06e2737ad709dde157688a94daf (patch) | |
tree | d3c6471da30a8d6c20d10858e78907edd9c886e8 /core | |
parent | 1b3a10891ebdc6e76a81c8915ba08065311e17d3 (diff) |
missing fils from yesterday comit.
must have made some mistake with git,
not sure why they were not sent..
Diffstat (limited to 'core')
-rw-r--r-- | core/image.cpp | 20 | ||||
-rw-r--r-- | core/image.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/core/image.cpp b/core/image.cpp index d9ba6c1594..ae9fb0adc4 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1998,6 +1998,26 @@ void Image::set_compress_bc_func(void (*p_compress_func)(Image *)) { +void Image::normalmap_to_xy() { + + convert(Image::FORMAT_RGBA); + + { + int len = data.size()/4; + DVector<uint8_t>::Write wp = data.write(); + unsigned char *data_ptr=wp.ptr(); + + for(int i=0;i<len;i++) { + + data_ptr[(i<<2)+3]=data_ptr[(i<<2)+0]; //x to w + data_ptr[(i<<2)+0]=data_ptr[(i<<2)+1]; //y to xz + data_ptr[(i<<2)+2]=data_ptr[(i<<2)+1]; + } + } + + convert(Image::FORMAT_GRAYSCALE_ALPHA); +} + void Image::srgb_to_linear() { if (data.size()==0) diff --git a/core/image.h b/core/image.h index 31a815c587..0084a3616f 100644 --- a/core/image.h +++ b/core/image.h @@ -333,6 +333,7 @@ public: void fix_alpha_edges(); void premultiply_alpha(); void srgb_to_linear(); + void normalmap_to_xy(); void blit_rect(const Image& p_src, const Rect2& p_src_rect,const Point2& p_dest); void brush_transfer(const Image& p_src, const Image& p_brush, const Point2& p_dest); |