Get the style color and number just once
[LibreOffice.git] / vcl / source / bitmap / floyd.hxx
blobb5f26fb7a6c6f021246def2c14403749ad1032b7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 const extern sal_uLong nVCLRLut[ 6 ] = { 16, 17, 18, 19, 20, 21 };
23 const extern sal_uLong nVCLGLut[ 6 ] = { 0, 6, 12, 18, 24, 30 };
24 const extern sal_uLong nVCLBLut[ 6 ] = { 0, 36, 72, 108, 144, 180 };
26 const extern sal_uLong nVCLDitherLut[ 256 ] =
28 0, 49152, 12288, 61440, 3072, 52224, 15360, 64512, 768, 49920, 13056,
29 62208, 3840, 52992, 16128, 65280, 32768, 16384, 45056, 28672, 35840, 19456,
30 48128, 31744, 33536, 17152, 45824, 29440, 36608, 20224, 48896, 32512, 8192,
31 57344, 4096, 53248, 11264, 60416, 7168, 56320, 8960, 58112, 4864, 54016,
32 12032, 61184, 7936, 57088, 40960, 24576, 36864, 20480, 44032, 27648, 39936,
33 23552, 41728, 25344, 37632, 21248, 44800, 28416, 40704, 24320, 2048, 51200,
34 14336, 63488, 1024, 50176, 13312, 62464, 2816, 51968, 15104, 64256, 1792,
35 50944, 14080, 63232, 34816, 18432, 47104, 30720, 33792, 17408, 46080, 29696,
36 35584, 19200, 47872, 31488, 34560, 18176, 46848, 30464, 10240, 59392, 6144,
37 55296, 9216, 58368, 5120, 54272, 11008, 60160, 6912, 56064, 9984, 59136,
38 5888, 55040, 43008, 26624, 38912, 22528, 41984, 25600, 37888, 21504, 43776,
39 27392, 39680, 23296, 42752, 26368, 38656, 22272, 512, 49664, 12800, 61952,
40 3584, 52736, 15872, 65024, 256, 49408, 12544, 61696, 3328, 52480, 15616,
41 64768, 33280, 16896, 45568, 29184, 36352, 19968, 48640, 32256, 33024, 16640,
42 45312, 28928, 36096, 19712, 48384, 32000, 8704, 57856, 4608, 53760, 11776,
43 60928, 7680, 56832, 8448, 57600, 4352, 53504, 11520, 60672, 7424, 56576,
44 41472, 25088, 37376, 20992, 44544, 28160, 40448, 24064, 41216, 24832, 37120,
45 20736, 44288, 27904, 40192, 23808, 2560, 51712, 14848, 64000, 1536, 50688,
46 13824, 62976, 2304, 51456, 14592, 63744, 1280, 50432, 13568, 62720, 35328,
47 18944, 47616, 31232, 34304, 17920, 46592, 30208, 35072, 18688, 47360, 30976,
48 34048, 17664, 46336, 29952, 10752, 59904, 6656, 55808, 9728, 58880, 5632,
49 54784, 10496, 59648, 6400, 55552, 9472, 58624, 5376, 54528, 43520, 27136,
50 39424, 23040, 42496, 26112, 38400, 22016, 43264, 26880, 39168, 22784, 42240,
51 25856, 38144, 21760
54 const extern sal_uLong nVCLLut[ 256 ] =
56 0, 1286, 2572, 3858, 5144, 6430, 7716, 9002,
57 10288, 11574, 12860, 14146, 15432, 16718, 18004, 19290,
58 20576, 21862, 23148, 24434, 25720, 27006, 28292, 29578,
59 30864, 32150, 33436, 34722, 36008, 37294, 38580, 39866,
60 41152, 42438, 43724, 45010, 46296, 47582, 48868, 50154,
61 51440, 52726, 54012, 55298, 56584, 57870, 59156, 60442,
62 61728, 63014, 64300, 65586, 66872, 68158, 69444, 70730,
63 72016, 73302, 74588, 75874, 77160, 78446, 79732, 81018,
64 82304, 83590, 84876, 86162, 87448, 88734, 90020, 91306,
65 92592, 93878, 95164, 96450, 97736, 99022,100308,101594,
66 102880,104166,105452,106738,108024,109310,110596,111882,
67 113168,114454,115740,117026,118312,119598,120884,122170,
68 123456,124742,126028,127314,128600,129886,131172,132458,
69 133744,135030,136316,137602,138888,140174,141460,142746,
70 144032,145318,146604,147890,149176,150462,151748,153034,
71 154320,155606,156892,158178,159464,160750,162036,163322,
72 164608,165894,167180,168466,169752,171038,172324,173610,
73 174896,176182,177468,178754,180040,181326,182612,183898,
74 185184,186470,187756,189042,190328,191614,192900,194186,
75 195472,196758,198044,199330,200616,201902,203188,204474,
76 205760,207046,208332,209618,210904,212190,213476,214762,
77 216048,217334,218620,219906,221192,222478,223764,225050,
78 226336,227622,228908,230194,231480,232766,234052,235338,
79 236624,237910,239196,240482,241768,243054,244340,245626,
80 246912,248198,249484,250770,252056,253342,254628,255914,
81 257200,258486,259772,261058,262344,263630,264916,266202,
82 267488,268774,270060,271346,272632,273918,275204,276490,
83 277776,279062,280348,281634,282920,284206,285492,286778,
84 288064,289350,290636,291922,293208,294494,295780,297066,
85 298352,299638,300924,302210,303496,304782,306068,307354,
86 308640,309926,311212,312498,313784,315070,316356,317642,
87 318928,320214,321500,322786,324072,325358,326644,327930
90 const int FloydMap[256] =
92 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
93 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
94 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
95 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
96 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
97 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
98 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
99 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
101 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
102 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
103 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
104 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
105 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
106 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
107 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
110 constexpr int FloydErrMap[256]
111 = { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
112 52, 53, 54, 55, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
113 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
114 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
115 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
116 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 5, 6, 7, 8,
117 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
118 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
119 53, 54, 55, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
120 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
121 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
122 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 };
124 constexpr int FloydError1[61] =
126 -7680, -7424, -7168, -6912, -6656, -6400, -6144,
127 -5888, -5632, -5376, -5120, -4864, -4608, -4352,
128 -4096, -3840, -3584, -3328, -3072, -2816, -2560,
129 -2304, -2048, -1792, -1536, -1280, -1024, -768,
130 -512, -256, 0, 256, 512, 768, 1024, 1280, 1536,
131 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584,
132 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632,
133 5888, 6144, 6400, 6656, 6912, 7168, 7424, 7680
136 constexpr int FloydError3[61] =
138 -23040, -22272, -21504, -20736, -19968, -19200,
139 -18432, -17664, -16896, -16128, -15360, -14592,
140 -13824, -13056, -12288, -11520, -10752, -9984,
141 -9216, -8448, -7680, -6912, -6144, -5376, -4608,
142 -3840, -3072, -2304, -1536, -768, 0, 768, 1536,
143 2304, 3072, 3840, 4608, 5376, 6144, 6912, 7680,
144 8448, 9216, 9984, 10752, 11520, 12288, 13056,
145 13824, 14592, 15360, 16128, 16896, 17664, 18432,
146 19200, 19968, 20736, 21504, 22272, 23040
149 constexpr int FloydError5[61] =
151 -38400, -37120, -35840, -34560, -33280, -32000,
152 -30720, -29440, -28160, -26880, -25600, -24320,
153 -23040, -21760, -20480, -19200, -17920, -16640,
154 -15360, -14080, -12800, -11520, -10240, -8960,
155 -7680, -6400, -5120, -3840, -2560, -1280, 0,
156 1280, 2560, 3840, 5120, 6400, 7680, 8960, 10240,
157 11520, 12800, 14080, 15360, 16640, 17920, 19200,
158 20480, 21760, 23040, 24320, 25600, 26880, 28160,
159 29440, 30720, 32000, 33280, 34560, 35840, 37120,
160 38400
163 constexpr int FloydError7[61] =
165 -53760, -51968, -50176, -48384, -46592, -44800,
166 -43008, -41216, -39424, -37632, -35840, -34048,
167 -32256, -30464, -28672, -26880, -25088, -23296,
168 -21504, -19712, -17920, -16128, -14336, -12544,
169 -10752, -8960, -7168, -5376, -3584, -1792, 0,
170 1792, 3584, 5376, 7168, 8960, 10752, 12544, 14336,
171 16128, 17920, 19712, 21504, 23296, 25088, 26880,
172 28672, 30464, 32256, 34048, 35840, 37632, 39424,
173 41216, 43008, 44800, 46592, 48384, 50176, 51968,
174 53760
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */