GUACAMOLE-279: Use guac_terminal_color for color palette assignments.
This commit is contained in:
parent
eec3607b16
commit
c53575b18c
@ -26,7 +26,6 @@
|
|||||||
#include "terminal/types.h"
|
#include "terminal/types.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
@ -333,16 +332,16 @@ void guac_terminal_display_reset_palette(guac_terminal_display* display) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int guac_terminal_display_assign_color(guac_terminal_display* display,
|
int guac_terminal_display_assign_color(guac_terminal_display* display,
|
||||||
int index, uint8_t red, uint8_t green, uint8_t blue) {
|
int index, const guac_terminal_color* color) {
|
||||||
|
|
||||||
/* Assignment fails if out-of-bounds */
|
/* Assignment fails if out-of-bounds */
|
||||||
if (index < 0 || index > 255)
|
if (index < 0 || index > 255)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Copy color components */
|
/* Copy color components */
|
||||||
display->palette[index].red = red;
|
display->palette[index].red = color->red;
|
||||||
display->palette[index].green = green;
|
display->palette[index].green = color->green;
|
||||||
display->palette[index].blue = blue;
|
display->palette[index].blue = color->blue;
|
||||||
|
|
||||||
/* Color successfully stored */
|
/* Color successfully stored */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -232,9 +232,8 @@ void guac_terminal_display_free(guac_terminal_display* display);
|
|||||||
void guac_terminal_display_reset_palette(guac_terminal_display* display);
|
void guac_terminal_display_reset_palette(guac_terminal_display* display);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces the color in the palette at the given index with a new color having
|
* Replaces the color in the palette at the given index with the given color.
|
||||||
* the given RGB components. If the index is invalid, the assignment is
|
* If the index is invalid, the assignment is ignored.
|
||||||
* ignored.
|
|
||||||
*
|
*
|
||||||
* @param display
|
* @param display
|
||||||
* The display whose palette is being changed.
|
* The display whose palette is being changed.
|
||||||
@ -242,24 +241,15 @@ void guac_terminal_display_reset_palette(guac_terminal_display* display);
|
|||||||
* @param index
|
* @param index
|
||||||
* The index of the palette entry to change.
|
* The index of the palette entry to change.
|
||||||
*
|
*
|
||||||
* @param red
|
* @param color
|
||||||
* The red color component of the color to assign to the palette entry
|
* The color to assign to the palette entry having the given index.
|
||||||
* having the given index.
|
|
||||||
*
|
|
||||||
* @param green
|
|
||||||
* The green color component of the color to assign to the palette entry
|
|
||||||
* having the given index.
|
|
||||||
*
|
|
||||||
* @param blue
|
|
||||||
* The blue color component of the color to assign to the palette entry
|
|
||||||
* having the given index.
|
|
||||||
*
|
*
|
||||||
* @returns
|
* @returns
|
||||||
* Zero if the assignment was successful, non-zero if the assignment
|
* Zero if the assignment was successful, non-zero if the assignment
|
||||||
* failed.
|
* failed.
|
||||||
*/
|
*/
|
||||||
int guac_terminal_display_assign_color(guac_terminal_display* display,
|
int guac_terminal_display_assign_color(guac_terminal_display* display,
|
||||||
int index, uint8_t red, uint8_t green, uint8_t blue);
|
int index, const guac_terminal_color* color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the color within the palette at the given index, if such a color
|
* Retrieves the color within the palette at the given index, if such a color
|
||||||
|
Loading…
Reference in New Issue
Block a user