当前位置: 首页>>代码示例>>Golang>>正文


Golang Rect.H方法代码示例

本文整理汇总了Golang中github.com/google/gxui/math.Rect.H方法的典型用法代码示例。如果您正苦于以下问题:Golang Rect.H方法的具体用法?Golang Rect.H怎么用?Golang Rect.H使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/google/gxui/math.Rect的用法示例。


在下文中一共展示了Rect.H方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: blitRect

func (b *blitter) blitRect(ctx *context, dstRect math.Rect, color gxui.Color, ds *drawState) {
	b.commitGlyphs(ctx)
	dstRect = dstRect.Offset(ds.OriginPixels)
	dw, dh := ctx.sizePixels.WH()
	mPos := math.CreateMat3(
		+2.0*float32(dstRect.W())/float32(dw), 0, 0,
		0, -2.0*float32(dstRect.H())/float32(dh), 0,
		-1.0+2.0*float32(dstRect.Min.X)/float32(dw),
		+1.0-2.0*float32(dstRect.Min.Y)/float32(dh), 1,
	)

	b.quad.draw(ctx, b.colorShader, uniformBindings{
		"mPos":  mPos,
		"Color": color,
	})
	b.stats.drawCallCount++
}
开发者ID:linux-mac,项目名称:gxui,代码行数:17,代码来源:blitter.go

示例2: blit

func (b *blitter) blit(ctx *context, tc *textureContext, srcRect, dstRect math.Rect, ds *drawState) {
	b.commitGlyphs(ctx)

	dstRect = dstRect.Offset(ds.OriginPixels)
	sw, sh := tc.sizePixels.WH()
	dw, dh := ctx.sizePixels.WH()

	var mUV math.Mat3
	if tc.flipY {
		mUV = math.CreateMat3(
			float32(srcRect.W())/float32(sw), 0, 0,
			0, -float32(srcRect.H())/float32(sh), 0,
			float32(srcRect.Min.X)/float32(sw),
			1.0-float32(srcRect.Min.Y)/float32(sh), 1,
		)
	} else {
		mUV = math.CreateMat3(
			float32(srcRect.W())/float32(sw), 0, 0,
			0, float32(srcRect.H())/float32(sh), 0,
			float32(srcRect.Min.X)/float32(sw),
			float32(srcRect.Min.Y)/float32(sh), 1,
		)
	}
	mPos := math.CreateMat3(
		+2.0*float32(dstRect.W())/float32(dw), 0, 0,
		0, -2.0*float32(dstRect.H())/float32(dh), 0,
		-1.0+2.0*float32(dstRect.Min.X)/float32(dw),
		+1.0-2.0*float32(dstRect.Min.Y)/float32(dh), 1,
	)
	if !tc.pma {
		gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	}
	b.quad.draw(ctx, b.copyShader, uniformBindings{
		"source": tc,
		"mUV":    mUV,
		"mPos":   mPos,
	})
	if !tc.pma {
		gl.BlendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)
	}
	b.stats.drawCallCount++
}
开发者ID:linux-mac,项目名称:gxui,代码行数:42,代码来源:blitter.go


注:本文中的github.com/google/gxui/math.Rect.H方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。