#include "GraphicPrimitive.h"
#include "../util/mathUtils.h"

GraphicPrimitive::GraphicPrimitive ()
{
  refCount = 0;

  shapeType = "none";
  colorR=0;
  colorG=0;
  colorB=0;
  alphaChannel=255;
  filled=false;
  antiAliased=false;
  xCoords.clear();
  yCoords.clear();
  otherShapeData.clear();
}

GraphicPrimitive::~GraphicPrimitive ()
{
}


void GraphicPrimitive::incRefCount ()
{
  if (refCount < 2 ^ 32)
    refCount ++;
}

void GraphicPrimitive::decRefCount ()
{
  if (refCount > 0)
    refCount --;
}

uint32_t GraphicPrimitive::getRefCount ()
{
  return refCount;
}

const string & GraphicPrimitive::getShapeType ()
{
  return shapeType;
}

void GraphicPrimitive::setShapeType (const string & shape)
{
  shapeType = shape;
}

uint8_t GraphicPrimitive::getColorR()
{
  return colorR;
}

void GraphicPrimitive::setColorR (uint8_t r)
{
  colorR = r;
}

uint8_t GraphicPrimitive::getColorG()
{
  return colorG;
}

void GraphicPrimitive::setColorG (uint8_t g)
{
  colorG = g;
}

uint8_t GraphicPrimitive::getColorB()
{
  return colorB;
}

void GraphicPrimitive::setColorB (uint8_t b)
{
  colorB = b;
}

uint8_t GraphicPrimitive::getAlpha()
{
  return alphaChannel;
}

void GraphicPrimitive::setAlpha (uint8_t a)
{
  alphaChannel = a;
}

bool GraphicPrimitive::getFilled ()
{
  return filled;
}

void GraphicPrimitive::setFilled (bool f)
{
  filled = f;
}

bool GraphicPrimitive::getAntiAliased ()
{
  return antiAliased;
}

void GraphicPrimitive::setAntiAliased (bool aa)
{
  antiAliased = aa;
}

vector <int16_t> & GraphicPrimitive::getXCoords()
{
  return xCoords;
}

void GraphicPrimitive::pushXCoord(int16_t data)
{
  xCoords.push_back(data);
}

vector <int16_t> & GraphicPrimitive::getYCoords()
{
  return yCoords;
}

void GraphicPrimitive::pushYCoord(int16_t data)
{
  yCoords.push_back(data);
}

vector <int16_t> & GraphicPrimitive::getOtherShapeData()
{
  return otherShapeData;
}

void GraphicPrimitive::pushOtherShapeData(int16_t data)
{
  otherShapeData.push_back(data);
}

void GraphicPrimitive::fillXCoords(vector<int>& t)
{
  t.clear();

  for (int i = 0; i < int(xCoords.size()); i ++)
    {
      t.push_back(xCoords[i]);
    }
}

void GraphicPrimitive::fillYCoords(vector<int>& t)
{
  t.clear();

  for (int i = 0; i < int(xCoords.size()); i ++)
    {
      t.push_back(yCoords[i]);
    }
}

void GraphicPrimitive::fillOtherShapeData(vector<int>& t)
{
  t.clear();

  for (int i = 0; i < int(otherShapeData.size()); i ++)
    {
      t.push_back(otherShapeData[i]);
    }
}
