本文整理汇总了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++
}
示例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++
}