summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/imageviewer/imageviewer.h21
-rw-r--r--apps/plugins/imageviewer/readme.txt37
2 files changed, 50 insertions, 8 deletions
diff --git a/apps/plugins/imageviewer/imageviewer.h b/apps/plugins/imageviewer/imageviewer.h
index 504ef2bb3a..f35c1c7e6d 100644
--- a/apps/plugins/imageviewer/imageviewer.h
+++ b/apps/plugins/imageviewer/imageviewer.h
@@ -469,19 +469,24 @@ struct imgdec_api {
469 469
470/* functions need to be implemented in each image decoders. */ 470/* functions need to be implemented in each image decoders. */
471struct image_decoder { 471struct image_decoder {
472 /* if unscaled image can be always displayed when there isn't enough memory 472 /* set true if unscaled image can be always displayed even when there isn't
473 * for resized image. e.g. when using native format to store image. */ 473 * enough memory for resized image. e.g. when using native format to store
474 * image. */
474 const bool unscaled_avail; 475 const bool unscaled_avail;
475 476
476 /* return needed size of buffer to store downscaled image by ds */ 477 /* return needed size of buffer to store downscaled image by ds.
478 * this is used to calculate min downscale. */
477 int (*img_mem)(int ds); 479 int (*img_mem)(int ds);
478 /* load image from filename. set width and height of info properly. also, set 480 /* load image from filename. use the passed buffer to store loaded, decoded
479 * buf_size to remaining size of buf after load image. it is used to caluclate 481 * or resized image later, so save it to local variables if needed.
480 * min downscale. */ 482 * set width and height of info properly. also, set buf_size to remaining
483 * size of buf after load image. it is used to calculate min downscale.
484 * return PLUGIN_ERROR for error. ui will skip to next image. */
481 int (*load_image)(char *filename, struct image_info *info, 485 int (*load_image)(char *filename, struct image_info *info,
482 unsigned char *buf, ssize_t *buf_size); 486 unsigned char *buf, ssize_t *buf_size);
483 /* downscale loaded image by ds. note that buf to store reszied image is not 487 /* downscale loaded image by ds. use the buffer passed to load_image to
484 * provided. return PLUGIN_ERROR for error. ui will skip to next image. */ 488 * reszie image and/or store resized image.
489 * return PLUGIN_ERROR for error. ui will skip to next image. */
485 int (*get_image)(struct image_info *info, int ds); 490 int (*get_image)(struct image_info *info, int ds);
486 /* draw part of image */ 491 /* draw part of image */
487 void (*draw_image_rect)(struct image_info *info, 492 void (*draw_image_rect)(struct image_info *info,
diff --git a/apps/plugins/imageviewer/readme.txt b/apps/plugins/imageviewer/readme.txt
new file mode 100644
index 0000000000..b7ec71e7be
--- /dev/null
+++ b/apps/plugins/imageviewer/readme.txt
@@ -0,0 +1,37 @@
1this document describes how to add new image decoder.
2
31. create a directory which name is your image decoder's name and put source files
4 under the directory.
5'const struct image_decoder image_decoder' and 'IMGDEC_HEADER' must be declared in
6 one of your source files.
7see imageviewer.h for the detail of struct image_decoder.
8
92. add the directory name to apps/plugins/imageviewer/SUBDIR so that the decoder
10 is built.
11if the decoder is supported by particular targets, surround it with #if directive.
12e.g. if the decoder supports color LCD targets only,
13#ifdef HAVE_LCD_COLOR
14bmp
15#endif
16
173. append appropriate entry to enum image_type in image_decoder.h, decoder_names
18 and ext_list in image_decoder.c so that the imageviewer plugin can recognize
19 the decoder.
20if the decoder is supported by particular targets, surround them with same #if
21 directive in SUBDIR.
22
234. add entry to apps/plugins/viewers.config
24 (in format: file_extension,viewer/imageviewer) so that the file with specified
25 file extension will be opened by image viewer plugin.
26if the decoder is supported by particular targets, surround it with same #if
27 directive in SUBDIR.
28
295. add entry to apps/plugins/CATEGORIES (in format: decoder_name,viewer) so
30 that the build file is copied to viewers directory.
31DON'T surround this with #if directive.
32
33
34notes:
35if you need to use greylib functions to draw image, add the functions to
36 struct imgdec_api just like gray_bitmap_part because GREY_INFO_STRUCT is
37 declared in imageviewer and is not available from the decoder.