Help with evaluating

6/11/2021 9:37 AM

Hi, I've downloaded the trial Cadlib and I have added a little bit of code to one of the examples (PdfExporterExample) to export a png file from my test dwg.

The export code seems to give more detail when I increase the values in..

config.NoOfArcLineSegments = 100;
config.NoOfSplineLineSegments = 100;
Size maxSize = new Size(15825, 15825);

The real problem I have is I need to know whether the exported png contains the fine level of details down to the pixel level (fonts / colours etc) of the entire layout, as this crucial for our needs; for our needs the exported png would be required to used in a production process. Seeing the image in filled orange makes it's basically impossible for us to make a purchasing decision or proper evaluation.

Any solution to this?

Kind Regards

6/11/2021 10:11 AM

Hi Jules,

I've authorized download of the CadLib production version for you, you can find it in your user profile under Your resources. Can you try it?

- Wout

6/11/2021 11:11 AM

Hi Wout, many thanks for your quick reply, I will take a look this afternoon and report back, much appreciated!

6/14/2021 1:45 PM

Hi, when I see my Cadlib dwg -> png export using my current code and settings in comparison to our existing workflow the results of Cadlib is greatly better (see pic right-side); however there are some small issues where the pixels aren't as smooth as we would need. Are there any GraphicsConfig settings or other settings we could use to make the output even smoother?

The code I have at present is..

GraphicsConfig config = (GraphicsConfig)GraphicsConfig.AcadLikeWithWhiteBackground.Clone();
config.NoOfArcLineSegments = 2000;
config.NoOfSplineLineSegments = 2000;
Size maxSize = new Size(15825, 15825);
Bitmap bitmap = ImageExporter.CreateAutoSizedBitmap(model, model.OrderedLayouts[10], null, Matrix4D.Identity, config, System.Drawing.Drawing2D.SmoothingMode.None, maxSize);

Thanks in advance :)

6/14/2021 1:49 PM

Just to note: the "SmoothingMode.None" is done on purpose, as we require the pixel edge to be aliased and not anti-aliased.

6/14/2021 2:16 PM

It looks like floating point rounding errors that I probably can't do much about. CadLib converts all curves to polylines and then sends those to GDI+ to create a bitmap, so it could hit one particular pixel depending on compounded rounding errors.

I'm close to finishing an alternative rendering pipeline, that gives finer control over the curve to polyline conversion, using a desired epsilon accuracy, but that will take maybe 1 or 2 months of more polishing and testing. And I would still expect it not to be immune to floating point rounding errors.

- Wout

6/15/2021 11:31 AM

Hi Wout, "It looks like floating point rounding errors that I probably can't do much about" yes I agree. It would interesting if Cadlib could pixel draw the primates in a visually pleasing manner rather than mathematically; Superpixelator is an interesting algorithm that draws primates but uses a visually pleasing manner algorithm, I'm not sure if that is of interest to you?

Currently Cadlib has the best raster output of the libs we have tried so far!

Is it possible to set Cadlib to rasterize only a section of the page, perhaps provide a Rect area or something?


6/15/2021 11:44 AM

"Is it possible to set Cadlib to rasterize only a section of the page, perhaps provide a Rect area or something?"

this comment was unrelated to the rasterization pixel quality; I just wanted to output a section of the page ;)

6/15/2021 12:29 PM


Is there a reason you need pixel perfect output by the way?

If you calculate your own transformation matrix you can rasterize any rectangle you want, you just specify which source rectangle you want to scale to the output rectangle. You can just adapt the example code.

- Wout