最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Blurry text in PDF created By Skia SkPicture? - Stack Overflow

programmeradmin2浏览0评论

I have referred this official document of skia, and the demo run well. /

I got a pdf document, and the texts in it stayed sharp after scale.

sharp texts

but when I tried to draw SkPicture on the Canvas Created by SkPDF, it seems the whole pdf is a BitMap? after scaling, the text became blurry looks like below.

    auto pdfDocument = SkPDF::MakeDocument(outputStream, metadata);
    SkCanvas* pageCanvas = pdfDocument->beginPage(pageSize.width(),
                                                      pageSize.height());

Blurry texts

the SkPicture is flatten by my rendertree using PictureRecorder. the text is showed normally in devices(android,ios...)

the painting of texts is much complext than the demo.

void Text::DrawTextBlob(TDFCanvas& canvas, SkPaint& paint, std::shared_ptr<TextRenderData> data, float y,
                        std::shared_ptr<MultiChildRenderObjWithData>& layout) {
  for (int i = 0; i < data->text_blobs.size(); ++i) {
    TextEffectElement effect_element(canvas, paint, data->text_blobs[i], data->x_offsets[i], y);
    DrawOrApplyEffects(effect_element, data, layout);
    canvas.drawTextBlob(data->text_blobs[i], data->x_offsets[i], y, paint);
    if (data->effect_lst && data->effect_lst->text_outline) {
      ApplyOutline(effect_element);
    }
  }
}

I want the texts not to be the bitmap and stay sharp after scale. what could be the problem?

发布评论

评论列表(0)

  1. 暂无评论