// RGB3BitB is a syntax for Color3BitB with NewRGB3Bit.
761566
func (builder *Builder) RGB3BitB(r, g, b uint8) *Builder {
	return builder.Color3BitB(NewRGB3Bit(r, g, b))
}
48337
func parseHexColor(colorStr string) (color.RGBA, error) {
	// Check if the hex color string is a valid color representation.
	if !validColorRegexp.MatchString(colorStr) {
		return color.RGBA{}, errors.New("Color must be specified " +
			"using a hexadecimal value in the form #RRGGBB")
	}

	// Decode the hex color string to bytes.
	// The resulting byte array is in the form [R, G, B].
	colorBytes, err := hex.DecodeString(colorStr[1:])
	if err != nil {
		return color.RGBA{}, err
	}

	return color.RGBA{R: colorBytes[0], G: colorBytes[1], B: colorBytes[2]}, nil
}
16863
func LinearRgb(r, g, b float64) Color {
	return Color{delinearize(r), delinearize(g), delinearize(b)}
}
354811
func (a *Writer) BColor256(color int) (int, error) {
	return a.WriteString(BColor256(color))
}
1122271
func (c1 Color) AlmostEqualRgb(c2 Color) bool {
	return math.Abs(c1.R-c2.R)+
		math.Abs(c1.G-c2.G)+
		math.Abs(c1.B-c2.B) < 3.0*Delta
}
1212615
func decodeRGB(dinfo *C.struct_jpeg_decompress_struct) (dest *rgb.Image, err error) {
	C.jpeg_calc_output_dimensions(dinfo)
	dest = rgb.NewImage(image.Rect(0, 0, int(dinfo.output_width), int(dinfo.output_height)))

	dinfo.out_color_space = C.JCS_RGB
	readScanLines(dinfo, dest.Pix, dest.Stride)
	return
}
1126497
func (pattern *MeshPattern) SetCornerColorRGB(cornerNum int, red, green, blue float64) {
	C.cairo_mesh_pattern_set_corner_color_rgb(pattern.Ptr, C.uint(cornerNum), C.double(red), C.double(green), C.double(blue))
	if err := pattern.status(); err != nil {
		panic(err)
	}
}
1343437
func ColorToRGB(colorVal int) color.RGBA {

	red := colorVal >> 16
	green := (colorVal & 0x00FF00) >> 8
	blue := colorVal & 0x0000FF

	return color.RGBA{
		R: uint8(red),
		G: uint8(green),
		B: uint8(blue),
		A: uint8(255),
	}
}
516181
func (c Color) RGB() (int32, int32, int32) {
	v := c.Hex()
	if v < 0 {
		return -1, -1, -1
	}
	return (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff
}
774404
func GroupBitmap(groups ...ofp.GroupType) (bits uint32) {
	for _, group := range groups {
		bits = shl(bits, uint32(group))
	}

	return
}
218853
func (w *Waveform) setBGColorFunction(function ColorFunc) error {
	// Function cannot be nil
	if function == nil {
		return errBGColorFunctionNil
	}

	w.bgColorFn = function

	return nil
}
837099
func BgBrightYellow(arg interface{}) Value {
	if val, ok := arg.(Value); ok {
		return val.BgBrightYellow()
	}
	return value{value: arg, color: BrightBg | YellowBg}
}
342558
func NewPixbufFromData(pbd PixbufData) *Pixbuf {
	gpixbuf := C.gdk_pixbuf_new_from_data(
		C.to_gucharptr(unsafe.Pointer(&pbd.Data[0])),
		C.GdkColorspace(pbd.Colorspace),
		gbool(pbd.HasAlpha),
		C.int(pbd.BitsPerSample),
		C.int(pbd.Width),
		C.int(pbd.Height),
		C.int(pbd.RowStride),
		nil, nil)
	return &Pixbuf{
		GdkPixbuf: &GdkPixbuf{gpixbuf},
		GObject:   glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
	}
}
446336
func SortRGBA(data []color.RGBA, min, max int) {
	if min > max {
		return
	}
	p := partitionRGBASlice(data, min, max)
	SortRGBA(data, min, p-1)
	SortRGBA(data, p+1, max)
}
179572
func mibToGb(m uint64) uint64 {
	return common.MiBToGiB(m) * (humanize.GiByte / humanize.GByte)
}
882070
func (col Color) LinearRgb() (r, g, b float64) {
	r = linearize(col.R)
	g = linearize(col.G)
	b = linearize(col.B)
	return
}
643286
func NewRGBAHistogram(img image.Image) *RGBAHistogram {
	src := clone.AsRGBA(img)

	binCount := 256
	r := Histogram{make([]int, binCount)}
	g := Histogram{make([]int, binCount)}
	b := Histogram{make([]int, binCount)}
	a := Histogram{make([]int, binCount)}

	for y := 0; y < src.Bounds().Dy(); y++ {
		for x := 0; x < src.Bounds().Dx(); x++ {
			pos := y*src.Stride + x*4
			r.Bins[src.Pix[pos+0]]++
			g.Bins[src.Pix[pos+1]]++
			b.Bins[src.Pix[pos+2]]++
			a.Bins[src.Pix[pos+3]]++
		}
	}

	return &RGBAHistogram{R: r, G: g, B: b, A: a}
}