Giter VIP home page Giter VIP logo

arduino_colortools's Introduction

AVB Color tools

Libreria para trabajar con animacion(HSV) de colores de forma sensilla.

##Que incluye? Por el momento 2 estructuras de datos(RGB y HSV) que representan el modelo RGB y HSV Estos tienen sobrecarga de operadores para que puedas pasar de uno a otro con solo hacer un =

Algunos ejemplos del uso para demostrar la simplicidad y entender como usarlo.

Para que?

Cuando ocupas hacer cambios de color de forma mas sencilla usar el modelo de color HSV(https://en.wikipedia.org/wiki/HSL_and_HSV) es mas conveniente(desde mi perspectiva) Y por que convertir a RGB, normalmente los pixeles, las tiras de leds, las matrices y las pantallas se basan el en modelo RGB.

Codigo

Estructuras de datos


class HSV {
  public:
    float h;
    // variable para Saturation, saturacion
    float s;
    // variable para Value, valor
    float v;

    //Constructor por defecto
    HSV();

    //Constructor con parametros
    HSV(float h,float s, float v);

    //Contructor de copia
    HSV(const HSV &otro);

    /**
    * Transforma del modelo de color HSV al modelo de color RGB.
    * @param HSV &input, entrada HSV a tranformar.
    * @param RGB *responce, salida RGB tranformado.
    **/
    void toRGB(RGB& otro);
    //Sobrecarga de operador =
    HSV& operator=(const HSV &otro);
    //Sobrecarga de operador =
    HSV& operator=(const RGB &otro);
    //Sobrecarga de operador =
    HSV& operator=(const uint32_t color);
};

class RGB {
  public:
    // variable para red, rojo
    uint8_t r;
    // variable para green, verde
    uint8_t g;
    // varialbe para blue, azul
    uint8_t b;

    //Contructor por defecto
    RGB();

    //Contructor con parametros
    RGB(uint8_t& r,uint8_t& g, uint8_t& b);

    //Contructor de copia
    RGB(const RGB &otro);

    /**
     * Transforma del modelo de color RGB al modelo de color HSV.
     * @param RGB &input, entrada RGB a tranformar.
     * @param HSV *responce, salida HSV tranformado.
     **/
    void toHSV(HSV& otro);

    //Sobrecarga de operador =
    RGB& operator=(const RGB &otro);
    //Sobrecarga de operador =
    RGB& operator=(const HSV &otro);
    //Sobrecarga de operador =
    RGB& operator=(const uint32_t color);

};

##Agradecimientos y atribución Esta biblioteca incluye los archivos NeoPixel.h NeoPixel.cpp & esp8266.c estos archivos son parte de la biblioteca Adafruit_NeoPixel, los archivos NeoPixel.h y NeoPixel.cpp fueron modificados para aceptar las estructuras HSV y RGB en la funcion setPixelColor.



Creative Commons License
AVB Color Tools by Alex Vargas Benamburg
is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

arduino_colortools's People

Contributors

mrakaki avatar per1234 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.