Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
colorpicker.qh File Reference
#include "../item/image.qh"
Include dependency graph for colorpicker.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  XonoticColorpicker

Functions

vector color_hslimage (vector v, vector margin)
vector hslimage_color (vector v, vector margin)
entity makeXonoticColorpicker (entity theTextbox)

Function Documentation

◆ color_hslimage()

vector color_hslimage ( vector v,
vector margin )

Definition at line 41 of file colorpicker.qc.

42{
43 vector pos = '0 0 0';
44 v = rgb_to_hsl(v);
45 if (v.y)
46 {
47 pos.x = v.x / 6;
48 pos.y = v.z * 0.875;
49 }
50 else // grey scale
51 {
52 pos.x = v.z;
53 pos.y = 0.875 + 0.07;
54 }
55 pos.x = margin.x + pos.x * (1 - 2 * margin.x);
56 pos.y = margin.y + pos.y * (1 - 2 * margin.y);
57 return pos;
58}
ERASEABLE vector rgb_to_hsl(vector rgb)
Definition color.qh:147
vector
Definition self.qh:92

References rgb_to_hsl(), and vector.

Referenced by XonoticColorpicker::draw(), and XonoticColorpickerString_loadCvars().

◆ hslimage_color()

vector hslimage_color ( vector v,
vector margin )

Definition at line 25 of file colorpicker.qc.

26{
27 v.x = (v.x - margin.x) / (1 - 2 * margin.x);
28 v.y = (v.y - margin.y) / (1 - 2 * margin.y);
29
30 if(v.x < 0) v.x = 0;
31 if(v.y < 0) v.y = 0;
32 if(v.x > 1) v.x = 1;
33 if(v.y > 1) v.y = 1;
34
35 if(v.y > 0.875) // grey bar
36 return hsl_to_rgb(eZ * v.x);
37 else
38 return hsl_to_rgb(v.x * 6 * eX + eY + v.y / 0.875 * eZ);
39}
ERASEABLE vector hsl_to_rgb(vector hsl)
Definition color.qh:167
const vector eY
Definition vector.qh:45
const vector eZ
Definition vector.qh:46
const vector eX
Definition vector.qh:44

References eX, eY, eZ, hsl_to_rgb(), and vector.

Referenced by XonoticColorpicker::draw(), XonoticColorpicker_mouseDrag(), and XonoticColorpickerString_saveCvars().

◆ makeXonoticColorpicker()

entity makeXonoticColorpicker ( entity theTextbox)

Definition at line 5 of file colorpicker.qc.

6{
7 entity me;
9 me.configureXonoticColorpicker(me, theTextbox);
10 return me;
11}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define NEW(cname,...)
Definition oo.qh:117

References entity(), and NEW.

Referenced by XonoticColorpicker::draw(), XonoticFirstRunDialog_fill(), and XonoticProfileTab_fill().