176 { |
176 { |
177 return colorTable[color].faceColor; |
177 return colorTable[color].faceColor; |
178 } |
178 } |
179 } |
179 } |
180 |
180 |
|
181 QColor ldraw::colorEdge(ldraw::Color color, const ldraw::ColorTable& colorTable) |
|
182 { |
|
183 if (isDirectColor(color)) |
|
184 { |
|
185 QColor const faceColor = directColorFace(color); |
|
186 return (luma(faceColor) < 0.4) ? Qt::white : Qt::black; |
|
187 } |
|
188 else |
|
189 { |
|
190 return colorTable[color].faceColor; |
|
191 } |
|
192 } |
|
193 |
181 /** |
194 /** |
182 * @brief Writes a color index into a @c QDataStream |
195 * @brief Writes a color index into a @c QDataStream |
183 * @param stream |
196 * @param stream |
184 * @param color |
197 * @param color |
185 * @returns stream |
198 * @returns stream |
197 */ |
210 */ |
198 QDataStream& operator>>(QDataStream& stream, ldraw::Color& color) |
211 QDataStream& operator>>(QDataStream& stream, ldraw::Color& color) |
199 { |
212 { |
200 return stream >> color.index; |
213 return stream >> color.index; |
201 } |
214 } |
|
215 |
|
216 QString ldraw::colorDisplayName(ldraw::Color color, const ldraw::ColorTable &colorTable) |
|
217 { |
|
218 if (isDirectColor(color)) |
|
219 { |
|
220 return directColorFace(color).name(); |
|
221 } |
|
222 else |
|
223 { |
|
224 return colorTable[color].displayName; |
|
225 } |
|
226 } |