Closed caiovlp closed 6 months ago
I'm trying to rotate an image with transform rotate or scale and neither seem to be working. Here's an example:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" id="svg89" version="1.1" viewBox="0 0 100 100" transform="scale(-1 -1)"> <g id="test" class="test"> <path xmlns="http://www.w3.org/2000/svg" d="M30,76q6-14,13-26q6-12,14-23q8-12,13-17q3-4,6-6q1-1,5-2q8-1,12-1q1,0,1,1q0,1-1,2q-13,11-27,33q-14,21-24,44q-4,9-5,11q-1,2-9,2q-5,0-6-1q-1-1-5-6q-5-8-12-15q-3-4-3-6q0-2,4-5q3-2,6-2q3,0,8,3q5,4,10,14z" fill="green"/> </g> </svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" id="svg89" version="1.1" viewBox="0 0 100 100" transform="rotate(180)"> <g id="test" class="test"> <path xmlns="http://www.w3.org/2000/svg" d="M30,76q6-14,13-26q6-12,14-23q8-12,13-17q3-4,6-6q1-1,5-2q8-1,12-1q1,0,1,1q0,1-1,2q-13,11-27,33q-14,21-24,44q-4,9-5,11q-1,2-9,2q-5,0-6-1q-1-1-5-6q-5-8-12-15q-3-4-3-6q0-2,4-5q3-2,6-2q3,0,8,3q5,4,10,14z" fill="green"/> </g> </svg>
Both are valid SVGs and are rotated correctly on the browser but yield a blank image when using lunasvg.
For reference, this is how I'm using it to render an SVG with OpenGL:
auto bitmap = document->renderToBitmap(); bitmap.convertToRGBA(); GLuint textureID; glGenTextures(1, &textureID); glBindTexture(GL_TEXTURE_2D, textureID); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmap.width(), bitmap.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap.data()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
Here's the original image rendered successfully:
Here's the rotated image blank:
Interesting https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin
Fixed. If you are experiencing any issues, let me know; otherwise, close this issue.
That was really fast. Looks great! Thanks
I'm trying to rotate an image with transform rotate or scale and neither seem to be working. Here's an example:
Both are valid SVGs and are rotated correctly on the browser but yield a blank image when using lunasvg.
For reference, this is how I'm using it to render an SVG with OpenGL:
Here's the original image rendered successfully:![Oirignal](https://github.com/sammycage/lunasvg/assets/2237461/1b9eaf31-a7bf-469b-b293-a4cc3753cc62)
Here's the rotated image blank:![Rotated](https://github.com/sammycage/lunasvg/assets/2237461/80fb79d1-c95d-4079-bb29-0bdbe8c5ec5d)