Nitrogen Fingers Paint
GoodClover (Talk | contribs) m |
GoodClover (Talk | contribs) m (P stands for "Paint") |
||
(14 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{FormatInfo | {{FormatInfo | ||
− | | name = | + | | name = Nitrogen Fingers Paint |
| formattype = electronic | | formattype = electronic | ||
+ | | subcat = Graphics | ||
| extensions = {{ext|nfp}} | | extensions = {{ext|nfp}} | ||
| compression = None | | compression = None | ||
Line 8: | Line 9: | ||
}} | }} | ||
− | [[ | + | [[Nitrogen Fingers Paint]] (NFP) is a simple [[text]] file format used by [https://computercraft.cc ComputerCraft] to store images. |
CraftOS's <code>paint</code> program allows for easy editing of these files with a GUI. | CraftOS's <code>paint</code> program allows for easy editing of these files with a GUI. | ||
− | |||
== Format == | == Format == | ||
− | + | An NFP file consists of a text file containing a [[wikipedia:hexadecimal|hex]] character for each pixel. | |
− | ' | + | Each pixel's character must be in the range <abbr title="0123456789abcdef"><code>0-f</code></abbr> and be lowercase, |
+ | any other characters (including capital <abbr title="ABCDEF"><code>A-F</code></abbr>) are treated as fully transparent pixels. | ||
+ | The newline (<code>\n</code>) character moves to the beginning of the next row.{{fix|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 treated as a transparent pixel, it is recommended that a space be used. | ||
+ | CraftOS's <code>paint</code> program automatically converts all transparent pixels to a space when saved. | ||
+ | |||
+ | === 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. | ||
+ | |||
+ | === Pixel aspect ratio === | ||
+ | |||
+ | CraftOS's <code>paintutils</code> library (and therefore <code>paint</code>) uses character mode for displaying images, meaning one image "pixel" is a character cell. | ||
+ | Character cells are at a 2:3 aspect ratio, 12×18 real pixels in size. | ||
== Example == | == Example == | ||
Line 24: | Line 41: | ||
{| | {| | ||
|+<code>house.nfp</code> | |+<code>house.nfp</code> | ||
+ | |+''[[File:NFP_transparent.png]] represents a transparent pixel.'' | ||
|- | |- | ||
! NFP !! PNG !! PNG (nonsquare) | ! NFP !! PNG !! PNG (nonsquare) | ||
|- | |- | ||
|<code><pre> | |<code><pre> | ||
− | + | c | |
− | + | eeeeec | |
− | + | eeeeeee | |
− | + | eeeeeeeee | |
− | + | ccccccc | |
− | + | c33cc5c | |
− | + | ccccc5c | |
− | + | fffffffffff | |
</pre></code> | </pre></code> | ||
''<code></code> | ''<code></code> | ||
Line 41: | Line 59: | ||
|| [[File:NFP_house_nonsquare.png]] | || [[File:NFP_house_nonsquare.png]] | ||
|} | |} | ||
− | |||
== External links == | == External links == | ||
* [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) | ||
+ | * [https://github.com/oeed/CraftOS-Standards/blob/master/standards/4-paint.md CraftOS-Standards] (Poorly documented) | ||
+ | |||
+ | |||
+ | [[Category:ComputerCraft]] | ||
+ | [[Category:File formats named after chemical elements]] |
Latest revision as of 13:22, 14 March 2021
Nitrogen Fingers Paint (NFP) 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 |
[edit] 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 treated as a transparent pixel, it is recommended that a space be used.
CraftOS's paint
program automatically converts all transparent pixels to a space when saved.
[edit] 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.
[edit] Pixel aspect ratio
CraftOS's paintutils
library (and therefore paint
) uses character mode for displaying images, meaning one image "pixel" is a character cell.
Character cells are at a 2:3 aspect ratio, 12×18 real pixels in size.
[edit] Example
NFP | PNG | PNG (nonsquare) |
---|---|---|
|
[edit] External links
- ComputerCraft:Tweaked's CraftOS paintutils Implementation (lua)
- Note: Lua lists start at 1 so
2x-1
is used when generating the lookup table.
- Note: Lua lists start at 1 so
- ComputerCraft:Tweaked Wiki's Colour table (Paint/Blit column)
- CraftOS-Standards (Poorly documented)