我希望对边界框进行四舍五入。有没有一种方法可以轻松做到这一点?
我知道可以单独绘制一个圆形框并使它与文本框重叠,但这太麻烦了。这是因为我使用网格来生成我的所有弹跳框,而四舍五入的框函数接受相对于整个文档的参数。
您可以创建一个bounding_box,然后在其周围绘制一个rounded_rectangle,使用初始和当前光标位置来确定矩形的边界。这是我代码中的硬编码示例:
PADDING = 10
@current_cursor = cursor
bounding_box([0, @current_cursor], width: WIDTH) do
image1 = "#{Rails.root}/app/assets/images/app-icon.png"
image2 = "#{Rails.root}/app/assets/images/gui-logo.png"
clinic_data = [[' '],
['<font size="13"><b>Los Angeles Test Medical Center</b></font>'],
['<font size="9">56 Berent Ave. New York, NY 07002</font>'],
['<font size="9">Tel: 212-541-1900 Fax: 212-541-1199</font>']
]
clinic_table = make_table clinic_data, column_widths: [275], cell_style: {borders: {}, inline_format: true, padding: 1, align: :center}
data = [[{image: image1, image_width: 50, image_height: 50, position: :center, vposition: :center},
'<font size="11">Structured Ultrasound Reporting<font>',
clinic_table,
{image: image2, image_width: 75, vposition: :center, position: :right}]]
table(data, column_widths: [75, 80, 275], cell_style: {borders: {}, inline_format: true, valign: :center})
end
stroke do
rounded_rectangle [0, @current_cursor + 5], WIDTH + 5, @current_cursor - cursor + PADDING, 10
end
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句