-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite rendering to care about more complex transforms #149
Labels
enhancement
Improvement to an existing feature
Milestone
Comments
meyfa
added a commit
that referenced
this issue
Mar 6, 2022
This implements one part of issue #149. By basing the renderer for rectangles off of the path painting algorithms, we can easily obtain rotated and skewed rectangles. This would be very difficult to do manually especially for rectangles with rounded corners. Now, we can simply use the arc approximator to construct a polygon. I was torn between basing the RectRenderer off of either the PathRenderer, which would be the obvious choice but would require needlessly constructing an intermediate command array, or the PolygonRenderer, which means we have to work with the ArcApproximator on a lower level but possibly get better performance. I chose the latter.
meyfa
added a commit
that referenced
this issue
Mar 6, 2022
This implements one part of issue #149. By basing the renderer for rectangles off of the path painting algorithms, we can easily obtain rotated and skewed rectangles. This would be very difficult to do manually especially for rectangles with rounded corners. Now, we can simply use the arc approximator to construct a polygon. I was torn between basing the RectRenderer off of either the PathRenderer, which would be the obvious choice but would require needlessly constructing an intermediate command array, or the PolygonRenderer, which means we have to work with the ArcApproximator on a lower level but possibly get better performance. I chose the latter.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Renderers such as the rect renderer currently assume only translation and scale transforms are present. This means that e.g. rotated rects cannot be rendered. Instead of computing the bottom-right corner AFTER the transform was applied to the top-left edge and size, we have to compute each corner first and then map them separately.
The following renderer types are affected:
Rect and ellipse can probably be implemented somewhat effectively by generating an equivalent path and rendering that via the path renderer (which supports every type of transform quite well). Transforming embedded SVG images should be doable, but embedded raster images might require a lot of work. For PHP >= 5.5.0 there is imageaffine() but I have no idea what to do on PHP 5.3 or 5.4. Text can be rotated via imagettftext(), but not skewed or non-uniformly scaled.
The text was updated successfully, but these errors were encountered: