Giving the best group to black and white
This commit is contained in:
parent
57b9ef69f5
commit
c5408f7bee
Binary file not shown.
|
@ -58,10 +58,11 @@ namespace RgbToHires {
|
|||
|
||||
pair<BlockHr::eColorGroup, BlockHr::eColorGroup> BlockHr::getGroup(const BlockPixel& block) const
|
||||
{
|
||||
pair<eColorGroup, eColorGroup> groups{ GROUP_1, GROUP_1 };
|
||||
pair<eColorGroup, eColorGroup> groups{ UNDEF, UNDEF };
|
||||
//1st block group, including the last semi-pixel
|
||||
for (auto i = 0u; i < 4u; ++i) {
|
||||
if (block[i] == GREEN || block[i] == VIOLET) {
|
||||
groups.first = GROUP_1;
|
||||
break;
|
||||
}
|
||||
else if (block[i] == ORANGE || block[i] == BLUE) {
|
||||
|
@ -72,6 +73,7 @@ namespace RgbToHires {
|
|||
//2nd block group, excluding the first semi-pixel
|
||||
for (auto i = 4u; i < 7u; ++i) {
|
||||
if (block[i] == GREEN || block[i] == VIOLET) {
|
||||
groups.second = GROUP_1;
|
||||
break;
|
||||
}
|
||||
else if (block[i] == ORANGE || block[i] == BLUE) {
|
||||
|
@ -79,6 +81,17 @@ namespace RgbToHires {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// if only black or white pixel: groups are still undefined
|
||||
if (groups.first == UNDEF) { // 1st 3.5-pixels were black or white
|
||||
groups.first = groups.second;
|
||||
}
|
||||
if (groups.second == UNDEF) { // 2nd 35-pixels were black or white
|
||||
groups.second = groups.first;
|
||||
}
|
||||
if (groups.first == UNDEF) { // all the 7-pixels were black or white
|
||||
groups.first = GROUP_1;
|
||||
groups.second = GROUP_1;
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,8 @@ namespace RgbToHires
|
|||
/// @brief color group as defined in Apple's documentation
|
||||
enum eColorGroup {
|
||||
GROUP_1,
|
||||
GROUP_2
|
||||
GROUP_2,
|
||||
UNDEF // black and white can be group1 or group2
|
||||
};
|
||||
/// @brief Returns the color group of these two 3.5 pixel blocks
|
||||
std::pair<eColorGroup, eColorGroup> getGroup(const BlockPixel&) const;
|
||||
|
|
Loading…
Reference in New Issue