cppfw / svgren

:camera: SVG rendering library in C++
MIT License
206 stars 41 forks source link

Pixel layout & console output #89

Closed luc4s closed 3 years ago

luc4s commented 3 years ago

Hello,

First, thanks for your great work :)

I have some suggestions that would make my life a lot easier for a project I work on:

igagis commented 3 years ago

Hi,

1) The pixel format is somewhat outside of the library's scope. Internaly, rendering is done in RGBA 32 bit format, it is not possible to change it in runtime. So, supporting different pixel formats would mean converting the pixels after rasterization is done, and this looks like a functionality of some raster image manipulation library. Writing such conversion functions yourself is not a difficult task.

2) As far as I see, there should be no console output in normal operation in both debug and release builds. In release build there should be no any console output at all. In debug build there is some console output about some abnormal or suspicious situations. Do you use NuGet version of the library? Could you give examples of what console output you observe?

luc4s commented 3 years ago
  1. I already did implement such rearrangement myself, but since there is already some per pixel formatting happening there: https://github.com/cppfw/svgren/blob/fa92b8bcf57b5d934fceffdb08845e506ec6769c/src/svgren/canvas.cpp#L47-L80 I thought an option could have been added.
  2. Here is a sample of debug messages I get when loading an SVG:
    selector END
    selector chain END
    property name: fill
    property value: #008DD0
    style properties END
    selector class: AccentRoot
    selector END
    selector chain END
    property name: fill
    property value: #FF5504
    style properties END
    crawler::reset(): invoked
    crawler::reset(): invoked
    crawler::reset(): invoked
    crawler::reset(): invoked

    The SVG contains some CSS, could it be the reason?

igagis commented 3 years ago
  1. The BGR->RGB conversion in the code is only done for Cairo backend which is not used anymore, instead AGG is the default backend now which does not require that BGR->RGB.

  2. Ok, the output comes when loading SVG, then it comes from svgdom and cssdom libraries. I'll remove those prints.

igagis commented 3 years ago

Ok, I have removed the console output. Just update cssdom and svgdom to latest versions.

luc4s commented 3 years ago

Great, thank you :+1:.