# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

# A color in RGBA format
class Color(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = Color()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsColor(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # Color
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Red value between 0 and 1
    # Color
    def R(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 1.0

    # Green value between 0 and 1
    # Color
    def G(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 1.0

    # Blue value between 0 and 1
    # Color
    def B(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 1.0

    # Alpha value between 0 and 1
    # Color
    def A(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 1.0

def ColorStart(builder): builder.StartObject(4)
def Start(builder):
    return ColorStart(builder)
def ColorAddR(builder, r): builder.PrependFloat64Slot(0, r, 1.0)
def AddR(builder, r):
    return ColorAddR(builder, r)
def ColorAddG(builder, g): builder.PrependFloat64Slot(1, g, 1.0)
def AddG(builder, g):
    return ColorAddG(builder, g)
def ColorAddB(builder, b): builder.PrependFloat64Slot(2, b, 1.0)
def AddB(builder, b):
    return ColorAddB(builder, b)
def ColorAddA(builder, a): builder.PrependFloat64Slot(3, a, 1.0)
def AddA(builder, a):
    return ColorAddA(builder, a)
def ColorEnd(builder): return builder.EndObject()
def End(builder):
    return ColorEnd(builder)