21
21
//! NOTE: DstPal must have enough space to accomodate:
22
22
//! (struct BGRAf_t)[nPalettes * nColoursPerPalette]
23
23
//! TilePalIdx = NULL or int32_t[(Width*Height) / (TileW*TileH)]
24
+ //! DitherMode = Dither mode to use: 0 = DITHER_NONE, -1 = DITHER_FLOYDSTEINBERG, n = DITHER_ORDERED(n)
24
25
//! OutputPaletteIs24bitRGB outputs RGB (byte order: {RR, GG, BB})
25
26
//! colours without an alpha channel; the default is to output to
26
27
//! BGRA (byte order: {BB, GG, RR, AA}).
@@ -41,7 +42,8 @@ DECLSPEC int QualetizeFromRawImage(
41
42
int TileW ,
42
43
int TileH ,
43
44
int32_t * TilePalIdx ,
44
- const uint8_t BitRange [4 ]
45
+ const uint8_t BitRange [4 ],
46
+ int DitherMode
45
47
) {
46
48
//! Create image context
47
49
//! NOTE: 'const' violations in image data, but not modified so this is safe
@@ -55,9 +57,11 @@ DECLSPEC int QualetizeFromRawImage(
55
57
//! Do processing
56
58
//! NOTE: Do NOT allow image replacing, or things will go
57
59
//! very wrong when Qualetize() tries to free the pointers.
58
- struct TilesData_t * TilesData = TilesData_FromBitmap (& Ctx , TileW , TileH , ( const struct BGRA8_t * ) BitRange );
60
+ struct TilesData_t * TilesData = TilesData_FromBitmap (& Ctx , TileW , TileH );
59
61
if (!TilesData ) return 0 ;
60
- (void )Qualetize (& Ctx , TilesData , DstPxIdx , (struct BGRAf_t * )DstPal , nPalettes , nColoursPerPalette , nUnusedColoursPerPalette , 0 );
62
+ (void )Qualetize (
63
+ & Ctx , TilesData , DstPxIdx , (struct BGRAf_t * )DstPal , nPalettes , nColoursPerPalette , nUnusedColoursPerPalette , (const struct BGRA8_t * )BitRange , DitherMode , 0
64
+ );
61
65
62
66
//! Store tile palette indices
63
67
if (TilePalIdx ) {
0 commit comments