图像相交

Lit*_*per 1 delphi image delphi-7 intersect

我如何知道我的两张图像何时交叉?

klu*_*udg 5

如果我找对你

function IsIntersertButNotContained(const R1, R2: TRect): Boolean;
var
  R: TRect;

begin
// R1 and R2 intersect
  Result:= IntersectRect(R, R1, R2)
//   R1 is not contained within R2
    and not EqualRect(R, R1)
//   R2 is not contained within R1
    and not EqualRect(R, R2);
end;
Run Code Online (Sandbox Code Playgroud)

  • 可能是我错了,但我们真的需要UnionRect吗?如果另一个包含一个矩形,则IntersectRect应返回内部矩形,并且EqualRect的检查应该足够. (3认同)