// respecify a portion of a color table
552690
func CopyColorSubTable(target uint32, start int32, x int32, y int32, width int32) {
	C.glowCopyColorSubTable(gpCopyColorSubTable, (C.GLenum)(target), (C.GLsizei)(start), (C.GLint)(x), (C.GLint)(y), (C.GLsizei)(width))
}
183108
func colorize(text string, c color) string {
	return string(c) + text + string(endColor)
}
355657
func (a *Application) ResizeToFullScreen(p Primitive) *Application {
	a.RLock()
	width, height := a.screen.Size()
	a.RUnlock()
	p.SetRect(0, 0, width, height)
	return a
}
736406
func (c *Context) BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha int) {
	c.Call("blendFuncSeparate", srcRGB, dstRGB, srcAlpha, dstAlpha)
}
143573
func (w *Waveform) setFGColorFunction(function ColorFunc) error {
	// Function cannot be nil
	if function == nil {
		return errFGColorFunctionNil
	}

	w.fgColorFn = function

	return nil
}
972898
func (a *CellView) Resize() {
	// We might want to reflow text
	width, height := a.view.Size()
	a.port.Resize(0, 0, width, height)
	a.port.ValidateView()
	a.MakeCursorVisible()
}
476879
func (s *UpdateTimeToLiveOutput) SetTimeToLiveSpecification(v *TimeToLiveSpecification) *UpdateTimeToLiveOutput {
	s.TimeToLiveSpecification = v
	return s
}
450032
func (n *Node) fixUp(fast bool) *Node {
	if !fast {
		n.adjustRange()
	}
	if n.Right.color() == llrb.Red {
		if Mode == TD234 && n.Right.Left.color() == llrb.Red {
			n.Right = n.Right.rotateRight()
		}
		n = n.rotateLeft()
	}
	if n.Left.color() == llrb.Red && n.Left.Left.color() == llrb.Red {
		n = n.rotateRight()
	}
	if Mode == BU23 && n.Left.color() == llrb.Red && n.Right.color() == llrb.Red {
		n.flipColors()
	}

	return n
}
738753
func ResampleInplace(m image.Image, r image.Rectangle, w, h int) image.Image {
	// We don't support scaling up.
	if r.Dx() < w || r.Dy() < h {
		return m
	}

	switch m := m.(type) {
	case *image.YCbCr:
		xStep := float64(r.Dx()) / float64(w)
		yStep := float64(r.Dy()) / float64(h)
		for y := r.Min.Y; y < r.Min.Y+h; y++ {
			for x := r.Min.X; x < r.Min.X+w; x++ {
				xSrc := int(float64(x) * xStep)
				ySrc := int(float64(y) * yStep)
				cSrc := m.COffset(xSrc, ySrc)
				cDst := m.COffset(x, y)
				m.Y[m.YOffset(x, y)] = m.Y[m.YOffset(xSrc, ySrc)]
				m.Cb[cDst] = m.Cb[cSrc]
				m.Cr[cDst] = m.Cr[cSrc]
			}
		}
	case draw.Image:
		xStep := float64(r.Dx()) / float64(w)
		yStep := float64(r.Dy()) / float64(h)
		for y := r.Min.Y; y < r.Min.Y+h; y++ {
			for x := r.Min.X; x < r.Min.X+w; x++ {
				xSrc := int(float64(x) * xStep)
				ySrc := int(float64(y) * yStep)
				r, g, b, a := m.At(xSrc, ySrc).RGBA()
				m.Set(x, y, color.RGBA{
					R: uint8(r >> 8),
					G: uint8(g >> 8),
					B: uint8(b >> 8),
					A: uint8(a >> 8),
				})
			}
		}
	default:
		// TODO fallback to generic Resample somehow?
		panic("Unhandled image type")
	}
	r.Max.X = r.Min.X + w
	r.Max.Y = r.Min.Y + h
	return subImage(m, r)
}
534413
func resize(bs []byte, size int) []byte {
	if cap(bs) < size {
		return make([]byte, size)
	}
	return bs[:size]
}
1249540
func (cb *CellBuffer) Resize(w, h int) {

	if cb.h == h && cb.w == w {
		return
	}

	newc := make([]cell, w*h)
	for y := 0; y < h && y < cb.h; y++ {
		for x := 0; x < w && x < cb.w; x++ {
			oc := &cb.cells[(y*cb.w)+x]
			nc := &newc[(y*w)+x]
			nc.currMain = oc.currMain
			nc.currComb = oc.currComb
			nc.currStyle = oc.currStyle
			nc.width = oc.width
			nc.lastMain = rune(0)
		}
	}
	cb.cells = newc
	cb.h = h
	cb.w = w
}
656615
func Flatten(g Grouping) *Table {
	groups := g.Tables()
	switch len(groups) {
	case 0:
		return new(Table)

	case 1:
		return g.Table(groups[0])
	}

	tabs := make([]*Table, len(groups))
	for i, gid := range groups {
		tabs[i] = g.Table(gid)
	}

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

	w.bgColorFn = function

	return nil
}
675354
func formatPlanInstanceDiff(buf *bytes.Buffer, r *InstanceDiff, keyLen int, colorizer *colorstring.Colorize) {
	addrStr := r.Addr.String()

	// Determine the color for the text (green for adding, yellow
	// for change, red for delete), and symbol, and output the
	// resource header.
	color := "yellow"
	symbol := DiffActionSymbol(r.Action)
	oldValues := true
	switch r.Action {
	case plans.DeleteThenCreate, plans.CreateThenDelete:
		color = "yellow"
	case plans.Create:
		color = "green"
		oldValues = false
	case plans.Delete:
		color = "red"
	case plans.Read:
		color = "cyan"
		oldValues = false
	}

	var extraStr string
	if r.Tainted {
		extraStr = extraStr + " (tainted)"
	}
	if r.Deposed {
		extraStr = extraStr + " (deposed)"
	}
	if r.Action.IsReplace() {
		extraStr = extraStr + colorizer.Color(" [red][bold](new resource required)")
	}

	buf.WriteString(
		colorizer.Color(fmt.Sprintf(
			"[%s]%s [%s]%s%s\n",
			color, symbol, color, addrStr, extraStr,
		)),
	)

	for _, attr := range r.Attributes {

		v := attr.NewValue
		var dispV string
		switch {
		case v == "" && attr.NewComputed:
			dispV = "<computed>"
		case attr.Sensitive:
			dispV = "<sensitive>"
		default:
			dispV = fmt.Sprintf("%q", v)
		}

		updateMsg := ""
		switch {
		case attr.ForcesNew && r.Action.IsReplace():
			updateMsg = colorizer.Color(" [red](forces new resource)")
		case attr.Sensitive && oldValues:
			updateMsg = colorizer.Color(" [yellow](attribute changed)")
		}

		if oldValues {
			u := attr.OldValue
			var dispU string
			switch {
			case attr.Sensitive:
				dispU = "<sensitive>"
			default:
				dispU = fmt.Sprintf("%q", u)
			}
			buf.WriteString(fmt.Sprintf(
				"      %s:%s %s => %s%s\n",
				attr.Path,
				strings.Repeat(" ", keyLen-len(attr.Path)),
				dispU, dispV,
				updateMsg,
			))
		} else {
			buf.WriteString(fmt.Sprintf(
				"      %s:%s %s%s\n",
				attr.Path,
				strings.Repeat(" ", keyLen-len(attr.Path)),
				dispV,
				updateMsg,
			))
		}
	}

	// Write the reset color so we don't bleed color into later text
	buf.WriteString(colorizer.Color("[reset]\n"))
}
575728
func Colorize(c Color, b BackgroundColor, text string) string {
	return fmt.Sprintf("%s%s%s%s%s", ResetColors, c, b, text, ResetColors.String())
}
1210720
func (pctx *parseCtx) skipWhiteSpaces() {
	for {
		switch t := pctx.peek(); t.Type {
		case SPACE, COMMENT_IDENT:
			pctx.advance()
			continue
		default:
			return
		}
	}
}
214799
func (t *TemplateInstantiation) Normalize() error {
	if t.Project == "" {
		return errors.New("empty project")
	}
	return t.Specifier.Normalize()
}