diff options
author | Ton Roosendaal <ton@blender.org> | 2006-01-12 18:46:29 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-01-12 18:46:29 +0300 |
commit | 715794859a99c47a08314acbfe537c4460cb788b (patch) | |
tree | 39730d4c6b2d4a0017c477e3a80570ae1c2ba393 /source/blender/imbuf/intern/divers.c | |
parent | 402518c66c251a0b4e83bca474319cacd2ae662a (diff) |
Orange:
- cleanup of color curves code; goes at least twice faster now!
(includes black/white point stuff)
- When using 'Curves' in image window on a byte rect, it creates a (temp)
float rect to operate on. So curves work for regular pictures too now.
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index f73431cb28e..71292e27611 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -192,3 +192,27 @@ void IMB_rect_from_float(struct ImBuf *ibuf) } } +void IMB_float_from_rect(struct ImBuf *ibuf) +{ + /* quick method to convert byte to floatbuf */ + float *tof = ibuf->rect_float; + int i; + unsigned char *to = (unsigned char *) ibuf->rect; + + if(to==NULL) return; + if(tof==NULL) { + imb_addrectfloatImBuf(ibuf); + tof = ibuf->rect_float; + } + + for (i = ibuf->x * ibuf->y; i > 0; i--) + { + tof[0] = ((float)to[0])*(1.0f/255.0f); + tof[1] = ((float)to[1])*(1.0f/255.0f); + tof[2] = ((float)to[2])*(1.0f/255.0f); + tof[3] = ((float)to[3])*(1.0f/255.0f); + to += 4; + tof += 4; + } +} + |