Giter Site home page Giter Site logo

Colors about fig HOT 6 CLOSED

perazz avatar perazz commented on August 16, 2024
Colors

from fig.

Comments (6)

johandweber avatar johandweber commented on August 16, 2024 1

I have now created a pull request including a module containg the
CSS/SVG colors as constants.

While I assume that this will have to be changed, it might be a first step.

from fig.

johandweber avatar johandweber commented on August 16, 2024 1

unsigned integers,l which are not supported by Fortran.

I think an easy solution that doesn't affect memory storage much would be to use 16-bit integers, but then of course only support the 0-255 range. Another option is to use an unsigned integer implementation like https://github.com/ShinobuAmasaki/uint-fortran

I have also implemented a small collection of functions that take a can take a value from a "larger" integer value and convert it into a "smaller" Fortran integer whose bit pattern corresponds to an unsigned value of the same size. It assumes that the data types follows twos' complement, which as far as I understand is the case for all modern CPUs.

https://github.com/johandweber/funsignedwrapper/tree/main

Unfortunately my solution is rather slow.

In contrast to the solution presented above it does not really support unsigned inter math, but is aimed at just generating the correct bit pattern (mainly for exchange with C libraries).

from fig.

johandweber avatar johandweber commented on August 16, 2024 1

Having thought about it, I think that for the current stage the mapping of the colors is handled well in fig_rgb.f90. Maybe I have been overemphasizing that topic because I think a bit too much in categories relevant for image processing.
Futhermore I noticed that the algorithms for the primitives are in principle independent of the color representation, so changing the used color model would not really be very detrimental to the project.

from fig.

johandweber avatar johandweber commented on August 16, 2024

Here some thoughts about the color depth

8 bit per color

[+] Saves memory space
[+] Completely sufficient for "output-only" tasks displaying things on the screen, preparing plots for a publication ...
[+] The "natural" color depth of the web (HTML-Colors, JPG, many traditional widget toolkits). Therefore (appart from possible bit shifts) no math is required to convert the internal representation
[-] Many general of scientific image formats (TIFF, Camera RAW Data, FITS) support, at least optionally, a higher bit depth. Therefore data from these file Formats can not be processed without losing data.
[-]- For scientific image processing 255 possible values per channel may be insufficient concerning the precision and/or the dynamic range

more than 8 bit (16 bit, 32 bit, floating point)

[+] Image data with more than 8 bit can be processed without information
[+] Converting down to 8 bits is still possible
[-] ... however transformations are required, so there is some performance penalty and additional coding to do
[-] The memory footprint is larger.

So I think the color depth of on the goals of the project, 8-bit is fully sufficient for plotting, but in my opinion not necessaryly for image manipulation.

Another Question
RGB values are a typical example of the use of unsigned integers,l which are not supported by Fortran.

There are several ways around like

  • Using a larger internal value range that is is used for the input and output (and the bit shifts)
  • Using some conversion routines like in my Fortran wrapper around the GD lib .
    I am not sure about that.

from fig.

perazz avatar perazz commented on August 16, 2024

unsigned integers,l which are not supported by Fortran.

I think an easy solution that doesn't affect memory storage much would be to use 16-bit integers, but then of course only support the 0-255 range.
Another option is to use an unsigned integer implementation like https://github.com/ShinobuAmasaki/uint-fortran

from fig.

AnonMiraj avatar AnonMiraj commented on August 16, 2024

I think this settles it for this issue. If there is something I missed, feel free to open the issue.
There is still a lot of talk about handling depth and other stuff, but I think it is better to focus on them later.

from fig.

Related Issues (14)

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.