fill()
Color / SettingDescription
Sets the color used to fill shapes.
Syntax
void fill(float gray)
void fill(float gray, float a)
void fill(float r, float g, float b)
void fill(float r, float g, float b, float a)
void fill(color c)
Parameters
| Name | Type | Description |
|---|---|---|
| gray | float | grayscale value |
| r | float | red component |
| g | float | green component |
| b | float | blue component |
| a | float | alpha (optional) |
| c | color | a color value |
Returns
voidRelated
Under the Hood
From Processing.h:
void fill(const PColor& c);
void fill(float g);
void fill(float g); void fill(float r, float g, float b);
void fill(float g); void fill(float r, float g, float b); void fill(float r, float g, float b, float a);
inline void fill(color c, int a) { fill(c, (float)a); }
inline void fill(color c, int a) { fill(c, (float)a);
void fill(float);
void fill(float,float);
void fill(float,float,float);
void fill(float,float,float,float);
{ _api::fill((float)gray,(float)a);
{ _api::fill((float)r,(float)g,(float)b);
{ _api::fill((float)r,(float)g,(float)b,(float)a);
{ _api::fill((float)gray);
void fill(float gray, float a);
void fill(float gray);
void fill(float r, float g, float b, float a);
void fill(float r, float g, float b);
void fill(color c);
void fill(color c, float a);
void fill(color c, int a) { fill(c,(float)a); }
void fill(color c, int a) { fill(c,(float)a);
template<typename A, typename=std::enable_if_t<std::is_arithmetic_v<A>>>
void fill(A gray) { fill((float)gray);
template<typename A, typename B, typename=std::enable_if_t<std::is_arithmetic_v<A>&&std::is_arithmetic_v<B>>>
void fill(A gray, B a) { fill((float)gray,(float)a);
template<typename A, typename B, typename C, typename=std::enable_if_t<std::is_arithmetic_v<A>&&std::is_arithmetic_v<B>&&std::is_arithmetic_v<C>>>
void fill(A r, B g, C b) { fill((float)r,(float)g,(float)b);
template<typename A, typename B, typename C, typename D, typename=std::enable_if_t<std::is_arithmetic_v<A>&&std::is_arithmetic_v<B>&&std::is_arithmetic_v<C>&&std::is_arithmetic_v<D>>>
void fill(A r, B g, C b, D a) { fill((float)r,(float)g,(float)b,(float)a);
inline void fill(float g){ if(PApplet::g_papplet) PApplet::g_papplet->fill(g); }
inline void fill(float g,float a){ if(PApplet::g_papplet) PApplet::g_papplet->fill(g,a); }
inline void fill(float r,float g,float b){ if(PApplet::g_papplet) PApplet::g_papplet->fill(r,g,b); }
inline void fill(float r,float g,float b,float a){ if(PApplet::g_papplet) PApplet::g_papplet->fill(r,g,b,a); }
inline void PGraphics::fill(float g) { if(PApplet::g_papplet) PApplet::g_papplet->fill(g); }
inline void PGraphics::fill(float r, float g2, float b) { if(PApplet::g_papplet) PApplet::g_papplet->fill(r,g2,b); }
inline void PGraphics::fill(float r, float g2, float b, float a) { if(PApplet::g_papplet) PApplet::g_papplet->fill(r,g2,b,a); }
Under the Hood
From Processing.cpp:
void PApplet::fill(float gray,float a) {setFillFromColor(makeColor(gray,a));}
void PApplet::fill(float gray) {setFillFromColor(makeColor(gray,colorMaxA));}
void PApplet::fill(float r,float g,float b,float a) {setFillFromColor(makeColor(r,g,b,a));}
void PApplet::fill(float r,float g,float b) {setFillFromColor(makeColor(r,g,b,colorMaxA));}
void PApplet::fill(color c) {setFillFromColor(c);}
void PApplet::fill(color c, float a) {
unsigned int v = c.value;
fillR = (v>>16&0xFF)/255.f;
fillG = (v>>8 &0xFF)/255.f;
fillB = (v &0xFF)/255.f;
fillA = std::min(255.f, std::max(0.f, a)) / 255.f;
doFill = true;
}
void PApplet::fill(const PColor& c) { fill(c.r, c.g, c.b, c.a); }
void PApplet::fill(const PColor& c) { fill(c.r, c.g, c.b, c.a);
std::fill(img->pixels.begin(),img->pixels.end(),0x00000000);