Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1029 lines
50 KiB

//***************************************************************************************************
// N5COLSB.C
//
// Functions of color matching (For N5 printer)
//---------------------------------------------------------------------------------------------------
// copyright(C) 1997-2000 CASIO COMPUTER CO.,LTD. / CASIO ELECTRONICS MANUFACTURING CO.,LTD.
//***************************************************************************************************
#include <WINDOWS.H>
#include <WINBASE.H>
#include "COLDEF.H"
#include "COMDIZ.H"
#include "N5COLSB.H"
#include "strsafe.h" // Security-Code 2002.3.6
//===================================================================================================
// Gamma revision table (0.1 - 0.9)
//===================================================================================================
static BYTE GamTbl001[9][256] = {
/*---- 0.1 ----*/
{ 0x00, 0x91, 0x9c, 0xa2, 0xa7, 0xab, 0xae, 0xb1,
0xb3, 0xb5, 0xb7, 0xb9, 0xbb, 0xbc, 0xbe, 0xbf,
0xc0, 0xc1, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc7,
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcc, 0xcd, 0xce,
0xce, 0xcf, 0xd0, 0xd0, 0xd1, 0xd1, 0xd2, 0xd2,
0xd3, 0xd4, 0xd4, 0xd5, 0xd5, 0xd6, 0xd6, 0xd6,
0xd7, 0xd7, 0xd8, 0xd8, 0xd9, 0xd9, 0xd9, 0xda,
0xda, 0xdb, 0xdb, 0xdb, 0xdc, 0xdc, 0xdd, 0xdd,
0xdd, 0xde, 0xde, 0xde, 0xdf, 0xdf, 0xdf, 0xe0,
0xe0, 0xe0, 0xe1, 0xe1, 0xe1, 0xe1, 0xe2, 0xe2,
0xe2, 0xe3, 0xe3, 0xe3, 0xe3, 0xe4, 0xe4, 0xe4,
0xe5, 0xe5, 0xe5, 0xe5, 0xe6, 0xe6, 0xe6, 0xe6,
0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe8, 0xe8, 0xe8,
0xe8, 0xe9, 0xe9, 0xe9, 0xe9, 0xea, 0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0xd0, 0xd1, 0xd2, 0xd3,
0xd4, 0xd5, 0xd6, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe1,
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xeb, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf5, 0xf6, 0xf7,
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }
};
//===================================================================================================
// Gamma revision table (1.2 to 3.0)
//===================================================================================================
static BYTE GamTbl002[10][256] = {
/*---- 1.2 ----*/
{ 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03,
0x03, 0x04, 0x05, 0x05, 0x06, 0x07, 0x07, 0x08,
0x09, 0x09, 0x0a, 0x0b, 0x0b, 0x0c, 0x0d, 0x0e,
0x0e, 0x0f, 0x10, 0x11, 0x11, 0x12, 0x13, 0x14,
0x15, 0x15, 0x16, 0x17, 0x18, 0x19, 0x19, 0x1a,
0x1b, 0x1c, 0x1d, 0x1e, 0x1e, 0x1f, 0x20, 0x21,
0x22, 0x23, 0x24, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2a, 0x2b, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x35, 0x36,
0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
0x47, 0x48, 0x49, 0x49, 0x4a, 0x4b, 0x4c, 0x4d,
0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55,
0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d,
0x5e, 0x5f, 0x60, 0x61, 0x63, 0x64, 0x65, 0x66,
0x67,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de,
0xdf, 0xe0, 0xe2, 0xe3, 0xe4, 0xe6, 0xe7, 0xe8,
0xea, 0xeb, 0xec, 0xee, 0xef, 0xf1, 0xf2, 0xf3,
0xf5, 0xf6, 0xf8, 0xf9, 0xfa, 0xfc, 0xfd, 0xff },
/*---- 1.6 ----*/
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02,
0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05,
0x05, 0x06, 0x06, 0x07, 0x07, 0x07, 0x08, 0x08,
0x09, 0x09, 0x0a, 0x0a, 0x0b, 0x0b, 0x0c, 0x0c,
0x0d, 0x0d, 0x0e, 0x0e, 0x0f, 0x0f, 0x10, 0x11,
0x11, 0x12, 0x12, 0x13, 0x13, 0x14, 0x15, 0x15,
0x16, 0x17, 0x17, 0x18, 0x19, 0x19, 0x1a, 0x1b,
0x1b, 0x1c, 0x1d, 0x1e, 0x1e, 0x1f, 0x20, 0x20,
0x21, 0x22, 0x23, 0x23, 0x24, 0x25, 0x26, 0x27,
0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2b, 0x2c, 0x2d,
0x2e, 0x2f, 0x30, 0x30, 0x31, 0x32, 0x33, 0x34,
0x35, 0x36, 0x37, 0x38, 0x38, 0x39, 0x3a, 0x3b,
0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,
0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5b, 0x5c,
0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x65,
0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6d, 0x6e,
0x6f, 0x70, 0x71, 0x72, 0x74, 0x75, 0x76, 0x77,
0x78, 0x7a, 0x7b,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 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03,
0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x08, 0x08,
0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b,
0x0c, 0x0c, 0x0d, 0x0d, 0x0e, 0x0e, 0x0f, 0x0f,
0x10, 0x10, 0x11, 0x11, 0x12, 0x12, 0x13, 0x13,
0x14, 0x14, 0x15, 0x16, 0x16, 0x17, 0x17, 0x18,
0x19, 0x19, 0x1a, 0x1b, 0x1b, 0x1c, 0x1d, 0x1d,
0x1e, 0x1f, 0x1f, 0x20, 0x21, 0x21, 0x22, 0x23,
0x24, 0x24, 0x25, 0x26, 0x27, 0x28, 0x28, 0x29,
0x2a, 0x2b, 0x2c, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4f, 0x50,
0x51, 0x52, 0x53, 0x54, 0x55, 0x57, 0x58, 0x59,
0x5a, 0x5b, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x63,
0x64, 0x65, 0x66, 0x68, 0x69, 0x6a, 0x6c, 0x6d,
0x6e, 0x70, 0x71, 0x72, 0x74, 0x75, 0x76, 0x78,
0x79, 0x7a, 0x7c, 0x7d, 0x7f, 0x80, 0x81, 0x83,
0x84, 0x86, 0x87, 0x89, 0x8a, 0x8c, 0x8d, 0x8f,
0x90, 0x92, 0x93, 0x95, 0x96, 0x98, 0x99, 0x9b,
0x9c, 0x9e, 0xa0, 0xa1, 0xa3, 0xa4, 0xa6, 0xa8,
0xa9, 0xab, 0xac, 0xae, 0xb0, 0xb1, 0xb3, 0xb5,
0xb6, 0xb8, 0xba, 0xbc, 0xbd, 0xbf, 0xc1, 0xc3,
0xc4, 0xc6, 0xc8, 0xca, 0xcb, 0xcd, 0xcf, 0xd1,
0xd3, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, 0xe0,
0xe1, 0xe3, 0xe5, 0xe7, 0xe9, 0xeb, 0xed, 0xef,
0xf1, 0xf3, 0xf5, 0xf7, 0xf9, 0xfb, 0xfd, 0xff },
/*---- 2.2 ----*/
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02,
0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04,
0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06,
0x06, 0x06, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08,
0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b,
0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0f,
0x0f, 0x10, 0x10, 0x11, 0x11, 0x12, 0x12, 0x13,
0x13, 0x14, 0x14, 0x15, 0x16, 0x16, 0x17, 0x17,
0x18, 0x19, 0x19, 0x1a, 0x1b, 0x1b, 0x1c, 0x1d,
0x1d, 0x1e, 0x1f, 0x1f, 0x20, 0x21, 0x21, 0x22,
0x23, 0x24, 0x24, 0x25, 0x26, 0x27, 0x28, 0x28,
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x36,
0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
0x3f, 0x40, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4d, 0x4e, 0x4f, 0x50,
0x51, 0x52, 0x54, 0x55, 0x56, 0x57, 0x58, 0x5a,
0x5b, 0x5c, 0x5d, 0x5f, 0x60, 0x61, 0x63, 0x64,
0x65, 0x67, 0x68, 0x69, 0x6b, 0x6c, 0x6d, 0x6f,
0x70, 0x72, 0x73, 0x75, 0x76, 0x77, 0x79, 0x7a,
0x7c, 0x7d, 0x7f, 0x80, 0x82, 0x83, 0x85, 0x86,
0x88, 0x8a, 0x8b, 0x8d, 0x8e, 0x90, 0x92, 0x93,
0x95, 0x97, 0x98, 0x9a, 0x9c, 0x9d, 0x9f, 0xa1,
0xa2, 0xa4, 0xa6, 0xa8, 0xa9, 0xab, 0xad, 0xaf,
0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbb, 0xbd,
0xbf, 0xc1, 0xc3, 0xc5, 0xc7, 0xc9, 0xcb, 0xcd,
0xcf, 0xd1, 0xd3, 0xd5, 0xd7, 0xd9, 0xdb, 0xdd,
0xdf, 0xe1, 0xe3, 0xe5, 0xe7, 0xe9, 0xeb, 0xed,
0xef, 0xf1, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xff },
/*---- 2.4 ----*/
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04,
0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06,
0x06, 0x06, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08,
0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0b, 0x0b,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 2.6 ----*/
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04,
0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06,
0x06, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09,
0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0c,
0x0c, 0x0c, 0x0d, 0x0d, 0x0e, 0x0e, 0x0f, 0x0f,
0x10, 0x10, 0x10, 0x11, 0x11, 0x12, 0x13, 0x13,
0x14, 0x14, 0x15, 0x15, 0x16, 0x16, 0x17, 0x18,
0x18, 0x19, 0x19, 0x1a, 0x1b, 0x1b, 0x1c, 0x1d,
0x1e, 0x1e, 0x1f, 0x20, 0x20, 0x21, 0x22, 0x23,
0x23, 0x24, 0x25, 0x26, 0x27, 0x27, 0x28, 0x29,
0x2a, 0x2b, 0x2c, 0x2d, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3f, 0x40, 0x41,
0x42, 0x43, 0x44, 0x45, 0x47, 0x48, 0x49, 0x4a,
0x4b, 0x4d, 0x4e, 0x4f, 0x50, 0x52, 0x53, 0x54,
0x56, 0x57, 0x58, 0x5a, 0x5b, 0x5c, 0x5e, 0x5f,
0x61, 0x62, 0x64, 0x65, 0x67, 0x68, 0x6a, 0x6b,
0x6d, 0x6e, 0x70, 0x71, 0x73, 0x75, 0x76, 0x78,
0x79, 0x7b, 0x7d, 0x7e, 0x80, 0x82, 0x84, 0x85,
0x87, 0x89, 0x8b, 0x8c, 0x8e, 0x90, 0x92, 0x94,
0x96, 0x97, 0x99, 0x9b, 0x9d, 0x9f, 0xa1, 0xa3,
0xa5, 0xa7, 0xa9, 0xab, 0xad, 0xaf, 0xb1, 0xb3,
0xb6, 0xb8, 0xba, 0xbc, 0xbe, 0xc0, 0xc2, 0xc5,
0xc7, 0xc9, 0xcb, 0xce, 0xd0, 0xd2, 0xd5, 0xd7,
0xd9, 0xdc, 0xde, 0xe0, 0xe3, 0xe5, 0xe8, 0xea,
0xed, 0xef, 0xf2, 0xf4, 0xf7, 0xf9, 0xfc, 0xff },
/*---- 2.8 ----*/
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03,
0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05,
0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x07,
0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x09,
0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0c, 0x0c,
0x0c, 0x0d, 0x0d, 0x0e, 0x0e, 0x0f, 0x0f, 0x10,
0x10, 0x11, 0x11, 0x12, 0x12, 0x13, 0x13, 0x14,
0x14, 0x15, 0x15, 0x16, 0x16, 0x17, 0x18, 0x18,
0x19, 0x1a, 0x1a, 0x1b, 0x1c, 0x1c, 0x1d, 0x1e,
0x1e, 0x1f, 0x20, 0x21, 0x21, 0x22, 0x23, 0x24,
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2a,
0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32,
0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,
0x3b, 0x3c, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,
0x45, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x4d,
0x4f, 0x50, 0x51, 0x53, 0x54, 0x56, 0x57, 0x58,
0x5a, 0x5b, 0x5d, 0x5e, 0x60, 0x61, 0x63, 0x64,
0x66, 0x67, 0x69, 0x6a, 0x6c, 0x6e, 0x6f, 0x71,
0x73, 0x74, 0x76, 0x78, 0x7a, 0x7b, 0x7d, 0x7f,
0x81, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e,
0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e,
0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xaf,
0xb1, 0xb3, 0xb5, 0xb8, 0xba, 0xbc, 0xbe, 0xc1,
0xc3, 0xc6, 0xc8, 0xca, 0xcd, 0xcf, 0xd2, 0xd4,
0xd7, 0xd9, 0xdc, 0xde, 0xe1, 0xe3, 0xe6, 0xe9,
0xeb, 0xee, 0xf1, 0xf3, 0xf6, 0xf9, 0xfc, 0xff },
/*---- 3.0 ----*/
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04,
0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06,
0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09,
0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0c,
0x0c, 0x0c, 0x0d, 0x0d, 0x0e, 0x0e, 0x0f, 0x0f,
0x10, 0x10, 0x11, 0x11, 0x12, 0x12, 0x13, 0x14,
0x14, 0x15, 0x15, 0x16, 0x17, 0x17, 0x18, 0x19,
0x19, 0x1a, 0x1b, 0x1c, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
0x30, 0x31, 0x32, 0x33, 0x34, 0x36, 0x37, 0x38,
0x39, 0x3b, 0x3c, 0x3d, 0x3f, 0x40, 0x42, 0x43,
0x45, 0x46, 0x48, 0x49, 0x4b, 0x4c, 0x4e, 0x50,
0x51, 0x53, 0x55, 0x57, 0x59, 0x5a, 0x5c, 0x5e,
0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e,
0x70, 0x73, 0x75, 0x77, 0x79, 0x7c, 0x7e, 0x80,
0x83, 0x85, 0x88, 0x8a, 0x8d, 0x8f, 0x92, 0x95,
0x97, 0x9a, 0x9d, 0xa0, 0xa2, 0xa5, 0xa8, 0xab,
0xae, 0xb1, 0xb4, 0xb7, 0xbb, 0xbe, 0xc1, 0xc4,
0xc8, 0xcb, 0xce, 0xd2, 0xd5, 0xd9, 0xdc, 0xe0,
0xe4, 0xe7, 0xeb, 0xef, 0xf3, 0xf7, 0xfb, 0xff }
};
//===================================================================================================
// Toner density table make
//===================================================================================================
static VOID ColDnsMak( // Return value no
LONG, // Density(-30 to 30)
LPBYTE // Density table address
);
//===================================================================================================
// Brightness table make
//===================================================================================================
static VOID ColLgtMak( // Return value no
LONG, // Brightness(-100 to 100)
LPBYTE // Brightness table address
);
//===================================================================================================
// Contrast table make
//===================================================================================================
static VOID ColConMak( // Return value no
LONG, // Contrast(-100 to 100)
LPBYTE // Contrast table address
);
//***************************************************************************************************
// Functions
//***************************************************************************************************
//===================================================================================================
// RBG color control
//===================================================================================================
VOID WINAPI N501ColCtrRgb( // Return value no
DWORD xaxSiz, // X Size (pioxel)
LPRGB rgbBuf, // RGB buffer pointer
// RGBINF rgbInf // RBG information
LPRGBINF rgbInf // RBG information
)
{
LONG tmpRed, tmpGrn, tmpBlu;
LONG tmpMid;
LPRGB endAdr;
LPBYTE gamTblRed = 0;
LPBYTE gamTblGrn = 0;
LPBYTE gamTblBlu = 0;
LPBYTE dnsTbl = 0;
LPBYTE lgtTbl = 0, conTbl = 0;
BYTE tmpTbl[256], tmpTbl001[256], tmpTbl002[256];
/*----- Gamma revision table address set ----------------------------------------*/
// if ((rgbInf.Gmr > 0) && (rgbInf.Gmr < 10))
// gamTblRed = GamTbl001[rgbInf.Gmr - 1];
// else if ((rgbInf.Gmr > 10) && (rgbInf.Gmr < 31))
// gamTblRed = GamTbl002[(rgbInf.Gmr - 11) / 2];
//
// if ((rgbInf.Gmg > 0) && (rgbInf.Gmg < 10))
// gamTblGrn = GamTbl001[rgbInf.Gmg - 1];
// else if ((rgbInf.Gmg > 10) && (rgbInf.Gmg < 31))
// gamTblGrn = GamTbl002[(rgbInf.Gmg - 11) / 2];
//
// if ((rgbInf.Gmb > 0) && (rgbInf.Gmb < 10))
// gamTblBlu = GamTbl001[rgbInf.Gmb - 1];
// else if ((rgbInf.Gmb > 10) && (rgbInf.Gmb < 31))
// gamTblBlu = GamTbl002[(rgbInf.Gmb - 11) / 2];
if ((rgbInf->Gmr > 0) && (rgbInf->Gmr < 10))
gamTblRed = GamTbl001[rgbInf->Gmr - 1];
else if ((rgbInf->Gmr > 10) && (rgbInf->Gmr < 31))
gamTblRed = GamTbl002[(rgbInf->Gmr - 11) / 2];
if ((rgbInf->Gmg > 0) && (rgbInf->Gmg < 10))
gamTblGrn = GamTbl001[rgbInf->Gmg - 1];
else if ((rgbInf->Gmg > 10) && (rgbInf->Gmg < 31))
gamTblGrn = GamTbl002[(rgbInf->Gmg - 11) / 2];
if ((rgbInf->Gmb > 0) && (rgbInf->Gmb < 10))
gamTblBlu = GamTbl001[rgbInf->Gmb - 1];
else if ((rgbInf->Gmb > 10) && (rgbInf->Gmb < 31))
gamTblBlu = GamTbl002[(rgbInf->Gmb - 11) / 2];
/*----- Printing density table address set --------------------------------------*/
// if (rgbInf.Dns) {
if (rgbInf->DnsRgb) {
// ColDnsMak(rgbInf.Dns * (-1), tmpTbl);
ColDnsMak(rgbInf->DnsRgb * (-1), tmpTbl);
dnsTbl = tmpTbl;
}
/*----- Brightness table address set --------------------------------------------*/
// if (rgbInf.Lgt) {
if (rgbInf->Lgt) {
// ColLgtMak(rgbInf.Lgt, tmpTbl001);
ColLgtMak(rgbInf->Lgt, tmpTbl001);
lgtTbl = tmpTbl001;
}
/*----- Contrast table address set ----------------------------------------------*/
// if (rgbInf.Con) {
if (rgbInf->Con) {
// ColConMak(rgbInf.Con, tmpTbl002);
ColConMak(rgbInf->Con, tmpTbl002);
conTbl = tmpTbl002;
}
/*===== RBG color control =================================================*/
for (endAdr = rgbBuf + xaxSiz; rgbBuf < endAdr; rgbBuf++) {
tmpRed = rgbBuf->Red;
tmpGrn = rgbBuf->Grn;
tmpBlu = rgbBuf->Blu;
/*----- Printing density ----------------------------------------------------*/
if (dnsTbl) {
tmpRed = dnsTbl[tmpRed];
tmpGrn = dnsTbl[tmpGrn];
tmpBlu = dnsTbl[tmpBlu];
}
/*----- Brightness ----------------------------------------------------------*/
//// if (rgbInf.Lgt != 0) {
//// tmpRed += rgbInf.Lgt / 3;
//// tmpGrn += rgbInf.Lgt / 3;
//// tmpBlu += rgbInf.Lgt / 3;
if (rgbInf->Lgt != 0) {
tmpRed = lgtTbl[tmpRed];
tmpGrn = lgtTbl[tmpGrn];
tmpBlu = lgtTbl[tmpBlu];
/****** Conventionally specification *************************************/
// tmpRed += rgbInf->Lgt / 3;
// tmpGrn += rgbInf->Lgt / 3;
// tmpBlu += rgbInf->Lgt / 3;
// if (tmpRed < 0) tmpRed = 0; else if (tmpRed > 255) tmpRed = 255;
// if (tmpGrn < 0) tmpGrn = 0; else if (tmpGrn > 255) tmpGrn = 255;
// if (tmpBlu < 0) tmpBlu = 0; else if (tmpBlu > 255) tmpBlu = 255;
}
/*----- Contrast ------------------------------------------------------------*/
// if (rgbInf.Con != 0) {
if (rgbInf->Con != 0) {
tmpRed = conTbl[tmpRed];
tmpGrn = conTbl[tmpGrn];
tmpBlu = conTbl[tmpBlu];
}
/*----- Chroma (Old, contrast)-----------------------------------------------*/
// if (rgbInf.Crm != 0) {
if (rgbInf->Crm != 0) {
tmpMid = (tmpRed + tmpGrn + tmpBlu) / 3;
// tmpRed += (tmpRed - tmpMid) * rgbInf.Crm / 200;
// tmpGrn += (tmpGrn - tmpMid) * rgbInf.Crm / 200;
// tmpBlu += (tmpBlu - tmpMid) * rgbInf.Crm / 200;
tmpRed += (tmpRed - tmpMid) * rgbInf->Crm / 200;
tmpGrn += (tmpGrn - tmpMid) * rgbInf->Crm / 200;
tmpBlu += (tmpBlu - tmpMid) * rgbInf->Crm / 200;
if (tmpRed < 0) tmpRed = 0; else if (tmpRed > 255) tmpRed = 255;
if (tmpGrn < 0) tmpGrn = 0; else if (tmpGrn > 255) tmpGrn = 255;
if (tmpBlu < 0) tmpBlu = 0; else if (tmpBlu > 255) tmpBlu = 255;
}
/*----- Gamma ---------------------------------------------------------------*/
if (gamTblRed) tmpRed = gamTblRed[tmpRed];
if (gamTblGrn) tmpGrn = gamTblGrn[tmpGrn];
if (gamTblBlu) tmpBlu = gamTblBlu[tmpBlu];
rgbBuf->Red = (BYTE)tmpRed;
rgbBuf->Grn = (BYTE)tmpGrn;
rgbBuf->Blu = (BYTE)tmpBlu;
}
return;
}
//===================================================================================================
// CMYK color control
//===================================================================================================
VOID WINAPI N501ColCtrCmy( // Return value no
DWORD xaxSiz, // X Size (pioxel)
LPCMYK cmyBuf, // RGB buffer pointer
// CMYKINF cmyInf // CMYK information
LPCMYKINF cmyInf // CMYK information
)
{
LONG tmpCyn, tmpMgt, tmpYel, tmpBla;
LONG tmpMid;
LPCMYK endAdr;
LPBYTE dnsTblCyn = 0;
LPBYTE dnsTblMgt = 0;
LPBYTE dnsTblYel = 0;
LPBYTE dnsTblBla = 0;
BYTE tmpTblCyn[256], tmpTblMgt[256], tmpTblYel[256], tmpTblBla[256];
/*----- Printing density table address set --------------------------------------*/
// if (cmyInf.DnsCyn) {
// ColDnsMak(cmyInf.DnsCyn, tmpTblCyn);
if (cmyInf->DnsCyn) {
ColDnsMak(cmyInf->DnsCyn, tmpTblCyn);
dnsTblCyn = tmpTblCyn;
}
// if (cmyInf.DnsMgt) {
// ColDnsMak(cmyInf.DnsMgt, tmpTblMgt);
if (cmyInf->DnsMgt) {
ColDnsMak(cmyInf->DnsMgt, tmpTblMgt);
dnsTblMgt = tmpTblMgt;
}
// if (cmyInf.DnsYel) {
// ColDnsMak(cmyInf.DnsYel, tmpTblYel);
if (cmyInf->DnsYel) {
ColDnsMak(cmyInf->DnsYel, tmpTblYel);
dnsTblYel = tmpTblYel;
}
// if (cmyInf.DnsBla) {
// ColDnsMak(cmyInf.DnsBla, tmpTblBla);
if (cmyInf->DnsBla) {
ColDnsMak(cmyInf->DnsBla, tmpTblBla);
dnsTblBla = tmpTblBla;
}
/*===== CMYK color control ==============================================*/
for (endAdr = cmyBuf + xaxSiz; cmyBuf < endAdr; cmyBuf++) {
tmpCyn = cmyBuf->Cyn;
tmpMgt = cmyBuf->Mgt;
tmpYel = cmyBuf->Yel;
tmpBla = cmyBuf->Bla;
/*----- Vivid ---------------------------------------------------------------*/
// if (cmyInf.Viv) {
if (cmyInf->Viv) {
tmpMid = (tmpCyn + tmpMgt + tmpYel) / 3;
// tmpCyn += (tmpCyn - tmpMid) * cmyInf.Viv / 100;
// tmpMgt += (tmpMgt - tmpMid) * cmyInf.Viv / 100;
// tmpYel += (tmpYel - tmpMid) * cmyInf.Viv / 100;
tmpCyn += (tmpCyn - tmpMid) * cmyInf->Viv / 100;
tmpMgt += (tmpMgt - tmpMid) * cmyInf->Viv / 100;
tmpYel += (tmpYel - tmpMid) * cmyInf->Viv / 100;
if (tmpCyn < 0) tmpCyn = 0; else if (tmpCyn > 255) tmpCyn = 255;
if (tmpMgt < 0) tmpMgt = 0; else if (tmpMgt > 255) tmpMgt = 255;
if (tmpYel < 0) tmpYel = 0; else if (tmpYel > 255) tmpYel = 255;
}
/*----- Printing density adjustment -----------------------------------------*/
if (dnsTblCyn) tmpCyn = dnsTblCyn[tmpCyn];
if (dnsTblMgt) tmpMgt = dnsTblMgt[tmpMgt];
if (dnsTblYel) tmpYel = dnsTblYel[tmpYel];
if (dnsTblBla) tmpBla = dnsTblBla[tmpBla];
cmyBuf->Cyn = (BYTE)tmpCyn;
cmyBuf->Mgt = (BYTE)tmpMgt;
cmyBuf->Yel = (BYTE)tmpYel;
cmyBuf->Bla = (BYTE)tmpBla;
}
return;
}
//***************************************************************************************************
// Static functions
//***************************************************************************************************
//===================================================================================================
// Toner density table make
//===================================================================================================
static VOID ColDnsMak( // Return value no
LONG prnDns, // Density(-30 to 30)
LPBYTE dnsTbl // Density table address
)
{
LONG innNum;
LONG outNum;
prnDns *= 2;
// dnsTbl[0] = (BYTE)0;
// for (innNum = 1; innNum <= 254; innNum++) {
for (innNum = 0; innNum <= 255; innNum++) {
outNum = innNum + prnDns;
if (outNum < 0) outNum = 0;
if (outNum > 255) outNum = 255;
dnsTbl[innNum] = (BYTE)outNum;
}
// dnsTbl[255] = (BYTE)255;
return;
}
//===================================================================================================
// Brightness table make
//===================================================================================================
static VOID ColLgtMak( // Return value no
LONG lgt, // Brightness(-100 to 100)
LPBYTE tbl // Brightness table address
)
{
LONG prnDns;
LPBYTE dnsTbl;
LONG innNum, outNum;
prnDns = lgt;
dnsTbl = tbl;
if (prnDns < 0) {
for (innNum = 0; innNum < 256; innNum++) {
if (innNum == 255) outNum = 255;
else outNum = innNum * (255 + prnDns) / 255;
dnsTbl[innNum] = (BYTE)outNum;
}
} else {
for (innNum = 0; innNum < 256; innNum++) {
if (innNum == 0) outNum = 0;
else outNum = (innNum + prnDns) * 255 / (255 + prnDns);
dnsTbl[innNum] = (BYTE)outNum;
}
}
return;
}
//===================================================================================================
// Contrast table make
//===================================================================================================
static VOID ColConMak( // Return value no
LONG con, // Contrast(-100 to 100)
LPBYTE tbl // Contrast table address
)
{
LONG n, m, min, mid, max, rng;
mid = (LONG)127; /* The mean value be 127 fixation */
if (con > 0) {
min = con * mid / (LONG)100; /* min (0 - 127) */
max = (LONG)255 - min; /* max (128 to 255) */
rng = max - min; /* Inclination range */
/*----- Contrast up ---------------------------------------------------------*/
for (n = 0; n <= min; n++) tbl[n] = (BYTE)0;
for (m = 0; n <= max; n++, m++)
tbl[n] = (BYTE)((m * (LONG)255) / rng);
for (; n <= (LONG)255; n++) tbl[n] = (BYTE)255;
} else {
con *= (LONG)(-1); /* Contrast value is integer */
min = con * mid / (LONG)100; /* min (0 to 127) */
max = (LONG)255 - min; /* max (128 to 255) */
rng = max - min; /* Inclination range */
/*----- Contrast down -------------------------------------------------------*/
for (n = 0; n <= (LONG)255; n++)
tbl[n] = (BYTE)(((n * rng) / (LONG)255) + min);
}
return;
}
// End of N5COLSB.C