Harlequin RIP SDK

RLE raster output. More...

#include "hhrsdk.h"
#include "skintest.h"
#include "rlerast.h"
#include <string.h>

Data Structures

struct  paint_position
 
struct  RLE_RASTER_handle
 

Macros

#define RLE_FILEFORMAT   "%f-%p%?-N%?-S.rle"
 The default file name format for files produced by the RLE file output back end.
 
#define JSON_INDENT(level)   JSON_INDENT##level
 
#define write_string(h, str)
 
#define write_literal(h, str)    (theIWriteFile((h)->dev_op)((h)->dev_op, (h)->ofd, STRING_AND_LENGTH(str)) == CSTRING_LENGTH(str))
 
#define write_field(handle, field, level)
 

Typedefs

typedef struct paint_position paint_position
 
typedef struct RLE_RASTER_handle RLE_RASTER_handle
 

Functions

static RASTER_result RLE_RASTER_finish (void *pJobContext, RASTER_handle *handlep, RasterDescription *pRasterDescription, RASTER_result result)
 Raster complete - close the output file, or delete it if there was an error.
 
static void insert_handle (RLE_RASTER_handle *handle)
 
static RLE_RASTER_handlefind_handle (uintptr_t separation_id)
 
static void delete_handle (RLE_RASTER_handle *handle)
 
static void delete_output_file (RLE_RASTER_handle *handle)
 An error occurred during output - delete the output file. More...
 
static HqBool close_file (RLE_RASTER_handle *handle)
 Close the output file, if open. More...
 
static HqBool init_handle (RLE_RASTER_handle *handle, uint8 *filename, RasterDescription *rasterDescription)
 Initialise a pre-allocated RLE raster handle. More...
 
static HqBool write_int32 (RLE_RASTER_handle *handle, int32 d)
 
static HqBool write_uint32 (RLE_RASTER_handle *handle, uint32 ud)
 
static HqBool write_float (RLE_RASTER_handle *handle, double fl)
 
static HqBool write_colorants (RLE_RASTER_handle *handle, RasterDescription *rd)
 
static HqBool write_trailer (RLE_RASTER_handle *handle)
 
static RASTER_result RLE_RASTER_start (void *pJobContext, RasterDescription *rasterDescription, RASTER_handle *handlep)
 Start a new raster; create the output file and write the header.
 
static RASTER_result RLE_RASTER_write_data (void *pJobContext, RASTER_handle rh, RasterDescription *pRasterDescription, void *data, int32 topline, int32 lines, int32 bytesperline, int32 channel)
 Write a line of RLE data.
 
static RASTER_result RLE_RASTER_job_end (void *pJobContext, RASTER_handle *handlep)
 Clean up at end of job.
 
HqBool RLE_RegisterHandlers (void)
 Register the raster backend and event handlers. More...
 

Variables

static RLE_RASTER_handlehandles = ((void*)0)
 

Detailed Description

RLE raster output.

This file implements a simple example RLE writer for the Harlequin RIP SDK.

Macro Definition Documentation

◆ JSON_INDENT

#define JSON_INDENT (   level)    JSON_INDENT##level

A string constant containing the indent for the given level of JSON.

◆ write_field

#define write_field (   handle,
  field,
  level 
)
Value:
( theIWriteFile((handle)->dev_op)((handle)->dev_op, (handle)->ofd, \
STRING_AND_LENGTH(",\n" JSON_INDENT(level) "\"" field "\": ")) \
== sizeof(",\n" JSON_INDENT(level) "\"" field "\": ")-1 )
#define JSON_INDENT(level)
Definition: rlerast.c:249

Write a JSON field name to the output file, with delimiters around it.

Parameters
handleThe raster handle.
fieldThe field name, a string in double quotes.
levelThe indentation level.
Returns
Success indicator.

◆ write_literal

#define write_literal (   h,
  str 
)     (theIWriteFile((h)->dev_op)((h)->dev_op, (h)->ofd, STRING_AND_LENGTH(str)) == CSTRING_LENGTH(str))

Write a string constant to the output file.

◆ write_string

#define write_string (   h,
  str 
)
Value:
( theIWriteFile((h)->dev_op)((h)->dev_op, (h)->ofd, (uint8*)"\"", 1) == 1 \
&& theIWriteFile((h)->dev_op)((h)->dev_op, (h)->ofd, \
str, u8_strlen_int32(str)) \
== u8_strlen_int32(str) \
&& theIWriteFile((h)->dev_op)((h)->dev_op, (h)->ofd, (uint8*)"\"", 1) == 1 )
uint8_t uint8
8-bit unsigned integer
Definition: hqtypes.h:88
#define u8_strlen_int32(_src_)
Definition: hqstr.h:132

Write a JSON string to the output file.

This should really do encoding, but for now, we rely on the strings not containing control chars or quotes.

Typedef Documentation

◆ paint_position

Storage for remembering the position of a paint.

◆ RLE_RASTER_handle

State structure for writing a separation.

Function Documentation

◆ close_file()

static HqBool close_file ( RLE_RASTER_handle handle)
static

Close the output file, if open.

Returns
FALSE on error.

◆ delete_handle()

static void delete_handle ( RLE_RASTER_handle handle)
static

Delete handle from separation list.

◆ delete_output_file()

static void delete_output_file ( RLE_RASTER_handle handle)
static

An error occurred during output - delete the output file.

Parameters
handle

◆ find_handle()

static RLE_RASTER_handle* find_handle ( uintptr_t  separation_id)
static

Find handle in separation list.

◆ init_handle()

static HqBool init_handle ( RLE_RASTER_handle handle,
uint8 filename,
RasterDescription rasterDescription 
)
static

Initialise a pre-allocated RLE raster handle.

Parameters
handleThe raster handle to initialise.
filenameThe filename of the output file.
rasterDescriptionThe raster descriptor.
Return values
TRUEThe handle was initialised correctly.
FALSEThe handle was not initialised due to an error.

◆ insert_handle()

static void insert_handle ( RLE_RASTER_handle handle)
static

Insert handle into separation list.

◆ RLE_RegisterHandlers()

HqBool RLE_RegisterHandlers ( void  )

Register the raster backend and event handlers.

Return values
TRUEif successful;
FALSEotherwise.

◆ write_colorants()

static HqBool write_colorants ( RLE_RASTER_handle handle,
RasterDescription rd 
)
static

Write the JSON representation of the colorant array to the output file.

◆ write_float()

static HqBool write_float ( RLE_RASTER_handle handle,
double  fl 
)
inlinestatic

Write the given number in float format to the output file of the handle.

◆ write_int32()

static HqBool write_int32 ( RLE_RASTER_handle handle,
int32  d 
)
inlinestatic

Write a signed number in decimal to the output file of the handle.

◆ write_trailer()

static HqBool write_trailer ( RLE_RASTER_handle handle)
static

Write the trailer and the offset line to the output file.

◆ write_uint32()

static HqBool write_uint32 ( RLE_RASTER_handle handle,
uint32  ud 
)
inlinestatic

Write an unsigned number in decimal to the output file of the handle.

Variable Documentation

◆ handles

RLE_RASTER_handle* handles = ((void*)0)
static

List of current separation handles.