Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-10-11 03:34:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-10-11 03:34:40 +0400
commit4a43099c5a61f302654b7f309572505894357227 (patch)
tree7863c7e2fd9a52d456ccb0b92f816d6f2e769729 /source/blender/imbuf/intern/rotate.c
parent5f6d775e0c9247d2f5979670037ca5468ee67b40 (diff)
Peach request
new option for the image sequencer's image strips, flip x/y, (useful when making animatics to test the direction characters walk across the screen) added IMB_flipy was alredy there, needed to add IMB_flipx.
Diffstat (limited to 'source/blender/imbuf/intern/rotate.c')
-rw-r--r--source/blender/imbuf/intern/rotate.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c
index 13edfbf0a33..4654dd6aefa 100644
--- a/source/blender/imbuf/intern/rotate.c
+++ b/source/blender/imbuf/intern/rotate.c
@@ -86,3 +86,29 @@ void IMB_flipy(struct ImBuf * ibuf)
MEM_freeN(line);
if(linef) MEM_freeN(linef);
}
+
+void IMB_flipx(struct ImBuf * ibuf)
+{
+ short x, y, xr, xl, yi;
+ unsigned int px;
+ float px_f[4];
+
+ if (ibuf == NULL) return;
+ if (ibuf->rect == NULL) return;
+
+ x = ibuf->x;
+ y = ibuf->y;
+ for(yi=y-1;yi>=0;yi--) {
+ for(xr=x-1, xl=0; xr>=xl; xr--, xl++) {
+ px = ibuf->rect[(x*yi)+xr];
+ ibuf->rect[(x*yi)+xr] = ibuf->rect[(x*yi)+xl];
+ ibuf->rect[(x*yi)+xl] = px;
+
+ if (ibuf->rect_float) {
+ memcpy(&px_f, &ibuf->rect_float[((x*yi)+xr)*4], 4*sizeof(float));
+ memcpy(&ibuf->rect_float[((x*yi)+xr)*4], &ibuf->rect_float[((x*yi)+xl)*4], 4*sizeof(float));
+ memcpy(&ibuf->rect_float[((x*yi)+xl)*4], &px_f, 4*sizeof(float));
+ }
+ }
+ }
+}