blob: b620970764c52bd85b203df64b5f8384339cf887 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/*
** mlx_get_color_value.c for MiniLibX in
**
** Made by Charlie Root
** Login <ol@epitech.net>
**
** Started on Mon Jul 31 19:01:33 2000 Charlie Root
** Last update Thu Oct 4 15:04:13 2001 Charlie Root
*/
#include "mlx_int.h"
int mlx_get_color_value(t_xvar *xvar,int color)
{
return(mlx_int_get_good_color(xvar,color));
}
int mlx_int_get_good_color(t_xvar *xvar,int color)
{
XColor xc;
if (xvar->depth>=24)
return (color);
xc.red = (color>>8)&0xFF00;
xc.green = color&0xFF00;
xc.blue = (color<<8)&0xFF00;
xc.pixel = ((xc.red>>(16-xvar->decrgb[1]))<<xvar->decrgb[0])+
((xc.green>>(16-xvar->decrgb[3]))<<xvar->decrgb[2])+
((xc.blue>>(16-xvar->decrgb[5]))<<xvar->decrgb[4]);
return (xc.pixel);
}
|