public static bool clip_move_point(int x1, int y1, int x2, int y2,
RectangleI clip_box,
ref int x, ref int y, int flags)
{
int bound;
if ((flags & (int)clipping_flags_e.clipping_flags_x_clipped) != 0)
{
if (x1 == x2)
{
return false;
}
bound = ((flags & (int)clipping_flags_e.clipping_flags_x1_clipped) != 0) ? clip_box.x1 : clip_box.x2;
y = (int)((double)(bound - x1) * (y2 - y1) / (x2 - x1) + y1);
x = bound;
}
flags = clipping_flags_y(y, clip_box);
if ((flags & (int)clipping_flags_e.clipping_flags_y_clipped) != 0)
{
if (y1 == y2)
{
return false;
}
bound = ((flags & (int)clipping_flags_e.clipping_flags_x1_clipped) != 0) ? clip_box.y1 : clip_box.y2;
x = (int)((double)(bound - y1) * (x2 - x1) / (y2 - y1) + x1);
y = bound;
}
return true;
}