Comments (6)
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.
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.
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.
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.
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.
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)
- May ForImage utilize FIG features? HOT 2
- Design of a plotting library HOT 8
- Segmentation faults HOT 8
- Create `drawing` class
- Handling optional properties of shapes HOT 1
- add topic tags HOT 1
- Primitives support HOT 1
- Miscellaneous HOT 1
- License HOT 1
- Coordinate space design HOT 4
- Area filling HOT 4
- fig_draw_pixel HOT 3
- support for image file drivers HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fig.