libnx v4.9.0
Loading...
Searching...
No Matches
capsdc.h
Go to the documentation of this file.
1/**
2 * @file capsdc.h
3 * @brief Jpeg Decoder (caps:dc) service IPC wrapper. Only available on [4.0.0+].
4 * @note Only holds one session that is occupied by capsrv.
5 * @author Behemoth
6 * @copyright libnx Authors
7 */
8#pragma once
9#include "../types.h"
10#include "../sf/service.h"
11#include "../services/caps.h"
12
13/// Initialize caps:dc
15
16/// Exit caps:dc.
17void capsdcExit(void);
18
19/// Gets the Service for caps:dc.
21
22/**
23 * @brief Decodes a jpeg buffer into RGBX.
24 * @param[in] width Image width.
25 * @param[in] height Image height.
26 * @param[in] opts \ref CapsScreenShotDecodeOption.
27 * @param[in] jpeg Jpeg image input buffer.
28 * @param[in] jpeg_size Input image buffer size.
29 * @param[out] out_image RGBA8 image output buffer.
30 * @param[in] out_image_size Output image buffer size, should be at least large enough for RGBA8 width x height.
31 */
32Result capsdcDecodeJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_image, size_t out_image_size);
33
34/**
35 * @brief Shrinks a jpeg's dimensions by 2.
36 * @note Tries to compress with jpeg quality in this order: 98, 95, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0.
37 * @note Only available on [17.0.0+].
38 * @param[in] width Input image width.
39 * @param[in] height Input image width.
40 * @param[in] opts \ref CapsScreenShotDecodeOption.
41 * @param[in] jpeg Jpeg image input buffer.
42 * @param[in] jpeg_size Input image buffer size.
43 * @param[out] out_jpeg Jpeg image output buffer
44 * @param[in] out_jpeg_size Output image buffer size.
45 * @param[out] out_result_size size of the resulting JPEG.
46 */
47Result capsdcShrinkJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_jpeg, size_t out_jpeg_size, u64 *out_result_size);
48
49/**
50 * @brief Shrinks a jpeg.
51 * @note Fails if the scaled size is larger than the original or the output buffer isn't large enough.
52 * @note Only available on [19.0.0+].
53 * @param[in] scaled_width Wanted image width.
54 * @param[in] scaled_height Wanted image width.
55 * @param[in] jpeg_quality has to be in range 0-100.
56 * @param[in] opts \ref CapsScreenShotDecodeOption.
57 * @param[in] jpeg Jpeg image input buffer.
58 * @param[in] jpeg_size Input image buffer size.
59 * @param[out] out_jpeg Jpeg image output buffer
60 * @param[in] out_jpeg_size Output image buffer size.
61 * @param[out] out_result_size size of the resulting jpeg.
62 */
63Result capsdcShrinkJpegEx(u32 scaled_width, u32 scaled_height, u32 jpeg_quality, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_jpeg, size_t out_jpeg_size, u64 *out_result_size);
Result capsdcInitialize(void)
Initialize caps:dc.
Service * capsdcGetServiceSession(void)
Gets the Service for caps:dc.
Result capsdcDecodeJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void *jpeg, size_t jpeg_size, void *out_image, size_t out_image_size)
Decodes a jpeg buffer into RGBX.
Result capsdcShrinkJpegEx(u32 scaled_width, u32 scaled_height, u32 jpeg_quality, const CapsScreenShotDecodeOption *opts, const void *jpeg, size_t jpeg_size, void *out_jpeg, size_t out_jpeg_size, u64 *out_result_size)
Shrinks a jpeg.
void capsdcExit(void)
Exit caps:dc.
Result capsdcShrinkJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void *jpeg, size_t jpeg_size, void *out_jpeg, size_t out_jpeg_size, u64 *out_result_size)
Shrinks a jpeg's dimensions by 2.
ScreenShotDecodeOption.
Definition caps.h:74
Service object structure.
Definition service.h:14
uint64_t u64
64-bit unsigned integer.
Definition types.h:22
u32 Result
Function error code result type.
Definition types.h:44
uint32_t u32
32-bit unsigned integer.
Definition types.h:21