aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/App.xaml
blob: e3b2c28f8c61bb39cbea247d87931b0a2b17d80e (plain)
1
2
3
4
5
6
7
8
9
10
11
<Application x:Class="Tango.PPC.MachineSettings.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/Tango.PPC.Common;component/Resources/Merged.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
ont-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#include "C_RGB_XYZ_Lab.h"
//#include <cmath>
//#include <algorithm>    // std::min, max

/*#define _CRTDBG_MAP_ALLOC  
#include <stdlib.h>  
#include <crtdbg.h>
#include <cstdlib>

#ifdef _DEBUG
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
// Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the
// allocations to be of _CLIENT_BLOCK type
#else
#define DBG_NEW new
#endif*/


// Default Constructor ... C_RGB_XYZ_Lab = (0, 0, 0)
C_RGB_XYZ_Lab::C_RGB_XYZ_Lab(void) :
	m_x(0.0),
	m_y(0.0),
	m_z(0.0)
{
}


// Constructor from a constant ... C_RGB_XYZ_Lab = (val, val, val)
C_RGB_XYZ_Lab::C_RGB_XYZ_Lab(const double &val) :
	m_x(val),
	m_y(val),
	m_z(val)
{
}


// Constructor from 3 values ... C_RGB_XYZ_Lab = (val1, val2, val3)
C_RGB_XYZ_Lab::C_RGB_XYZ_Lab(const double &val1, const double &val2, const double &val3) :
	m_x(val1),
	m_y(val2),
	m_z(val3)
{
}


// Constructor from 3 values in a vector
C_RGB_XYZ_Lab::C_RGB_XYZ_Lab(const VectorXd &Val):
m_x(Val(0)),
m_y(Val(1)),
m_z(Val(2))
{

}


// Copy constructor
C_RGB_XYZ_Lab::C_RGB_XYZ_Lab(const C_RGB_XYZ_Lab &rhs) :
	m_x(rhs.m_x),
	m_y(rhs.m_y),
	m_z(rhs.m_z)
{
}



// Get a vector from the RGB/XYZ/Lab
VectorXd C_RGB_XYZ_Lab::Get() const
{
	VectorXd vec(3);
	vec(0) = m_x;
	vec(1) = m_y;
	vec(2) = m_z;
	return vec;
}


// Set RGB/XYZ/Lab from a vector
void C_RGB_XYZ_Lab::Set(const VectorXd &rhs)
{
	m_x = rhs(0);
	m_y = rhs(1);
	m_z = rhs(2);
}


// Set RGB/XYZ/Lab from three values
void C_RGB_XYZ_Lab::Set(const double &val1, const double &val2, const double &val3)
{
	m_x = val1;
	m_y = val2;
	m_z = val3;
}


// Clip the individual components to the range [low,high]
void  C_RGB_XYZ_Lab::Clamp(C_RGB_XYZ_Lab &low, C_RGB_XYZ_Lab &high)
{
	m_x = std::min(std::max(m_x, low.Get_x()), high.Get_x());
	m_y = std::min(std::max(m_y, low.Get_y()), high.Get_y());
	m_z = std::min(std::max(m_z, low.Get_z()), high.Get_z());;
}

C_RGB_XYZ_Lab C_RGB_XYZ_Lab::labuint16_to_labdouble(uint16_t * LabShort)
{
		double tmp[3];
		C_RGB_XYZ_Lab out;
		tmp[0] = (double(LabShort[0]) * (100.0 + (25500.0 / 65280.0))) / 65535.0;
		tmp[1] = ((double(LabShort[1]) * (255.0 + (255.0 / 256.0))) / 65535.0) - 128.0;
		tmp[2] = ((double(LabShort[2]) * (255.0 + (255.0 / 256.0))) / 65535.0) - 128.0;
		out.Set(tmp[0], tmp[1], tmp[2]);
		return (out);	
}

C_RGB_XYZ_Lab C_RGB_XYZ_Lab::labdouble_to_labuint16(double* LabDouble)
{
//Do the scale and offset and cast to uint16
	C_RGB_XYZ_Lab out;
	double tmp[3];
tmp[0]= round(65535 * LabDouble[0] / (100 + (25500 / 65280)));
tmp[1] = round(65535 * ((128 + LabDouble[1]) / (255 + (255 / 256))));
tmp[2] = round(65535 * ((128 + LabDouble[2]) / (255 + (255 / 256))));
for (int i = 0; i < 3; ++i)
	tmp[0] = std::min(std::max(tmp[0], 0.0), 65535.0);
out.Set((uint16_t)tmp[0], (uint16_t)tmp[1], (uint16_t)tmp[2]);
return (out);
}

// add to existing value (rgb += rhs)
C_RGB_XYZ_Lab  &C_RGB_XYZ_Lab::operator += (C_RGB_XYZ_Lab &rhs)
{
	m_x += rhs.m_x;
	m_y += rhs.m_y;
	m_z += rhs.m_z;
	return (*this);
}


// subtract from existing value (lab -= rhs)
C_RGB_XYZ_Lab  &C_RGB_XYZ_Lab::operator -= (C_RGB_XYZ_Lab &rhs)
{
	m_x -= rhs.m_x;
	m_y -= rhs.m_y;
	m_z -= rhs.m_z;
	return (*this);
}


// multiply 2 RGB's (lab *= rhs)
C_RGB_XYZ_Lab  &C_RGB_XYZ_Lab::operator *= (C_RGB_XYZ_Lab &rhs)
{
	m_x *= rhs.m_x;
	m_y *= rhs.m_y;
	m_z *= rhs.m_z;
	return (*this);
}


// Divide 2 RGB's (lab /= rhs)
C_RGB_XYZ_Lab  &C_RGB_XYZ_Lab::operator /= (C_RGB_XYZ_Lab &rhs)
{
	m_x /= rhs.m_x;
	m_y /= rhs.m_y;
	m_z /= rhs.m_z;
	return (*this);
}

// isequal (lhs == rhs)
bool  operator == (C_RGB_XYZ_Lab &lhs, C_RGB_XYZ_Lab &rhs)
{
	return ((lhs.Get_x() == rhs.Get_x()) && (lhs.Get_y() == rhs.Get_y()) && (lhs.Get_z() == rhs.Get_z()));
}



// isnotequal (lhs != rhs)
bool  operator != (C_RGB_XYZ_Lab &lhs, C_RGB_XYZ_Lab &rhs)
{
	return (!operator == (lhs, rhs));
}