preRender.py 文件源码

python
阅读 45 收藏 0 点赞 0 评论 0

项目:gsTiles 作者: schmidtc 项目源码 文件源码
def getContext(surface, tx, ty, zoom):
    """
    getContext -- Preps a cairo context for a tile

    """
    ctx = cairo.Context(surface)
    ctx.set_antialias(cairo.ANTIALIAS_NONE)
    ctx.set_line_join(cairo.LINE_JOIN_BEVEL)

    numtiles = 2**zoom
    meters_per_tile = SPHEREMERC_GROUND_SIZE / numtiles

    #3rd
    ctx.translate(-WIDTH*tx, -HEIGHT*ty) #shift to tile coords
    #2nd
    ctx.scale(WIDTH / meters_per_tile, -HEIGHT / meters_per_tile) #scale to pixels
    #1st
    ctx.translate(SPHEREMERC_GROUND_SIZE/2.0, -SPHEREMERC_GROUND_SIZE/2.0) #shift origin.
    return ctx
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号