Byakuren 1.0.1
A theme color extracting library implemented by C.
Loading...
Searching...
No Matches
mix.h File Reference
#include "../bkr_common.h"

Go to the source code of this file.

Functions

int bkr_mix_calculate_color_stats (bkr_rgb *pixels, uint32_t pixel_count, uint32_t octree_max_colors, bkr_mindiff_parameter *mindiff_param, bkr_color_stats stats[])
 Byakuren - A theme color extracting library implemented by C.
 

Function Documentation

◆ bkr_mix_calculate_color_stats()

int bkr_mix_calculate_color_stats ( bkr_rgb * pixels,
uint32_t pixel_count,
uint32_t octree_max_colors,
bkr_mindiff_parameter * mindiff_param,
bkr_color_stats stats[] )
extern

Byakuren - A theme color extracting library implemented by C.

Copyright (c) 2024 XadillaX i@233.nosp@m.3.mo.nosp@m.e

MIT License https://github.com/XadillaX/byakuren/blob/master/LICENSE

Calculate color statistics using a mixed approach of octree quantization and minimum difference method.

This function combines the efficiency of octree color quantization with the accuracy of the minimum difference method to produce high-quality color statistics. The process involves several steps:

  1. Octree quantization is applied to the input pixels to reduce the number of colors to a manageable set.
  2. The reduced color set is then mapped to a predefined palette using the minimum difference method.
  3. The results are compiled into color statistics, sorted, and returned.

This mixed approach allows for faster processing of large images while still maintaining color accuracy and adhering to a specific color palette.

Parameters
pixelsPointer to an array of bkr_rgb structures representing the pixels to process.
pixel_countThe number of pixels in the pixels array.
octree_max_colorsThe maximum number of colors to use in the octree quantization step.
mindiff_paramPointer to a bkr_mindiff_parameter structure containing parameters for the minimum difference calculation.
statsPointer to an array of bkr_color_stats structures where the results will be stored.
Returns
The number of unique colors found in the statistics, or -1 if an error occurred.