def calculate_grid_points(size, buffer, bars_per_line, lines_per_page):
    """
    Calculates and returns two lists.
    The first list consists of x-coordinates of all bar lines.
    The second list consists of y-coordinates of all center staff lines.
    
    Parameters
    ----------
    size : 2-tuple of ints
        Pixel size of the output image (X,Y).
    buffer : int
        Size of white space on all sides of the output image, in pixels.
    bars_per_line : int
    lines_per_page : int
    """
    x_list = []
    y_list = []
    for i in range(bars_per_line + 1):
        x_list.append(buffer + i * (size[0]-2*buffer) / bars_per_line)
    for i in range(lines_per_page):
        y_list.append(buffer 
                      + ((size[1]-2*buffer) / lines_per_page)/2
                      + i*(size[1]-2*buffer) / lines_per_page)
    return x_list, y_list