Determine if a point is inside or ouside of an irregular shape on a bitmap So this is my task:

You are given an irregular shape on a bitmap. How do you determine if
a point is inside or ousdie of the shape?

We are allowed to assume that helper functions are already available for us and we don't need to write them as well.
So I decided that I can use a function that returns me the status of a given bit on that bitmap.
int IsBitIsOn(bitmap_ty *bitmap, size_t x, size_t y);

We also can assume that the given point won't be a point on the outline of the shape. Which means the given X,Y coordinates must be either inside or outside the shape and not on one of the outlines.
And here is my full code of the task,
I wrote it as a bitmap that every ON(==1) bit tells me that I'm on an outline, while 0 bit tells me i'm either inside or outside the shape.
int IsInTheShape(bitmap_ty *bitmap, size_t x, size_t y)
{
    int IsIn = 0; /* flag of whether the given point is inside the shape    */
    
    int ComeFromAbove = 0;
    
    int start_sequal = 1;
    
    size_t curr_row = y;
    size_t curr_column = 0;
    
    while (x != curr_column)
    {
        if (IsBitIsOn(bitmap, curr_column, curr_row))
        {
            IsIn = !IsIn;
            
            /* starts a sequal of bits that are ON  */
            while (IsBitIsOn(bitmap, curr_column + 1, curr_row))
            {
                /* checks the source direction of the first bit in the sequal */
                if (start_sequal &amp;&amp;
                    IsBitOn(bitmap, curr_column, curr_row - 1) ||
                    isBitOn(bitmap, curr_column - 1, curr_row - 1) ||
                    isBitOn(bitmap, curr_column + 1, curr_row - 1))
                {
                    ComeFromAbove = 1;
                    start_sequal = 0;
                }
                ++curr_column;
            }
            /*  checks the source direction of the last bit in the sequal,
                so if it cuts the direction of the first bit, it means
                the next points are out of the shape    */
            if (ComeFromAbove)
            {
                if (!IsBitOn(bitmap, curr_column, curr_row + 1) &amp;&amp;
                    !isBitOn(bitmap, curr_column - 1, curr_row + 1) &amp;&amp;
                    !isBitOn(bitmap, curr_column + 1, curr_row + 1))
                {
                    ComeFromAbove = 0;
                    IsIn = !IsIn;
                }
            }
        }
        ++curr_column;
    }
    
    return (IsIn);  
}

I draw the following shapes find the problematic points and shapes:
If shape on bitmap is not filled and only one shape present on bitmap:
Start at point (x,y). For each of the four directions (left, right, top, bottom), keep going until either IsBitIsOn is true or a border of the bitmap has been reached. In the former case, point is in shape. Else (if border of bitmap reached), point is not in shape.
Pseudocode:
def IsInTheShape(x, y):
  curr_x = x
  curr_y = y
  # Check left
  while curr_x &gt;= -1:
    if (curr_x == -1):
      return false
    if IsBitIsOn(curr_x, y):
      break

  curr_x = x
  curr_y = y
  # Check right
  while curr_x &lt;= bitmap.width + 1:
    if (curr_x == bitmap.width + 1):
      return false
    if IsBitIsOn(curr_x, y):
      break

  # Check top
  # Check bottom

  # All directions hit IsBitIsOn, so must be in shape
  return true

If shape on bitmap is not filled and one or multiple shapes are present on bitmap:
Same as above, but once an outline has been reached, check all connected outline pieces recursively until the starting point has been reached. If the traversal around the outline visits all of the other outlines from the other three directions, then point is inside shape.
If shape on bitmap is filled:
Suppose that we want to check if (x,y) is in shape. Let (x,y) be cell E in the following grid:
+---+---+---+
| A | B | C |
+---+---+---+
| D | E | F |
+---+---+---+
| G | H | I |
+---+---+---+

Case 1 (point trivially not in shape):

Point is not in shape if E is off: if not IsBitIsOn(E): return false

Case 2 (point not in shape):

Point is not in shape if any of the 8 surrounding bits around E is off:

if not (IsBitIsOn(A) and IsBitIsOn(B) and IsBitIsOn(C) and IsBitIsOn(D) and IsBitIsOn(F) and IsBitIsOn(G) and IsBitIsOn(H) and IsBitIsOn(I)): return false

Case 3 (point in shape):

Point is all of the 8 surrounding bits around E is on:

else: return true

All together, the pseudocode is:
if not IsBitIsOn(E):
  return false
else if not (IsBitIsOn(A) and IsBitIsOn(B) and IsBitIsOn(C) and IsBitIsOn(D) and IsBitIsOn(F) and IsBitIsOn(G) and IsBitIsOn(H) and IsBitIsOn(I)):
  return false
else:
  return true