php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
gd_topal.c File Reference
#include <string.h>
#include "gd.h"
#include "gdhelpers.h"

Go to the source code of this file.

Data Structures

struct  my_cquantizer
 
struct  box
 

Macros

#define QUANT_2PASS_SUPPORTED
 
#define RGB_RED   0
 
#define RGB_GREEN   1
 
#define RGB_BLUE   2
 
#define JSAMPLE   unsigned char
 
#define MAXJSAMPLE   (gdMaxColors-1)
 
#define BITS_IN_JSAMPLE   8
 
#define JSAMPROW   int*
 
#define JDIMENSION   int
 
#define METHODDEF(type)
 
#define LOCAL(type)
 
#define SHIFT_TEMPS
 
#define RIGHT_SHIFT(x, shft)
 
#define range_limit(x)
 
#define INT16   short
 
#define UINT16   unsigned short
 
#define INT32   int
 
#define FAR
 
#define boolean   int
 
#define TRUE   1
 
#define FALSE   0
 
#define input_buf   (oim->tpixels)
 
#define output_buf   (nim->pixels)
 
#define R_SCALE   2 /* scale R distances by this much */
 
#define G_SCALE   3 /* scale G distances by this much */
 
#define B_SCALE   1 /* and B by this much */
 
#define C0_SCALE   R_SCALE
 
#define C1_SCALE   G_SCALE
 
#define C2_SCALE   B_SCALE
 
#define MAXNUMCOLORS   (MAXJSAMPLE+1) /* maximum size of colormap */
 
#define HIST_C0_BITS   5 /* bits of precision in R/B histogram */
 
#define HIST_C1_BITS   6 /* bits of precision in G histogram */
 
#define HIST_C2_BITS   5 /* bits of precision in B/R histogram */
 
#define HIST_C0_ELEMS   (1<<HIST_C0_BITS)
 
#define HIST_C1_ELEMS   (1<<HIST_C1_BITS)
 
#define HIST_C2_ELEMS   (1<<HIST_C2_BITS)
 
#define C0_SHIFT   (BITS_IN_JSAMPLE-HIST_C0_BITS)
 
#define C1_SHIFT   (BITS_IN_JSAMPLE-HIST_C1_BITS)
 
#define C2_SHIFT   (BITS_IN_JSAMPLE-HIST_C2_BITS)
 
#define BOX_C0_LOG   (HIST_C0_BITS-3)
 
#define BOX_C1_LOG   (HIST_C1_BITS-3)
 
#define BOX_C2_LOG   (HIST_C2_BITS-3)
 
#define BOX_C0_ELEMS   (1<<BOX_C0_LOG) /* # of hist cells in update box */
 
#define BOX_C1_ELEMS   (1<<BOX_C1_LOG)
 
#define BOX_C2_ELEMS   (1<<BOX_C2_LOG)
 
#define BOX_C0_SHIFT   (C0_SHIFT + BOX_C0_LOG)
 
#define BOX_C1_SHIFT   (C1_SHIFT + BOX_C1_LOG)
 
#define BOX_C2_SHIFT   (C2_SHIFT + BOX_C2_LOG)
 
#define STEP_C0   ((1 << C0_SHIFT) * C0_SCALE)
 
#define STEP_C1   ((1 << C1_SHIFT) * C1_SCALE)
 
#define STEP_C2   ((1 << C2_SHIFT) * C2_SCALE)
 
#define GETJSAMPLE
 
#define STEPSIZE   ((MAXJSAMPLE+1)/16)
 

Typedefs

typedef UINT16 histcell
 
typedef histcell FARhistptr
 
typedef histcell hist1d[HIST_C2_ELEMS]
 
typedef hist1d FARhist2d
 
typedef hist2dhist3d
 
typedef INT16 FSERROR
 
typedef int LOCFSERROR
 
typedef FSERROR FARFSERRPTR
 
typedef my_cquantizermy_cquantize_ptr
 
typedef boxboxptr
 

Functions

 prescan_quantize (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize)
 
 LOCAL (boxptr)
 
 update_box (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize, boxptr boxp)
 
 median_cut (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize, boxptr boxlist, int numboxes, int desired_colors)
 
 compute_color (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize, boxptr boxp, int icolor)
 
 select_colors (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize, int desired_colors)
 
 find_nearby_colors (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize, int minc0, int minc1, int minc2, JSAMPLE colorlist[])
 
 LOCAL (void)
 
 fill_inverse_cmap (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize, int c0, int c1, int c2)
 
 pass2_no_dither (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize)
 
 pass2_fs_dither (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize)
 
 init_error_limit (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize)
 
gdImagePtr gdImageCreatePaletteFromTrueColor (gdImagePtr im, int dither, int colorsWanted)
 
int gdImageTrueColorToPalette (gdImagePtr im, int dither, int colorsWanted)
 

Macro Definition Documentation

◆ B_SCALE

#define B_SCALE   1 /* and B by this much */

Definition at line 170 of file gd_topal.c.

◆ BITS_IN_JSAMPLE

#define BITS_IN_JSAMPLE   8

Definition at line 51 of file gd_topal.c.

◆ boolean

#define boolean   int

Definition at line 104 of file gd_topal.c.

◆ BOX_C0_ELEMS

#define BOX_C0_ELEMS   (1<<BOX_C0_LOG) /* # of hist cells in update box */

Definition at line 806 of file gd_topal.c.

◆ BOX_C0_LOG

#define BOX_C0_LOG   (HIST_C0_BITS-3)

Definition at line 802 of file gd_topal.c.

◆ BOX_C0_SHIFT

#define BOX_C0_SHIFT   (C0_SHIFT + BOX_C0_LOG)

Definition at line 810 of file gd_topal.c.

◆ BOX_C1_ELEMS

#define BOX_C1_ELEMS   (1<<BOX_C1_LOG)

Definition at line 807 of file gd_topal.c.

◆ BOX_C1_LOG

#define BOX_C1_LOG   (HIST_C1_BITS-3)

Definition at line 803 of file gd_topal.c.

◆ BOX_C1_SHIFT

#define BOX_C1_SHIFT   (C1_SHIFT + BOX_C1_LOG)

Definition at line 811 of file gd_topal.c.

◆ BOX_C2_ELEMS

#define BOX_C2_ELEMS   (1<<BOX_C2_LOG)

Definition at line 808 of file gd_topal.c.

◆ BOX_C2_LOG

#define BOX_C2_LOG   (HIST_C2_BITS-3)

Definition at line 804 of file gd_topal.c.

◆ BOX_C2_SHIFT

#define BOX_C2_SHIFT   (C2_SHIFT + BOX_C2_LOG)

Definition at line 812 of file gd_topal.c.

◆ C0_SCALE

#define C0_SCALE   R_SCALE

Definition at line 180 of file gd_topal.c.

◆ C0_SHIFT

Definition at line 237 of file gd_topal.c.

◆ C1_SCALE

#define C1_SCALE   G_SCALE

Definition at line 186 of file gd_topal.c.

◆ C1_SHIFT

Definition at line 238 of file gd_topal.c.

◆ C2_SCALE

#define C2_SCALE   B_SCALE

Definition at line 192 of file gd_topal.c.

◆ C2_SHIFT

Definition at line 239 of file gd_topal.c.

◆ FALSE

#define FALSE   0

Definition at line 112 of file gd_topal.c.

◆ FAR

#define FAR

Definition at line 98 of file gd_topal.c.

◆ G_SCALE

#define G_SCALE   3 /* scale G distances by this much */

Definition at line 169 of file gd_topal.c.

◆ GETJSAMPLE

#define GETJSAMPLE

◆ HIST_C0_BITS

#define HIST_C0_BITS   5 /* bits of precision in R/B histogram */

Definition at line 227 of file gd_topal.c.

◆ HIST_C0_ELEMS

#define HIST_C0_ELEMS   (1<<HIST_C0_BITS)

Definition at line 232 of file gd_topal.c.

◆ HIST_C1_BITS

#define HIST_C1_BITS   6 /* bits of precision in G histogram */

Definition at line 228 of file gd_topal.c.

◆ HIST_C1_ELEMS

#define HIST_C1_ELEMS   (1<<HIST_C1_BITS)

Definition at line 233 of file gd_topal.c.

◆ HIST_C2_BITS

#define HIST_C2_BITS   5 /* bits of precision in B/R histogram */

Definition at line 229 of file gd_topal.c.

◆ HIST_C2_ELEMS

#define HIST_C2_ELEMS   (1<<HIST_C2_BITS)

Definition at line 234 of file gd_topal.c.

◆ input_buf

#define input_buf   (oim->tpixels)

Definition at line 116 of file gd_topal.c.

◆ INT16

#define INT16   short

Definition at line 86 of file gd_topal.c.

◆ INT32

#define INT32   int

Definition at line 94 of file gd_topal.c.

◆ JDIMENSION

#define JDIMENSION   int

Definition at line 54 of file gd_topal.c.

◆ JSAMPLE

#define JSAMPLE   unsigned char

Definition at line 49 of file gd_topal.c.

◆ JSAMPROW

#define JSAMPROW   int*

Definition at line 53 of file gd_topal.c.

◆ LOCAL

#define LOCAL ( type)
Value:
static type
zend_ffi_type * type
Definition ffi.c:3812

Definition at line 57 of file gd_topal.c.

◆ MAXJSAMPLE

#define MAXJSAMPLE   (gdMaxColors-1)

Definition at line 50 of file gd_topal.c.

◆ MAXNUMCOLORS

#define MAXNUMCOLORS   (MAXJSAMPLE+1) /* maximum size of colormap */

Definition at line 222 of file gd_topal.c.

◆ METHODDEF

#define METHODDEF ( type)
Value:
static type

Definition at line 56 of file gd_topal.c.

◆ output_buf

#define output_buf   (nim->pixels)

Definition at line 117 of file gd_topal.c.

◆ QUANT_2PASS_SUPPORTED

#define QUANT_2PASS_SUPPORTED

Definition at line 43 of file gd_topal.c.

◆ R_SCALE

#define R_SCALE   2 /* scale R distances by this much */

Definition at line 168 of file gd_topal.c.

◆ range_limit

#define range_limit ( x)
Value:
{ if(x<0) x=0; if (x>255) x=255; }

Definition at line 82 of file gd_topal.c.

◆ RGB_BLUE

#define RGB_BLUE   2

Definition at line 47 of file gd_topal.c.

◆ RGB_GREEN

#define RGB_GREEN   1

Definition at line 46 of file gd_topal.c.

◆ RGB_RED

#define RGB_RED   0

Definition at line 45 of file gd_topal.c.

◆ RIGHT_SHIFT

#define RIGHT_SHIFT ( x,
shft )
Value:
((x) >> (shft))

Definition at line 78 of file gd_topal.c.

◆ SHIFT_TEMPS

#define SHIFT_TEMPS

Definition at line 77 of file gd_topal.c.

◆ STEP_C0

#define STEP_C0   ((1 << C0_SHIFT) * C0_SCALE)

◆ STEP_C1

#define STEP_C1   ((1 << C1_SHIFT) * C1_SCALE)

◆ STEP_C2

#define STEP_C2   ((1 << C2_SHIFT) * C2_SCALE)

◆ STEPSIZE

#define STEPSIZE   ((MAXJSAMPLE+1)/16)

◆ TRUE

#define TRUE   1

Definition at line 108 of file gd_topal.c.

◆ UINT16

#define UINT16   unsigned short

Definition at line 90 of file gd_topal.c.

Typedef Documentation

◆ boxptr

typedef box* boxptr

Definition at line 372 of file gd_topal.c.

◆ FSERROR

typedef INT16 FSERROR

Definition at line 276 of file gd_topal.c.

◆ FSERRPTR

typedef FSERROR FAR* FSERRPTR

Definition at line 283 of file gd_topal.c.

◆ hist1d

typedef histcell hist1d[HIST_C2_ELEMS]

Definition at line 246 of file gd_topal.c.

◆ hist2d

typedef hist1d FAR* hist2d

Definition at line 247 of file gd_topal.c.

◆ hist3d

typedef hist2d* hist3d

Definition at line 248 of file gd_topal.c.

◆ histcell

typedef UINT16 histcell

Definition at line 242 of file gd_topal.c.

◆ histptr

typedef histcell FAR* histptr

Definition at line 244 of file gd_topal.c.

◆ LOCFSERROR

typedef int LOCFSERROR

Definition at line 277 of file gd_topal.c.

◆ my_cquantize_ptr

Definition at line 303 of file gd_topal.c.

Function Documentation

◆ compute_color()

compute_color ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize,
boxptr boxp,
int icolor )

Definition at line 643 of file gd_topal.c.

◆ fill_inverse_cmap()

fill_inverse_cmap ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize,
int c0,
int c1,
int c2 )

Definition at line 1072 of file gd_topal.c.

◆ find_nearby_colors()

find_nearby_colors ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize,
int minc0,
int minc1,
int minc2,
JSAMPLE colorlist[] )

Definition at line 824 of file gd_topal.c.

◆ gdImageCreatePaletteFromTrueColor()

gdImagePtr gdImageCreatePaletteFromTrueColor ( gdImagePtr im,
int dither,
int colorsWanted )

Definition at line 1431 of file gd_topal.c.

◆ gdImageTrueColorToPalette()

int gdImageTrueColorToPalette ( gdImagePtr im,
int dither,
int colorsWanted )

Definition at line 1440 of file gd_topal.c.

◆ init_error_limit()

init_error_limit ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize )

Definition at line 1372 of file gd_topal.c.

◆ LOCAL() [1/2]

LOCAL ( boxptr )

Definition at line 375 of file gd_topal.c.

◆ LOCAL() [2/2]

LOCAL ( void )

Definition at line 979 of file gd_topal.c.

◆ median_cut()

median_cut ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize,
boxptr boxlist,
int numboxes,
int desired_colors )

Definition at line 543 of file gd_topal.c.

◆ pass2_fs_dither()

pass2_fs_dither ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize )

Definition at line 1190 of file gd_topal.c.

◆ pass2_no_dither()

pass2_no_dither ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize )

Definition at line 1135 of file gd_topal.c.

◆ prescan_quantize()

prescan_quantize ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize )

Definition at line 316 of file gd_topal.c.

◆ select_colors()

select_colors ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize,
int desired_colors )

Definition at line 703 of file gd_topal.c.

◆ update_box()

update_box ( gdImagePtr oim,
gdImagePtr nim,
my_cquantize_ptr cquantize,
boxptr boxp )

Definition at line 418 of file gd_topal.c.