Blurry offset paths when canvas is scaled under hardware acceleration

前端 未结 3 952
情话喂你
情话喂你 2020-12-29 15:48

My application uses a canvas that I scale so that I can specify path points in meters instead of pixels. When I scale the canvas, then draw a line using path.lineTo()<

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 16:53

    This is a limitation of the hardware accelerated renderer. Paths are rasterized at their native size before transform. In your case, the Path is transformed into a 1x4 texture. That texture is then scaled at draw time. To work around this, scale your Path directly by using Path.transform(Matrix). You can also use scaled coordinates when building the path.

提交回复
热议问题