A primitive non-monotonic screening module example. More...
Data Structures | |
struct | HTI |
The structure this example uses internally for its halftone instances. More... | |
Macros | |
#define | RERANGE16(x) ( ((x) >> 12) + ((x) >> 15) ) |
Re-range a uint16 value to lie between 0 and 16. We do this by taking the top 4 bits and then adding one if the value was over half, i.e., top bit was set. More... | |
#define | RERANGE8(x) ( ((x) >> 4) + ((x) >> 7) ) |
Re-range a uint8 value to lie between 0 and 16. We do this by taking the top 4 bits and then adding one if the value was over half, i.e., top bit was set. More... | |
#define | BASECELLUNIT(pCells, inval, cellY) ( *((pCells) + ( (inval) << 2 ) + (cellY)) ) |
Get the basic cell unit (bcu) for a value. More... | |
#define | BCUREPL(bcu) ( bcu ) |
Replicates a uint32 basic cell unit to fill a sw_htm_raster_unit. More... | |
#define | NEWPEL16(dst, pelmsk, pCells, pSrc16, ixSrc, cellY) |
Set a pixel bit for the given 16-bit input value. More... | |
#define | NEWPEL8(dst, pelmsk, pCells, pSrc8, ixSrc, cellY) |
Set a pixel bit for the given 8-bit input value. More... | |
#define | INVERT_SCREEN_CELLS(norm, invs) |
Create an inverse cell array from the original. More... | |
Typedefs | |
typedef struct HTI | HTI |
The structure this example uses internally for its halftone instances. More... | |
Variables | |
static sw_htm_api | htmApi |
The sw_htm_api used to register the module with the RIP. More... | |
static const uint32 | g_rasterTonesBase [17][4] |
Halftone cell tables. More... | |
static const uint32 | g_rasterTones90R [17][4] |
These are the base cells in g_rasterTonesBase rotated 90-degrees clockwise. | |
static const uint32 | g_rasterTones90L [17][4] |
These are the base cells in g_rasterTonesBase rotated 90-degrees counter-clockwise. | |
static const uint32 | g_rasterTones180 [17][4] |
These are the base cells in g_rasterTonesBase rotated 180-degrees. | |
static uint32 | g_inverseTonesBase [17][4] |
Inverse screen cells. More... | |
static uint32 | g_inverseTones90R [17][4] |
Inverse screen cells. More... | |
static uint32 | g_inverseTones90L [17][4] |
Inverse screen cells. More... | |
static uint32 | g_inverseTones180 [17][4] |
Inverse screen cells. More... | |
static HqBool | g_inversesInited = 0 |
Whether the inverse screen cells have been initialized. | |
static HTI | g_HTI_C = { ((void*)0) , *g_rasterTonesBase } |
The individual static halftone instances. More... | |
static HTI | g_HTI_M = { ((void*)0) , *g_rasterTones180 } |
The individual static halftone instances. More... | |
static HTI | g_HTI_Y = { ((void*)0) , *g_rasterTones90R } |
The individual static halftone instances. More... | |
static HTI | g_HTI_K = { ((void*)0) , *g_rasterTones90L } |
The individual static halftone instances. More... | |
static HTI | g_HTI_Ci = { ((void*)0) , *g_inverseTonesBase } |
The individual static halftone instances. More... | |
static HTI | g_HTI_Mi = { ((void*)0) , *g_inverseTones180 } |
The individual static halftone instances. More... | |
static HTI | g_HTI_Yi = { ((void*)0) , *g_inverseTones90R } |
The individual static halftone instances. More... | |
static HTI | g_HTI_Ki = { ((void*)0) , *g_inverseTones90L } |
The individual static halftone instances. More... | |
static HTI * | g_HTIs [8] |
Our table of halftone instances. More... | |
A primitive non-monotonic screening module example.
#define BASECELLUNIT | ( | pCells, | |
inval, | |||
cellY | |||
) | ( *((pCells) + ( (inval) << 2 ) + (cellY)) ) |
Get the basic cell unit (bcu) for a value.
The basic cell unit is the uint32
value of the cell for the appropriate input level and line offset. It comprises 8 side-by-side copies of the 4-bit row in the 4x4 grid.
[in] | pCells | Pointer to the start of the overall cell array. |
[in] | inval | The cell index of the desired cell, 0 to 16. |
[in] | cellY | The line/row offset within the cell, 0 to 3. |
#define BCUREPL | ( | bcu | ) | ( bcu ) |
Replicates a uint32
basic cell unit to fill a sw_htm_raster_unit.
When SW_HTM_RASTER_UNIT_BITS is 32, it just returns the basic cell unit unchanged. When SW_HTM_RASTER_UNIT_BITS is 64, it extends the basic cell unit to 64 bits.
#define INVERT_SCREEN_CELLS | ( | norm, | |
invs | |||
) |
Create an inverse cell array from the original.
[in] | norm | The name of the original, normal cell array. |
[out] | invs | The name of the inverse cell array. |
#define NEWPEL16 | ( | dst, | |
pelmsk, | |||
pCells, | |||
pSrc16, | |||
ixSrc, | |||
cellY | |||
) |
Set a pixel bit for the given 16-bit input value.
[in,out] | dst | The sw_htm_raster_unit where the pixels are being collected. The appropriate bit for the pixel should initially be set on or off according to whether the original mask bitmap bit was set. Afterwards, if the pixel bit was on initially, it will have been replaced with the corresponding bit from the halftone cell. |
[in,out] | pelmsk | A mask with a single bit set isolating the pixel. The pelmsk value gets shifted one position to the right afterwards. |
[in] | pCells | Pointer to the start of the overall cell array. |
[in] | pSrc16 | Pointer to the 16-bit source raster line. |
[in,out] | ixSrc | Index of the current pixel in the source line. The index gets incremented afterwards. |
[in] | cellY | The line/row offset within the cell, 0 to 3. |
#define NEWPEL8 | ( | dst, | |
pelmsk, | |||
pCells, | |||
pSrc8, | |||
ixSrc, | |||
cellY | |||
) |
Set a pixel bit for the given 8-bit input value.
[in,out] | dst | The sw_htm_raster_unit where the pixels are being collected. The appropriate bit for the pixel should initially be set on or off according to whether the original mask bitmap bit was set. Afterwards, if the pixel bit was on initially, it will have been replaced with the corresponding bit from the halftone cell. |
[in,out] | pelmsk | A mask with a single bit set isolating the pixel. The pelmsk value gets shifted one position to the right afterwards. |
[in] | pCells | Pointer to the start of the overall cell array. |
[in] | pSrc8 | Pointer to the 8-bit source raster line. |
[in,out] | ixSrc | Index of the current pixel in the source line. The index gets incremented afterwards. |
[in] | cellY | The line/row offset within the cell, 0 to 3. |
#define RERANGE16 | ( | x | ) | ( ((x) >> 12) + ((x) >> 15) ) |
Re-range a uint16
value to lie between 0 and 16. We do this by taking the top 4 bits and then adding one if the value was over half, i.e., top bit was set.
[in] | x | The 16-bit value to re-range. |
#define RERANGE8 | ( | x | ) | ( ((x) >> 4) + ((x) >> 7) ) |
Re-range a uint8
value to lie between 0 and 16. We do this by taking the top 4 bits and then adding one if the value was over half, i.e., top bit was set.
[in] | x | The 8-bit value to re-range. |
The structure this example uses internally for its halftone instances.
This simple example module needs nothing more than a reference count and a pointer to the start of the appropriate cell table array.
|
static |
The individual static halftone instances.
We only reference these from the static table g_HTIs, later.
sethalftone
really determines which screen will be used for which colorant.
|
static |
The individual static halftone instances.
We only reference these from the static table g_HTIs, later.
sethalftone
really determines which screen will be used for which colorant.
|
static |
The individual static halftone instances.
We only reference these from the static table g_HTIs, later.
sethalftone
really determines which screen will be used for which colorant.
|
static |
The individual static halftone instances.
We only reference these from the static table g_HTIs, later.
sethalftone
really determines which screen will be used for which colorant.
|
static |
The individual static halftone instances.
We only reference these from the static table g_HTIs, later.
sethalftone
really determines which screen will be used for which colorant.
|
static |
The individual static halftone instances.
We only reference these from the static table g_HTIs, later.
sethalftone
really determines which screen will be used for which colorant.
|
static |
The individual static halftone instances.
We only reference these from the static table g_HTIs, later.
sethalftone
really determines which screen will be used for which colorant.
|
static |
The individual static halftone instances.
We only reference these from the static table g_HTIs, later.
sethalftone
really determines which screen will be used for which colorant.
|
static |
Our table of halftone instances.
So simple, in our case, that we can keep them static.
|
static |
Inverse screen cells.
These are nothing more complicated than cells which light pixels in the opposite order to their counterparts. Inverses come in handy when using a cross-over between two shades of a colorant, such as light and dark Cyan. Using an inverse screen for the light ink and a normal screen for the dark (or vice-versa) means that the chances of light and dark dots coinciding are minimised.
Rather than hand code these inverse screens, we calculate them, from the originals, the first time an inverse is needed.
This is the inverse screen cells rotated 180 degrees.
|
static |
Inverse screen cells.
These are nothing more complicated than cells which light pixels in the opposite order to their counterparts. Inverses come in handy when using a cross-over between two shades of a colorant, such as light and dark Cyan. Using an inverse screen for the light ink and a normal screen for the dark (or vice-versa) means that the chances of light and dark dots coinciding are minimised.
Rather than hand code these inverse screens, we calculate them, from the originals, the first time an inverse is needed.
This is the inverse screen cells rotated 90 degrees counter-clockwise.
|
static |
Inverse screen cells.
These are nothing more complicated than cells which light pixels in the opposite order to their counterparts. Inverses come in handy when using a cross-over between two shades of a colorant, such as light and dark Cyan. Using an inverse screen for the light ink and a normal screen for the dark (or vice-versa) means that the chances of light and dark dots coinciding are minimised.
Rather than hand code these inverse screens, we calculate them, from the originals, the first time an inverse is needed.
This is the inverse screen cells rotated 90 degrees clockwise.
|
static |
Inverse screen cells.
These are nothing more complicated than cells which light pixels in the opposite order to their counterparts. Inverses come in handy when using a cross-over between two shades of a colorant, such as light and dark Cyan. Using an inverse screen for the light ink and a normal screen for the dark (or vice-versa) means that the chances of light and dark dots coinciding are minimised.
Rather than hand code these inverse screens, we calculate them, from the originals, the first time an inverse is needed.
|
static |
Halftone cell tables.
The following tables are the halftone patterns for each of the possible tone levels/shades.
* The pixels lit for each shade in the basic grid are shown by hashes: * Shade: 01 02 03 04 05 06 07 08 * #--- -#-- #-#- -#-- #-#- -#-# #-#- -#-# * ---- #--- ---- #--- -#-- #-#- _#_# #-#- * ---- ---- #--- --#- #-#- ---# #-#- -#-# * ---- ---- ---- -#-- ---- ---# -#-- #-#- * * Shade: 09 10 11 12 13 14 15 16 * ##-# ##-- --#- ##-# ###- #### #### #### * #-#- -### -### ###- #### ###- #### #### * -##- ##-- ###- ##-# ###- #### ###- #### * -##- #-## #### ###- ##-# ###- #### #### *
This basic grid is then used in each of four rotations to make the halftones for four separations/colorants.
The major index into the tables is the shade (where blank is 0), which is also the number of pixels lit in that cell.
Each uint32
in the table holds eight copies, side by side horizontally, of one line of the basic 4x4 cell.
|
static |
The sw_htm_api used to register the module with the RIP.
It is initialised in htm4x4_getInstance(), later.