当前位置:网站首页>Taishan Office Technology Lecture: from the layout height of the line, talk about the height overflow and height shrinkage of the drawing height (launched in the whole network)

Taishan Office Technology Lecture: from the layout height of the line, talk about the height overflow and height shrinkage of the drawing height (launched in the whole network)

2022-07-05 18:55:00 Liu Kunpeng

   In the previous post , I propose to remove , Row view except for font height , There is also a layout height . Now we have to put forward the concept of drawing height . What is the drawing height ? for instance , The layout height is 18.1, The height when drawing is generally 18, Maybe not . At this time, you need to draw the height .

   How does the drawing height come from ? The drawing height is caused by the fact that pixels are integers . For example, row height 18.1, from 96 Began to draw ,5 After that y The coordinates are 96+90.5. Obviously, it can't be floating-point pixels when drawing , So round it up , Namely 96+91. What about height ? The situation is even more complicated . According to the mantissa , There are actually four situations :

  • Draw height , Normal situation .y Decimal is less than 0.5,y+height Decimal is less than 0.5
  • Draw height , Normal situation .y The decimal is greater than 0.5,y+height The decimal is greater than 0.5
  • Draw height , Height shrinkage .y The decimal is greater than 0.5,y+height Decimal is less than 0.5

   At this time, the drawing height shrinks 1 Pixel , from 18 become 17.

  • Draw height , Height overflow .y Decimal is less than 0.5,y+height The decimal is greater than 0.5

   At this time, the drawing height overflows 1 Pixel , from 18 become 19.

原网站

版权声明
本文为[Liu Kunpeng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207051836205765.html