21#include <grass/gjson.h>
30static void close_file(
FILE *fp)
57 static int r0 = -1,
g0 = -1, b0 = -1;
60 if (
v0 == *val &&
r0 ==
r &&
g0 ==
g && b0 ==
b)
69 G_fatal_error(
_(
"Failed to initialize JSON object. Out of memory?"));
103 G_fatal_error(
_(
"Failed to initialize JSON object. Out of memory?"));
110 G_fatal_error(
_(
"Failed to initialize JSON array. Out of memory?"));
123 for (
int i =
lo; i <=
hi; i++) {
124 unsigned char r,
g,
b, set;
137 for (
int i = 0; i <
count; i++) {
143 colors,
count - 1 - i);
ColorFormat
Color format identifiers (enum)
#define COLOR_STRING_LENGTH
void G_color_to_str(int, int, int, ColorFormat, char *)
Parse red,green,blue and set color string.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int Rast_colors_count(const struct Colors *)
Get both modular and fixed rules count.
void Rast_get_c_color_range(CELL *, CELL *, const struct Colors *)
Get color range values (CELL)
int Rast_get_fp_color_rule(DCELL *, unsigned char *, unsigned char *, unsigned char *, DCELL *, unsigned char *, unsigned char *, unsigned char *, const struct Colors *, int)
Get color rule from both modular and fixed rules.
void Rast_get_null_value_color(int *, int *, int *, const struct Colors *)
Gets color for null value.
void Rast_lookup_c_colors(const CELL *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, struct Colors *)
Lookup an array of colors.
void Rast_get_default_color(int *, int *, int *, const struct Colors *)
Gets default color.
G_JSON_Status G_json_object_set_number(G_JSON_Object *object, const char *name, double number)
G_JSON_Array * G_json_array(const G_JSON_Value *value)
void G_json_value_free(G_JSON_Value *value)
G_JSON_Status G_json_object_set_value(G_JSON_Object *object, const char *name, G_JSON_Value *value)
void G_json_free_serialized_string(char *string)
char * G_json_serialize_to_string_pretty(const G_JSON_Value *value)
G_JSON_Status G_json_object_set_string(G_JSON_Object *object, const char *name, const char *string)
G_JSON_Value * G_json_value_init_object(void)
G_JSON_Value * G_json_value_init_array(void)
G_JSON_Object * G_json_object(const G_JSON_Value *value)
G_JSON_Status G_json_array_append_value(G_JSON_Array *array, G_JSON_Value *value)
struct G_json_array_t G_JSON_Array
struct G_json_object_t G_JSON_Object
struct G_json_value_t G_JSON_Value
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.
const char * json_string(const JSON_Value *value)