Xonotic
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.

References rgb_to_hsl(), and vector().

Referenced by XonoticColorpickerString_loadCvars().

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(float skel, float bonenum) _skel_get_boneabs_hidden
vector v
Definition: ent_cs.qc:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hslimage_color()

vector hslimage_color ( vector  v,
vector  margin 
)

Definition at line 26 of file colorpicker.qc.

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

Referenced by XonoticColorpicker_mouseDrag(), and XonoticColorpickerString_saveCvars().

27 {
28  v_x = (v.x - margin.x) / (1 - 2 * margin.x);
29  v_y = (v.y - margin.y) / (1 - 2 * margin.y);
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  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
vector v
Definition: ent_cs.qc:116
const vector eX
Definition: vector.qh:44
const vector eZ
Definition: vector.qh:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeXonoticColorpicker()

entity makeXonoticColorpicker ( entity  theTextbox)

Definition at line 5 of file colorpicker.qc.

References entity(), and NEW.

6 {
7  entity me;
9  me.configureXonoticColorpicker(me, theTextbox);
10  return me;
11 }
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
+ Here is the call graph for this function: