Nitrogen Fingers Paint
GoodClover (Talk | contribs) m (→Format: spelling) |
GoodClover (Talk | contribs) (Pixel aspect ratio / Character Mode) |
||
Line 11: | Line 11: | ||
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 == | ||
Line 24: | Line 23: | ||
Whilst any unrecognised character is treated as a transparent pixel, it is recommended that a space be used. | 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 space when saved. | + | CraftOS's <code>paint</code> program automatically converts all transparent pixels to a space when saved. |
=== Colours === | === Colours === | ||
Line 31: | Line 30: | ||
It is recommended that a lookup table be generated for performance. | 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 == |
Revision as of 16:00, 13 March 2021
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 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.
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.
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.
Example
NFP | PNG | PNG (nonsquare) |
---|---|---|
|
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)