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 40 of file colorpicker.qc.

41{
42 vector pos = '0 0 0';
43 v = rgb_to_hsl(v);
44 if (v.y)
45 {
46 pos.x = v.x / 6;
47 pos.y = v.z * 0.875;
48 }
49 else // grey scale
50 {
51 pos.x = v.z;
52 pos.y = 0.875 + 0.07;
53 }
54 pos.x = margin.x + pos.x * (1 - 2 * margin.x);
55 pos.y = margin.y + pos.y * (1 - 2 * margin.y);
56 return pos;
57}
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 24 of file colorpicker.qc.

25{
26 v.x = (v.x - margin.x) / (1 - 2 * margin.x);
27 v.y = (v.y - margin.y) / (1 - 2 * margin.y);
28
29 if(v.x < 0) v.x = 0;
30 if(v.y < 0) v.y = 0;
31 if(v.x > 1) v.x = 1;
32 if(v.y > 1) v.y = 1;
33
34 if(v.y > 0.875) // grey bar
35 return hsl_to_rgb(eZ * v.x);
36 else
37 return hsl_to_rgb(v.x * 6 * eX + eY + v.y / 0.875 * eZ);
38}
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{
8 me.configureXonoticColorpicker(me, theTextbox);
9 return me;
10}
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().