|
| 1 | +// |
| 2 | +// RgbaScaler.h |
| 3 | +// JxclCoder [https://github.com/awxkee/jxl-coder-swift] |
| 4 | +// |
| 5 | +// Created by Radzivon Bartoshyk on 27/09/2023. |
| 6 | +// |
| 7 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | +// of this software and associated documentation files (the "Software"), to deal |
| 9 | +// in the Software without restriction, including without limitation the rights |
| 10 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | +// copies of the Software, and to permit persons to whom the Software is |
| 12 | +// furnished to do so, subject to the following conditions: |
| 13 | +// |
| 14 | +// The above copyright notice and this permission notice shall be included in |
| 15 | +// all copies or substantial portions of the Software. |
| 16 | +// |
| 17 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 23 | +// THE SOFTWARE. |
| 24 | +// |
| 25 | + |
| 26 | +#ifndef RgbaScaler_h |
| 27 | +#define RgbaScaler_h |
| 28 | + |
| 29 | +#ifdef __cplusplus |
| 30 | + |
| 31 | +#import <vector> |
| 32 | + |
| 33 | +typedef NS_ENUM(NSInteger, JxlIPixelFormat) { |
| 34 | + kU8 NS_SWIFT_NAME(Uniform8), |
| 35 | + kF16 NS_SWIFT_NAME(Float16) |
| 36 | +}; |
| 37 | + |
| 38 | +@interface RgbaScaler : NSObject |
| 39 | +/** |
| 40 | + * Converts unsigned uint8_t RGBA to RGB in uint8_t. |
| 41 | + * @author Radzivon Bartoshyk |
| 42 | + * |
| 43 | + * @param srcVector Source buffer |
| 44 | + * @param width width of of the image |
| 45 | + * @param height width of of the image |
| 46 | + * @param pixelFormat Pixel Format of the image |
| 47 | + * @return destination |
| 48 | + */ |
| 49 | ++(bool) scaleData:(std::vector<uint8_t>&)src width:(int)width height:(int)height newWidth:(int)newWidth newHeight:(int)newHeight components:(int)components pixelFormat:(JxlIPixelFormat)pixelFormat; |
| 50 | +@end |
| 51 | + |
| 52 | +#endif |
| 53 | + |
| 54 | +#endif /* Header_h */ |
0 commit comments