支持<ofd:Rotate>非标准的页面旋转属性

auto area = xml_->GetFirstChildNamed_NoPrefix(L"Area");

if (area) {

bbox_ = doc_->ParseArea(area);

auto rotate = area->GetFirstChildNamed_NoPrefix(L"Rotate");

if (rotate) {

//auto angle_degree = StringToFloat(rotate->GetTextData().AsStringView());

auto angle_degree = rotate->GetTextData().GetInteger();

if (angle_degree != 0) {

 

page_ctm = CFX_Matrix();

page_ctm.Rotate(angle_degree *( FXSYS_PI / 180));

auto real_box = page_ctm.TransformRect(bbox_);

auto real_bbox = real_box.ToFloatRect();

auto temp = CFX_Matrix();

temp.Translate(-real_bbox.left, -real_bbox.bottom);

page_ctm.Concat(temp);

bbox_ = page_ctm.TransformRect(bbox_);

 

return;

}

}

实际上就是计算旋转后了外框和ctm

 

效果如下:

 

posted @ 2023-12-05 20:07  xiloureader  阅读(8)  评论(0)    收藏  举报