GRASS 8 Programmer's Manual 8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
json_color_out.c File Reference

Raster Library - Print color table in json format. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/colors.h>
#include <grass/gjson.h>
#include <grass/glocale.h>
#include <grass/raster.h>
Include dependency graph for json_color_out.c:

Go to the source code of this file.

Functions

void Rast_print_json_colors (struct Colors *colors, DCELL min, DCELL max, FILE *fp, int perc, ColorFormat clr_frmt)
 Print color table in JSON format.
 

Detailed Description

Raster Library - Print color table in json format.

(C) 2010-2024 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Nishant Bansal

Definition in file json_color_out.c.

Function Documentation

◆ Rast_print_json_colors()

void Rast_print_json_colors ( struct Colors colors,
DCELL  min,
DCELL  max,
FILE fp,
int  perc,
ColorFormat  clr_frmt 
)

Print color table in JSON format.

Parameters
colorspointer to Colors structure
min,maxminimum and maximum value for percentage output (used only when perc is non-zero)
fpfile where to print color table rules
percTRUE for percentage output
clr_frmtcolor format to be used (RBG, HEX, HSV, TRIPLET).

Definition at line 97 of file json_color_out.c.

References _, b, COLOR_STRING_LENGTH, count, g, G_color_to_str(), G_fatal_error(), G_json_array(), G_json_free_serialized_string(), G_json_object(), G_json_object_set_string(), G_json_object_set_value(), G_json_serialize_to_string_pretty(), G_json_value_free(), G_json_value_init_array(), G_json_value_init_object(), json_string(), max, min, NULL, r, Rast_colors_count(), Rast_get_c_color_range(), Rast_get_default_color(), Rast_get_fp_color_rule(), Rast_get_null_value_color(), Rast_lookup_c_colors(), and Colors::version.