bool isInsideWithMargin(point, width, height, margin) {
    return point.x > (width -margin) || point.x < (margin) || point.y > (height -margin) || point.y < margin;
}

OR

bool isInsideWithMargin = point.x > (width -10) || point.x < (10) || point.y > (height -10) || point.y < 10;
if(isInsideWithMargin) {
....