XenevaOS
Loading...
Searching...
No Matches
Macros | Functions
thumbnail.cpp File Reference
#include <stdint.h>
#include <color.h>
#include <sys/_kefile.h>
#include <sys/mman.h>
#include <nanojpg.h>
#include <stdlib.h>
#include "glimpse.h"
Include dependency graph for thumbnail.cpp:

Macros

#define THUMB_MAX   128
 
#define GLIMPX_PAD_X   5
 
#define GLIMPX_PAD_Y   5
 

Functions

void _Glimpse_box_repaint (GlimpBox *box, ChWindow *win)
 _Glimpse_box_repaint – repaint glimpse area
 
GlimpBox_Glimpse_create_glimbox (int xloc, int yloc, int width, int height)
 
void _Glimpse_add_thumbnail (GlimpBox *box, thumbnail_t *thumb)
 _Glimpse_add_thumbnail – adds thumbnail box to glimpbox list
 
thumbnail_t_Glimpse_create_thumbnail (int xloc, int yloc, int width, int height)
 
void compute_thumb_size (int src_w, int src_h, int max_w, int max_h, int *out_w, int *out_h)
 compute_thumb_size – computes the best possible thumbnail size out of given image width and height
 
uint32_t _RGB (uint8_t red, uint8_t green, uint8_t blue)
 
void thumbnail_box (ChCanvas *canvas, uint8_t *src, int src_w, int src_h, uint8_t *dst, int dst_x, int dst_y, int dst_w, int dst_h)
 thumbnail_box – calculate and prepare the thumbnail using box_filter algorithm
 
void _Glimpse_draw_thumb (ChCanvas *canv, char *path, int dst_x, int dst_y, int max_w, int max_h)
 _Glimpse_draw_thumb – load and draw thumbnail to canvas
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2026, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ GLIMPX_PAD_X

#define GLIMPX_PAD_X   5

◆ GLIMPX_PAD_Y

#define GLIMPX_PAD_Y   5

◆ THUMB_MAX

#define THUMB_MAX   128

Function Documentation

◆ _Glimpse_add_thumbnail()

void _Glimpse_add_thumbnail ( GlimpBox box,
thumbnail_t thumb 
)

_Glimpse_add_thumbnail – adds thumbnail box to glimpbox list

Parameters
box– Pointer to glimpse box
thumb– pointer to thumnail data

◆ _Glimpse_box_repaint()

void _Glimpse_box_repaint ( GlimpBox box,
ChWindow win 
)

_Glimpse_box_repaint – repaint glimpse area

Parameters
box– Pointer to glimps box
win– Pointer to main window

◆ _Glimpse_create_glimbox()

GlimpBox * _Glimpse_create_glimbox ( int  xloc,
int  yloc,
int  width,
int  height 
)

_Glimpse_create_glimbox – creates a glimbox bounding area

Parameters
xloc– x location within glimpse
yloc– y location within glimpse
width– width of the box area
height– height of the box area

◆ _Glimpse_create_thumbnail()

thumbnail_t * _Glimpse_create_thumbnail ( int  xloc,
int  yloc,
int  width,
int  height 
)

_Glimpse_create_thumbnail – create a thumbox

Parameters
xloc– x location within glimpse thumb area
yloc– y location within glimpse thumb area
width– width of the thumb box
height– height of thumb box

◆ _Glimpse_draw_thumb()

void _Glimpse_draw_thumb ( ChCanvas canv,
char *  path,
int  dst_x,
int  dst_y,
int  max_w,
int  max_h 
)

_Glimpse_draw_thumb – load and draw thumbnail to canvas

Parameters
canv– Pointer to canvas
path– path of the file
dst_x– x coord
dst_y– y coord
max_w– maximum width
max_h– maximum height

◆ _RGB()

uint32_t _RGB ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

*red = max(red, 0);

◆ compute_thumb_size()

void compute_thumb_size ( int  src_w,
int  src_h,
int  max_w,
int  max_h,
int *  out_w,
int *  out_h 
)

compute_thumb_size – computes the best possible thumbnail size out of given image width and height

Parameters
src_w– source image width
src_h– source image height
max_w– desired maximum width
max_h– desired maximum height
out_w– best possible width
out_h– best possible height

◆ thumbnail_box()

void thumbnail_box ( ChCanvas canvas,
uint8_t src,
int  src_w,
int  src_h,
uint8_t dst,
int  dst_x,
int  dst_y,
int  dst_w,
int  dst_h 
)

thumbnail_box – calculate and prepare the thumbnail using box_filter algorithm

Parameters
canvas– pointer to canvas
src– source image buffer
src_w– source image width
src_h– source image height
dst– destination image buffer
dst_w– destination image width
dst_h– destination image height