3 * Raster graphics library
5 * Copyright (c) 2014 Window Maker Team
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
31 RImage
*RVerticalFlipImage(RImage
*image
)
36 int bpp
= image
->format
== RRGBAFormat
? 4 : 3;
38 nwidth
= image
->width
;
39 nheight
= image
->height
;
41 img
= RCreateImage(nwidth
, nheight
, True
);
46 unsigned char *optr
, *nptr
;
49 nptr
= img
->data
+ 4 * (nwidth
* nheight
- nwidth
- 1);
51 for (y
= 0; y
< nheight
; y
++) {
52 for (x
= 0; x
< nwidth
; x
++) {
64 unsigned char *optr
, *nptr
;
67 nptr
= img
->data
+ 4 * (nwidth
* nheight
- nwidth
- 1);
69 for (y
= 0; y
< nheight
; y
++) {
70 for (x
= 0; x
< nwidth
; x
++) {
85 RImage
*RHorizontalFlipImage(RImage
*image
)
90 int bpp
= image
->format
== RRGBAFormat
? 4 : 3;
92 nwidth
= image
->width
;
93 nheight
= image
->height
;
95 img
= RCreateImage(nwidth
, nheight
, True
);
100 unsigned char *optr
, *nptr
;
102 nptr
= img
->data
+ nwidth
* nheight
* 4 - 4;
103 for (y
= nheight
; y
; y
--) {
104 for (x
= 0; x
< nwidth
; x
++) {
105 optr
= image
->data
+ (y
*nwidth
+ x
) * 3;
116 unsigned char *optr
, *nptr
;
118 nptr
= img
->data
+ nwidth
* nheight
* 4 - 4;
119 for (y
= nheight
; y
; y
--) {
120 for (x
= 0; x
< nwidth
; x
++) {
121 optr
= image
->data
+ (y
*nwidth
+ x
) * 4;