.. CS116 documentation master file, created by
   sphinx-quickstart on Mon Mar  4 10:37:08 2019.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Pixel
=====

A pixel is a single dot of `color <color.html>`_ in a picture. 

It contains an x and y location, with (0, 0) at the top left of the picture. 

It contains a color object which has red, green, and blue values between 0 and 255 (inclusive).


Example Usage
-------------

.. code:: python
   
   myBluePixel = Pixel(0, 0, red=0, green=0, blue=255)
   pixels = picture.getPixels()
   pixels[0] = myBluePixel

Initialization
--------------

.. py:function:: Pixel.Pixel(self, x, y, red, green, blue)
   
   :param int x: horizontal location of pixel.
   :param int y: vertical location of pixel.
   :param int red: degree of redness of pixel. Between 0 and 255 inclusive.
   :param int green: degree of greenness of pixel. Between 0 and 255 inclusive.
   :param int blue: degree of blueness of pixel. Between 0 and 255 inclusive.


Methods
-------


Getters
-------

Return the x value of a pixel.

.. py:function:: Pixel.getX(self)

.. code:: python

   pixel = picture.getPixel(200, 10)
   
   # This will print 200.
   print(pixel.getX())

Return the y value of a pixel.

.. py:function:: Pixel.getY(self)

.. code:: python

   pixel = picture.getPixel(200, 10)
   
   # This will print 10.
   print(pixel.getY())
   
This function returns the Color object of the pixel.

.. py:function:: Pixel.getColor(self)

.. code:: python

   color = pixel.getColor()

These functions return the red, green, and blue values of the pixel.
   
.. py:function:: Pixel.getRed(self)

.. code:: python
   
   red = pixel.getRed()

.. py:function:: Pixel.getGreen(self)

.. code:: python
   
   green = pixel.getGreen()
   
.. py:function:: Pixel.getBlue(self)

.. code:: python
   
   blue = pixel.getBlue()
   
Setters
-------

These functions allow you to set the color values of a pixel.

.. py:function:: Pixel.setRed(self, red)

   :param int red: between 0 and 255 (inclusive).

.. code:: python

   pixel.setRed(red)
   
.. py:function:: Pixel.setGreen(self, green)

   :param int green: between 0 and 255 (inclusive).

.. code:: python
   
   pixel.setGreen(green)
   
.. py:function:: Pixel.setBlue(self, blue)

   :param int blue: between 0 and 255 (inclusive).

.. code:: python
   
   pixel.setBlue(blue)

