// NewSpritesheetWithBorderFromTexture creates a new spritesheet from a texture resource.
// This sheet has sprites of a uniform width and height, but also have borders around
// each sprite to prevent bleeding over
341242
func NewSpritesheetWithBorderFromTexture(tr *TextureResource, cellWidth, cellHeight, borderWidth, borderHeight int) *Spritesheet {
	spriteRegions := generateSymmetricSpriteRegions(tr.Width, tr.Height, cellWidth, cellHeight, borderWidth, borderHeight)
	return NewAsymmetricSpritesheetFromTexture(tr, spriteRegions)
}
35006
func NewStochRsiForStreamWithSrcLen(sourceLength uint, priceStream gotrade.DOHLCVStreamSubscriber, timePeriod int, fastKTimePeriod int, fastDTimePeriod int) (indicator *StochRsi, err error) {
	ind, err := NewStochRsiWithSrcLen(sourceLength, timePeriod, fastKTimePeriod, fastDTimePeriod)
	priceStream.AddTickSubscription(ind)
	return ind, err
}
1267701
func (o *outputBuilder) renderWithTextProto(includePBHeader bool) (map[string][]byte, error) {
	out := make(map[string][]byte, o.Len())

	for _, kv := range o.Items() {
		k, v := kv[0].(starlark.String), kv[1]

		if s, ok := v.(starlark.String); ok {
			out[k.GoString()] = []byte(s.GoString())
			continue
		}

		msg, err := v.(*starlarkproto.Message).ToProto()
		if err != nil {
			return nil, err
		}

		buf := bytes.Buffer{}
		if includePBHeader {
			buf.WriteString("# Auto-generated by lucicfg.\n")
			buf.WriteString("# Do not modify manually.\n")
			if msgName, docURL := protoMessageDoc(msg); docURL != "" {
				buf.WriteString("#\n")
				fmt.Fprintf(&buf, "# For the schema of this file, see %s message:\n", msgName)
				fmt.Fprintf(&buf, "#   %s\n", docURL)
			}
			buf.WriteString("\n")
		}
		proto.MarshalText(&buf, msg)

		out[k.GoString()] = buf.Bytes()
	}

	return out, nil
}
915137
func NewPaperContentAddToFolderType(Description string) *PaperContentAddToFolderType {
	s := new(PaperContentAddToFolderType)
	s.Description = Description
	return s
}
286177
func (s *Spritesheet) Cell(index int) Texture {
	if r, ok := s.cache[index]; ok {
		return r
	}

	cell := s.cells[index]
	s.cache[index] = Texture{
		id:     s.texture,
		width:  float32(cell.Width),
		height: float32(cell.Height),
		viewport: engo.AABB{
			Min: engo.Point{
				X: cell.Position.X / s.width,
				Y: cell.Position.Y / s.height,
			},
			Max: engo.Point{
				X: (cell.Position.X + float32(cell.Width)) / s.width,
				Y: (cell.Position.Y + float32(cell.Height)) / s.height,
			},
		},
	}

	return s.cache[index]
}
353830
func (c *Context) BindTexture(target int, texture *js.Object) {
	c.Call("bindTexture", target, texture)
}
479074
func NewTextureResource(img Image) TextureResource {
	id := UploadTexture(img)
	return TextureResource{Texture: id, Width: float32(img.Width()), Height: float32(img.Height())}
}
744442
func NewStartWithBigInt(now time.Time, mod *big.Int, nPlayers int) Start {
	ret := newStart(now, nPlayers)
	ret.Params = NewFlipParametersWithBig(mod.Bytes())
	return ret
}
79768
func (glpeer *GLPeer) MakeTextureByText(text string, fontsize float64, fontcolor color.RGBA, rect image.Rectangle) sprite.SubTex {
	simlog.FuncIn()

	glpeer.mu.Lock()
	defer glpeer.mu.Unlock()

	dpi := float64(72)
	width := rect.Dx()
	height := rect.Dy()
	img := image.NewRGBA(image.Rect(0, 0, width, height))

	fg, bg := image.NewUniform(fontcolor), image.Transparent
	draw.Draw(img, img.Bounds(), bg, image.Point{}, draw.Src)

	// Draw the text.
	h := font.HintingNone

	gofont, err := truetype.Parse(goregular.TTF)
	if err != nil {
		panic(err)
	}

	d := &font.Drawer{
		Dst: img,
		Src: fg,
		Face: truetype.NewFace(gofont, &truetype.Options{
			Size:    fontsize,
			DPI:     dpi,
			Hinting: h,
		}),
	}

	textWidth := d.MeasureString(text)

	d.Dot = fixed.Point26_6{
		X: fixed.I(width/2) - textWidth/2,
		Y: fixed.I(int(fontsize * dpi / 72)),
	}
	d.DrawString(text)

	t, err := glpeer.eng.LoadTexture(img)
	if err != nil {
		log.Fatal(err)
	}

	simlog.FuncOut()
	return sprite.SubTex{T: t, R: rect}
}
41264
func (sc *SpriteContainer) AddSprite(s *Sprite, subTex *sprite.SubTex, arrangeCallback func()) error {
	simlog.FuncIn()
	var sn *spriteNodePair
	i, ok := sc.spriteNodePairs.Load(s)
	if !ok {
		sn = &spriteNodePair{}
	} else {
		sn = i.(*spriteNodePair)
		if sn.inuse {
			return fmt.Errorf("this sprite is already added and currently still being available")
		}
	}

	sn.sprite = s
	if sn.znode == nil {
		sn.znode = sc.gl.NewNode(func(eng sprite.Engine, n *sprite.Node, t clock.Time) {
			if arrangeCallback != nil {
				arrangeCallback()
			}
		})
		sc.spriteNodePairs.Store(s, sn)
	}
	sc.gl.AppendNode(sn.znode)
	sn.inuse = true
	if subTex != nil {
		sc.gl.SetSubTex(sn.znode, subTex)
	}
	simlog.FuncOut()
	return nil
}
1154602
func (renderer *Renderer) CreateTextureFromSurface(surface *Surface) (*Texture, error) {
	texture := C.SDL_CreateTextureFromSurface(renderer.cptr(), surface.cptr())
	if texture == nil {
		return nil, GetError()
	}
	return (*Texture)(unsafe.Pointer(texture)), nil
}
108685
func (sprite *sprite) ReplaceTexture(texture *Texture) {
	simlog.FuncIn()
	// retain reference for texture to avoid to be discarded by GC
	sprite.texture = texture
	sc := sprite.simra.spritecontainer
	sc.ReplaceTexture(&sprite.Sprite, texture.texture)
	simlog.FuncOut()
}
340596
func NewStartWithBool(now time.Time, nPlayers int) Start {
	ret := newStart(now, nPlayers)
	ret.Params = NewFlipParametersWithBool()
	return ret
}
747171
func NewStaticLevelWriter(w io.Writer, level Level) *StaticLevelWriter {
	levelPrefix := []byte{ReverseLevels[level], '!', ' '}
	return &StaticLevelWriter{
		levelPrefix: levelPrefix,
		w:           w,
	}
}
220683
func (c *Overlay) HighlightRectWithParams(v *OverlayHighlightRectParams) (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Overlay.highlightRect", Params: v})
}
748436
func Colors(nextSlide func()) (title string, content tview.Primitive) {
	table := tview.NewTable().
		SetBorders(true).
		SetBordersColor(tcell.ColorBlue).
		SetDoneFunc(func(key tcell.Key) {
			nextSlide()
		})
	var row, column int
	for _, word := range strings.Split(colorsText, " ") {
		table.SetCellSimple(row, column, word)
		column++
		if column > 6 {
			column = 0
			row++
		}
	}
	table.SetBorderPadding(1, 1, 2, 2).
		SetBorder(true).
		SetTitle("A [red]c[yellow]o[green]l[darkcyan]o[blue]r[darkmagenta]f[red]u[yellow]l[white] [black:red]c[:yellow]o[:green]l[:darkcyan]o[:blue]r[:darkmagenta]f[:red]u[:yellow]l[white:] [::bu]title")
	return "Colors", Center(78, 19, table)
}
983565
func (c *contractMaturityReport) AddLimboStage1SuccessHtlc(kid *kidOutput) {
	c.limboBalance += kid.Amount()

	c.htlcs = append(c.htlcs, htlcMaturityReport{
		outpoint: *kid.OutPoint(),
		amount:   kid.Amount(),
		stage:    1,
	})
}