AnimaEngine  1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
Macros | Functions
png_pipeline.h File Reference

Sprite sheet grid composition and PNG drawing pipeline. More...

#include "common.h"
#include "ppm.h"
#include "ncgr.h"
#include "nclr.h"
#include "ncer.h"

Go to the source code of this file.

Macros

#define PNG_PATH_BUFFER_SIZE   4096
 

Functions

int PngPipeline_TilePreview (const char *ncgr_path, const char *nclr_path, const char *out_path)
 Renders NCGR tiles in order to a standard PNG preview file. More...
 
int PngPipeline_CropToAlpha (const RgbaColor *pixels, int width, int height, RgbaColor **out_pixels, int *out_width, int *out_height)
 Crops transparent borders around a pixel frame buffer. More...
 
int PngPipeline_CroppedSprite (const char *ncgr_path, const char *nclr_path, const char *out_path)
 Renders the first cell frame from NCGR tiles, cropped to its alpha bounding box, and saves it. More...
 
int PngPipeline_ExactNcgr (const char *ncgr_path, const char *nclr_path, const char *out_path)
 Renders the exact tile character page layout defined by NCGR and exports as PNG. More...
 
int PngPipeline_CellPreviews (const char *ncgr_path, const char *ncer_path, const char *nclr_path, const char *out_dir)
 Renders all individual cells in NCGR as static PNGs. More...
 
int PngPipeline_CombineSideBySide (const RgbaColor *front, int front_w, int front_h, const RgbaColor *back, int back_w, int back_h, RgbaColor **out_combined, int *out_combined_w, int *out_combined_h)
 Stitches two RGBA images side-by-side into a single combined buffer. More...
 
int PngPipeline_CombineToGrid (const NcerFile *ncer, const NcgrImage *ncgr, const NclrPalette *palette, RgbaColor **out_combined, int *out_combined_w, int *out_combined_h)
 Recomposes and stitches all frames defined in NCER cells side-by-side in a single grid sheet. More...
 

Detailed Description

Sprite sheet grid composition and PNG drawing pipeline.

Macro Definition Documentation

◆ PNG_PATH_BUFFER_SIZE

#define PNG_PATH_BUFFER_SIZE   4096

Maximum buffer size for generating output PNG file paths.

Function Documentation

◆ PngPipeline_CellPreviews()

int PngPipeline_CellPreviews ( const char *  ncgr_path,
const char *  ncer_path,
const char *  nclr_path,
const char *  out_dir 
)

Renders all individual cells in NCGR as static PNGs.

Parameters
ncgr_pathPath to NCGR file.
ncer_pathPath to NCER cell resource.
nclr_pathPath to NCLR palette file.
out_dirDirectory path to write output PNGs.
Returns
0 on success; negative value on failure.

◆ PngPipeline_CombineSideBySide()

int PngPipeline_CombineSideBySide ( const RgbaColor front,
int  front_w,
int  front_h,
const RgbaColor back,
int  back_w,
int  back_h,
RgbaColor **  out_combined,
int *  out_combined_w,
int *  out_combined_h 
)

Stitches two RGBA images side-by-side into a single combined buffer.

Parameters
frontFront frame RGBA pixels buffer.
front_wFront frame width.
front_hFront frame height.
backBack frame RGBA pixels buffer.
back_wBack frame width.
back_hBack frame height.
out_combinedDestination combined RGBA pixels buffer (allocated within function).
out_combined_wWidth of stitched image.
out_combined_hHeight of stitched image.
Returns
0 on success; negative value on memory failure.

◆ PngPipeline_CombineToGrid()

int PngPipeline_CombineToGrid ( const NcerFile ncer,
const NcgrImage ncgr,
const NclrPalette palette,
RgbaColor **  out_combined,
int *  out_combined_w,
int *  out_combined_h 
)

Recomposes and stitches all frames defined in NCER cells side-by-side in a single grid sheet.

Parameters
ncerNCER resource file.
ncgrNCGR graphics resource.
paletteNCLR palette resource.
out_combinedDestination combined RGBA pixels buffer (allocated within function).
out_combined_wWidth of stitched spritesheet image.
out_combined_hHeight of stitched spritesheet image.
Returns
0 on success; negative value on failure.

◆ PngPipeline_CroppedSprite()

int PngPipeline_CroppedSprite ( const char *  ncgr_path,
const char *  nclr_path,
const char *  out_path 
)

Renders the first cell frame from NCGR tiles, cropped to its alpha bounding box, and saves it.

Parameters
ncgr_pathPath to NCGR file.
nclr_pathPath to NCLR file.
out_pathDestination file path.
Returns
0 on success; negative value on failure.

◆ PngPipeline_CropToAlpha()

int PngPipeline_CropToAlpha ( const RgbaColor pixels,
int  width,
int  height,
RgbaColor **  out_pixels,
int *  out_width,
int *  out_height 
)

Crops transparent borders around a pixel frame buffer.

Parameters
pixelsSource RGBA pixels buffer.
widthInput canvas width.
heightInput canvas height.
out_pixelsOutput cropped RGBA buffer (allocated within function).
out_widthWidth of cropped image.
out_heightHeight of cropped image.
Returns
0 on success; negative value on empty or transparent input.

◆ PngPipeline_ExactNcgr()

int PngPipeline_ExactNcgr ( const char *  ncgr_path,
const char *  nclr_path,
const char *  out_path 
)

Renders the exact tile character page layout defined by NCGR and exports as PNG.

Parameters
ncgr_pathPath to NCGR file.
nclr_pathPath to NCLR file.
out_pathDestination file path.
Returns
0 on success; negative value on failure.

◆ PngPipeline_TilePreview()

int PngPipeline_TilePreview ( const char *  ncgr_path,
const char *  nclr_path,
const char *  out_path 
)

Renders NCGR tiles in order to a standard PNG preview file.

Parameters
ncgr_pathPath to the NCGR file.
nclr_pathPath to the NCLR palette file.
out_pathDestination file path.
Returns
0 on success; negative value on error.