有没有一种简单的方法来判断两个字符/符号是否重叠?
问题描述:
我想要的是比字符/符号矩形更精致的东西,我想仅在黑色部分触摸时才检测到重叠,以便可以在任意位置和尽可能靠近的位置绘制自定义符号,甚至可能重叠.
使用路径是否可以让人们检测字符/符号是否重叠,并且有一些真正简单的代码吗?在我的搜索中似乎找不到任何内容.谢谢.
What I want is something more refined than just the character/symbol rect, I want to detect overlapping only when the black parts touch so that custom symbols could be drawn at any position and a close as possible, possibly even allowed to overlap.
Would using paths allow one to detect whether the characters/symbols overlap and is there some really simple code? Can''t seem to find any in my searches. Thanks.
答
好吧,如果两个位模式重叠,则它们之间的按位XOR(^
)和OR(|
)操作将得出不同的结果.
可能是一个起点.
Well, if two bit patterns overlap, then the bitwise XOR (^
) and OR (|
) operations between them give different results.
It may be a starting point.
if (CountOfBlackBits(hBmpComposed) <
CountOfBlackBits(hBmpA) +
CountOfBlackBits(hBmpB)) {
// yes :)
...
}