// PaletteHref returns the href of icon in pal.
423999
func PaletteHref(pal, icon int) string {
	return "https://maps.google.com/mapfiles/kml/pal" + strconv.Itoa(pal) + "/icon" + strconv.Itoa(icon) + ".png"
}
930850
func (bc BarChart) GetColorPalette() ColorPalette {
	if bc.ColorPalette != nil {
		return bc.ColorPalette
	}
	return AlternateColorPalette
}
268041
func Maskf(err error, f string, v ...interface{}) error {
	return handler.Maskf(err, f, v...)
}
1316054
func (c Chart) GetColorPalette() ColorPalette {
	if c.ColorPalette != nil {
		return c.ColorPalette
	}
	return DefaultColorPalette
}
338593
func (_class PIFClass) GetSriovLogicalPIFOf(sessionID SessionRef, self PIFRef) (_retval []NetworkSriovRef, _err error) {
	_method := "PIF.get_sriov_logical_PIF_of"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPIFRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertNetworkSriovRefSetToGo(_method + " -> ", _result.Value)
	return
}
688109
func (cs *cachedSource) getRef() *cachedSourceRef {
	ref := &cachedSourceRef{cachedSource: cs}
	cs.refs[ref] = struct{}{}
	return ref
}
210985
func (p *PathSpec) GetRelativeThemeDir() string {
	if p.ThemeSet() {
		return strings.TrimPrefix(filepath.Join(p.ThemesDir, p.Themes()[0]), FilePathSeparator)
	}
	return ""
}
296310
func GIFHandler(rw http.ResponseWriter, r *http.Request) {
	var w, h int = 240, 240
	var hw, hh float64 = float64(w / 2), float64(h / 2)
	circles := []*circle{{}, {}, {}}

	var palette = []color.Color{
		color.RGBA{0x00, 0x00, 0x00, 0xff},
		color.RGBA{0x00, 0x00, 0xff, 0xff},
		color.RGBA{0x00, 0xff, 0x00, 0xff},
		color.RGBA{0x00, 0xff, 0xff, 0xff},
		color.RGBA{0xff, 0x00, 0x00, 0xff},
		color.RGBA{0xff, 0x00, 0xff, 0xff},
		color.RGBA{0xff, 0xff, 0x00, 0xff},
		color.RGBA{0xff, 0xff, 0xff, 0xff},
	}

	var images []*image.Paletted
	var delays []int
	steps := 20
	for step := 0; step < steps; step++ {
		img := image.NewPaletted(image.Rect(0, 0, w, h), palette)
		images = append(images, img)
		delays = append(delays, 0)

		θ := 2.0 * math.Pi / float64(steps) * float64(step)
		for i, circle := range circles {
			θ0 := 2 * math.Pi / 3 * float64(i)
			circle.X = hw - 40*math.Sin(θ0) - 20*math.Sin(θ0+θ)
			circle.Y = hh - 40*math.Cos(θ0) - 20*math.Cos(θ0+θ)
			circle.R = 50
		}

		for x := 0; x < w; x++ {
			for y := 0; y < h; y++ {
				img.Set(x, y, color.RGBA{
					circles[0].Brightness(float64(x), float64(y)),
					circles[1].Brightness(float64(x), float64(y)),
					circles[2].Brightness(float64(x), float64(y)),
					255,
				})
			}
		}
	}

	gif.EncodeAll(rw, &gif.GIF{
		Image: images,
		Delay: delays,
	})
}
110890
func (w WorkspaceResponse) GetHrefByRelOfWorkspaceLink(rel string) string {
	for _, l := range w.Links {
		if l.Rel == rel {
			return l.Href
		}
	}
	return ""
}
1019225
func Docf(raw string, args ...interface{}) string {
	return fmt.Sprintf(Doc(raw), args...)
}
658714
func Infof(ctx context.Context, format string, v ...interface{}) {
	instance.Infof(ctx, format, v...)
}
59133
func (builder *Builder) FullColorF(r, g, b uint8) *Builder {
	return builder.With(FullColorF(r, g, b))
}
1319561
func BottleHref(accountID, bottleID interface{}) string {
	paramaccountID := strings.TrimLeftFunc(fmt.Sprintf("%v", accountID), func(r rune) bool { return r == '/' })
	parambottleID := strings.TrimLeftFunc(fmt.Sprintf("%v", bottleID), func(r rune) bool { return r == '/' })
	return fmt.Sprintf("/cellar/accounts/%v/bottles/%v", paramaccountID, parambottleID)
}
1255474
func (c Colorize) Fprintf(w io.Writer, format string, v ...interface{}) (int, error) {
	return Fprintf(w, c.Foreground, c.Background, format, v...)
}
594871
func dither211(i0 image.Image, cp color.Palette) *image.Paletted {
	if len(cp) > 256 {
		// representation limit of image.Paletted.  a little sketchy to return
		// nil, but unworkable results are always better than wrong results.
		return nil
	}
	b := i0.Bounds()
	pi := image.NewPaletted(b, cp)
	if b.Empty() {
		return pi // no work to do
	}
	sp := make(sPalette, len(cp))
	for i, c := range cp {
		r, g, b, _ := c.RGBA()
		sp[i] = sRGB{int32(r), int32(g), int32(b)}
	}
	// afc is adjustd full color.  e, rt, dn hold diffused errors.
	var afc, e, rt sRGB
	dn := make([]sRGB, b.Dx()+1)
	for y := b.Min.Y; y < b.Max.Y; y++ {
		rt = dn[0]
		dn[0] = sRGB{}
		for x := b.Min.X; x < b.Max.X; x++ {
			// full color from original image
			r0, g0, b0, _ := i0.At(x, y).RGBA()
			// adjusted full color = original color + diffused error
			afc.r = int32(r0) + rt.r>>2
			afc.g = int32(g0) + rt.g>>2
			afc.b = int32(b0) + rt.b>>2
			// clipping or clamping is usually explained as necessary
			// to avoid integer overflow but with palettes that do not
			// represent the full color space of the image, it is needed
			// to keep areas of excess color from saturating at palette
			// limits and bleeding into neighboring areas.
			if afc.r < 0 {
				afc.r = 0
			} else if afc.r > 0xffff {
				afc.r = 0xffff
			}
			if afc.g < 0 {
				afc.g = 0
			} else if afc.g > 0xffff {
				afc.g = 0xffff
			}
			if afc.b < 0 {
				afc.b = 0
			} else if afc.b > 0xffff {
				afc.b = 0xffff
			}
			// nearest palette entry
			i := sp.index(afc)
			// set pixel in destination image
			pi.SetColorIndex(x, y, uint8(i))
			// error to be diffused = full color - palette color.
			pc := sp[i]
			e.r = afc.r - pc.r
			e.g = afc.g - pc.g
			e.b = afc.b - pc.b
			// half of error*4 goes right
			dx := x - b.Min.X + 1
			rt.r = dn[dx].r + e.r*2
			rt.g = dn[dx].g + e.g*2
			rt.b = dn[dx].b + e.b*2
			// the other half goes down
			dn[dx] = e
			dn[dx-1].r += e.r
			dn[dx-1].g += e.g
			dn[dx-1].b += e.b
		}
	}
	return pi
}
144030
func (r renderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
	out.Write(content)
}
418644
func Wrapf(err error, format string, args ...interface{}) error {
	return errs.Wrapf(err, format, args...)
}