def _get_shaperecords(self, num_fill_bits,
                          num_line_bits, shape_number):
        """Return an array of SHAPERECORDS."""
        shape_records = []
        bc = BitConsumer(self._src)

        while True:
            type_flag = bc.u_get(1)
            if type_flag:
                # edge record
                straight_flag = bc.u_get(1)
                num_bits = bc.u_get(4)
                if straight_flag:
                    record = _make_object('StraightEdgeRecord')
                    record.TypeFlag = 1
                    record.StraightFlag = 1
                    record.NumBits = num_bits
                    record.GeneralLineFlag = general_line_flag = bc.u_get(1)
                    if general_line_flag:
                        record.DeltaX = bc.s_get(num_bits + 2)
                        record.DeltaY = bc.s_get(num_bits + 2)
                    else:
                        record.VertLineFlag = vert_line_flag = bc.s_get(1)
                        if vert_line_flag:
                            record.DeltaY = bc.s_get(num_bits + 2)
                        else:
                            record.DeltaX = bc.s_get(num_bits + 2)
                else:
                    record = _make_object('CurvedEdgeRecord')
                    record.TypeFlag = 1
                    record.StraightFlag = 0
                    record.NumBits = num_bits
                    record.ControlDeltaX = bc.s_get(num_bits + 2)
                    record.ControlDeltaY = bc.s_get(num_bits + 2)
                    record.AnchorDeltaX = bc.s_get(num_bits + 2)
                    record.AnchorDeltaY = bc.s_get(num_bits + 2)

            else:
                # non edge record
                record = _make_object('StyleChangeRecord')
                record.TypeFlag = 0

                five_bits = [bc.u_get(1) for _ in range(5)]
                if not any(five_bits):
                    # the five bits are zero, this is an EndShapeRecord
                    break

                # we're not done, store the proper flags
                (record.StateNewStyles, record.StateLineStyle,
                    record.StateFillStyle1, record.StateFillStyle0,
                    record.StateMoveTo) = five_bits

                if record.StateMoveTo:
                    record.MoveBits = move_bits = bc.u_get(5)
                    record.MoveDeltaX = bc.s_get(move_bits)
                    record.MoveDeltaY = bc.s_get(move_bits)
                if record.StateFillStyle0:
                    record.FillStyle0 = bc.u_get(num_fill_bits)
                if record.StateFillStyle1:
                    record.FillStyle1 = bc.u_get(num_fill_bits)
                if record.StateLineStyle:
                    record.LineStyle = bc.u_get(num_line_bits)

                if record.StateNewStyles:
                    record.FillStyles = self._get_struct_fillstylearray(
                        shape_number)
                    record.LineStyles = self._get_struct_linestylearray(
                        shape_number)
                    # these two not only belong to the record, but also
                    # modifies the number of bits read in the future
                    # if shape number bigs enough (didn't find this in the
                    # spec, but works for now, maybe '2' is not the limit...)
                    if shape_number > 2:
                        record.NumFillBits = num_fill_bits = bc.u_get(4)
                        record.NumLineBits = num_line_bits = bc.u_get(4)
                    else:
                        record.NumFillBits = bc.u_get(4)
                        record.NumLineBits = bc.u_get(4)

                    # reset the BC here, as the structures just read work at
                    # byte level
                    bc = BitConsumer(self._src)

            shape_records.append(record)
        return shape_records
Return an array of SHAPERECORDS.