CGRectIntegral : Returns the smallest rectangle that results from converting the source rectangle values to integers. It's important that CGRect values all are rounded to the nearest whole point. Fractional values cause the frame to be drawn on a pixel boundary . Because pixels are atomic units (cannot be subdivided) a fractional value will cause the drawing to be averaged over the neighboring pixels, which looks blurry. CGRectIntegral will floor each origin value, and ceil each size value, which will ensure that your drawing code will crisply align on pixel boundaries. As a rule of thumb, if you are performing any operations that could result in fractional point values (e.g. division, CGRectGetMid[X|Y] , or CGRectDivide ), use CGRectIntegral to normalize rectangles to be set as a view frame. Technically, since the coordinate system operates in terms of points, Retina screens, which have 4 pixels for every point, can draw ± 0.5f point values on odd pixel...
Comments
Post a Comment