Nitrogen Fingers Paint

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Example)
(Colours)
Line 25: Line 25:
 
Whilst any unrecognised character is treaded as a transparent pixel, it is recommended that a space be used.
 
Whilst any unrecognised character is treaded as a transparent pixel, it is recommended that a space be used.
  
 +
=== Colours ===
 +
 +
To calculate a colour for a given value do <code>2<sup>x</sup></code> and then treat it as a 24-bit RGB value (8 bits for each of red, green and blue).
 +
 +
It is recommended that a lookup table be generated for performance.
  
 
== Example ==
 
== Example ==
Line 52: Line 57:
  
 
* [https://github.com/SquidDev-CC/CC-Tweaked/blob/66e42e0817484702d3be7ab880e60246097f7ecb/src/main/resources/data/computercraft/lua/rom/apis/paintutils.lua#L50 ComputerCraft:Tweaked's CraftOS paintutils Implementation (lua)]
 
* [https://github.com/SquidDev-CC/CC-Tweaked/blob/66e42e0817484702d3be7ab880e60246097f7ecb/src/main/resources/data/computercraft/lua/rom/apis/paintutils.lua#L50 ComputerCraft:Tweaked's CraftOS paintutils Implementation (lua)]
 +
*: ''Note:'' Lua lists start at 1 so <code>2<sup>x-1</sup></code> is used when generating the lookup table.
 
* [https://tweaked.cc/module/colors.html ComputerCraft:Tweaked Wiki's Colour table] (Paint/Blit column)
 
* [https://tweaked.cc/module/colors.html ComputerCraft:Tweaked Wiki's Colour table] (Paint/Blit column)
  
  
 
[[Category:ComputerCraft]]
 
[[Category:ComputerCraft]]

Revision as of 14:24, 13 March 2021

File Format
Name NFP
Ontology
Extension(s) .nfp
Compression None
Reference Implementation CC:T's paintutils (lua)
Error Resilience None
NFP[Stands for?] is a simple text file format used by ComputerCraft to store images.

CraftOS's paint program allows for easy editing of these files with a GUI.


Contents

Format

An NFP file consists of a text file containing a hex character for each pixel.

Each pixel's character must be in the range 0-f and be lowercase, any other characters (including capital A-F) are treated as fully transparent pixels.

The newline (\n) character moves to the beginning of the next row.[End file with newline or not?] Due to the nature of this, it is possible to have rows of different length and therefore means that nonsquare images can be created.

Whilst any unrecognised character is treaded as a transparent pixel, it is recommended that a space be used.

Colours

To calculate a colour for a given value do 2x and then treat it as a 24-bit RGB value (8 bits for each of red, green and blue).

It is recommended that a lookup table be generated for performance.

Example

house.nfp NFP transparent.png represents a transparent pixel.
NFP PNG PNG (nonsquare)
        c␤
   eeeeec␤
  eeeeeee␤
 eeeeeeeee␤
  ccccccc␤
  c33cc5c␤
  ccccc5c␤
fffffffffff␤

NFP house.png NFP house nonsquare.png

External links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox