void processData::get_light_info_control(int _channel, int _posX, int _posY, int _index)
{
controllercolor *lightcolor = new controllercolor;
lightcolor->channel = _channel;
lightcolor->index = _index;
lightcolor->posX = _posX;
lightcolor->posY = _posY;
listcontroller.append(lightcolor);
}
void processData::get_light_info_control(int _channel, int _posX, int _posY, int _index)
{
controllercolor *lightcolor = new controllercolor;
lightcolor->channel = _channel;
lightcolor->index = _index;
lightcolor->posX = _posX;
lightcolor->posY = _posY;
listcontroller.append(lightcolor);
}
To copy to clipboard, switch view to plain text mode
Here is code update function
void processData::process_channel()
{
foreach (controllercolor *lightcolor, listcontroller) {
getMyPixel(lightcolor->posX, lightcolor->posY, lightcolor->index, lightcolor->channel);
}
}
void processData::process_channel()
{
foreach (controllercolor *lightcolor, listcontroller) {
getMyPixel(lightcolor->posX, lightcolor->posY, lightcolor->index, lightcolor->channel);
}
}
To copy to clipboard, switch view to plain text mode
Here is code function
QColor processData
::getMyPixel(int _x,
int _y,
int _index,
int _channel
) {
HWND name = FindWindow(NULL,L"Lighting Player");
HDC dc = GetDC(name);
COLORREF color = GetPixel(dc, _x, _y );
int _red = GetRValue(color);
int _green = GetGValue(color);
int _blue = GetBValue(color);
int _white = qMin(_red,_green);
_white = qMin(_white,_blue);
int _dimmer = _red*0.35 + _green*0.5 + _blue*0.15;
c1.setRgb(_red, _green, _blue);
ReleaseDC(name, dc);
colorR = c1.name().mid(1,2);
colorG = c1.name().mid(3,2);
colorB = c1.name().mid(5,2);
colorD
= QString::number( _dimmer,
16 );
if(colorD.length() == 1) {
colorD.insert(0,"0");
}
colorW
= QString::number( _white,
16 );
if(colorW.length() == 1) {
colorW.insert(0,"0");
}
if(_index == 0){
frame.replace(_channel*2 + 20,2,colorD);
}
else if(_index == 1){
frame.replace(_channel*2 + 20,6,colorR+colorG+colorB);
}
else if (_index == 2){
frame.replace(_channel*2 + 20,8,colorR+colorG+colorB+colorW);
}
send_data_channel();
return c1.name();
}
QColor processData::getMyPixel(int _x, int _y, int _index, int _channel)
{
HWND name = FindWindow(NULL,L"Lighting Player");
HDC dc = GetDC(name);
COLORREF color = GetPixel(dc, _x, _y );
int _red = GetRValue(color);
int _green = GetGValue(color);
int _blue = GetBValue(color);
int _white = qMin(_red,_green);
_white = qMin(_white,_blue);
int _dimmer = _red*0.35 + _green*0.5 + _blue*0.15;
QColor c1;
c1.setRgb(_red, _green, _blue);
ReleaseDC(name, dc);
colorR = c1.name().mid(1,2);
colorG = c1.name().mid(3,2);
colorB = c1.name().mid(5,2);
colorD = QString::number( _dimmer, 16 );
if(colorD.length() == 1) {
colorD.insert(0,"0");
}
colorW = QString::number( _white, 16 );
if(colorW.length() == 1) {
colorW.insert(0,"0");
}
if(_index == 0){
frame.replace(_channel*2 + 20,2,colorD);
}
else if(_index == 1){
frame.replace(_channel*2 + 20,6,colorR+colorG+colorB);
}
else if (_index == 2){
frame.replace(_channel*2 + 20,8,colorR+colorG+colorB+colorW);
}
send_data_channel();
return c1.name();
}
To copy to clipboard, switch view to plain text mode
Bookmarks