Giter Site home page Giter Site logo

lzs4073 / color Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmilos/color

0.0 2.0 0.0 1.35 MB

C++ library thats implemets class color. Available models: RGB, HSL, HSV, CMY, CMYK, YIQ, YUV and growing.

License: Apache License 2.0

C++ 98.40% Shell 0.16% Python 0.12% HTML 1.31%

color's Introduction

Yet another c++ library that implements color.

Status: Very close to the first milestone.

Key features:

  • No virtual functions
  • Minimal memory footprint
  • Ability to copy array/vector of colours with memcpy, memmove, initialize with memset.
  • Conversions from/to different types ( and its formats ).
  • Headers only
  • No third parties
  • No additional binaries
  • One file to include to start the fun
  • Out of the box ready
  • No need to recompile or start some install process.
  • Color models: CMY, CMYK, GRAY, HSL, HSV, RGB, XYZ, YIQ, YUV.

Code sample:

        color::rgb<float>         f( { 1.0, 0.55, 0.0 } ); //!< This will pack ONLY three consecutive floats in memory
        color::rgb<std::uint8_t>  u( { 127,  255, 212 } ); //!< Three consecutive std::uint8_t.

        f = u; //!< Perform direct conversion from uint8_t to float.

        color::rgb<double>        d( { 0.1, 0.2, 0.3  } );

        f = d; //!< Reformat RGB from double to float
        u = f; //!< Reformat RGB from float to uint8_t

        color::hsl<std::uint8_t>  h( { 192, 64, 92  } );

        h = f; //!< This is the way how to convert from RGB(float) to HSL(std::uint8_t).

Implemented Conversions:

l = r cmy cmyk gray hsl hsv rgb xyz yiq yuv
cmy
cmyk
gray
hsl
hsv
rgb
xyz
yiq
yuv

Available Color Formats

bool
Each component is one bool.
uint8_t
Each component will be type uint8_t. Usual color storing precision.
uint16_t
Each component will be type uint16_t. For more precision.
uint32_t
Each component will be type uint32_t. For higher.
uint64_t
Each component will be type uint64_t.For the highest precision in unsigned format.
float
Each component will be type float.
double
Each component will be type double.
long double
Each component will be type long double. Best precision of all.

Want to see more

color's People

Contributors

dmilos 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.