createComponentSnapShot has no antialiasing?

Hello - I am making a JUCE app which, in addition to rendering to the computer monitor, uses component::createComponentSnapshot to create an Image, and then makes that Image into a Jpeg. The resultant JPEG is output to a screen on our device, and doesn;t have any anti aliasing applied to path based graphic elements. Interestingly, Fonts rendered like this are anti aliased. Is there a way to get the Path drawn elements to have antialiasing?

If your device’s display is high-resolution, it’s possible that the call to createComponentSnapshot is using a lower scale factor than your display requires. It might be worth checking that the size of the snapshot you create matches the physical rather than logical dimensions that you expect. If necessary, you can pass an explicit scale factor to createComponentSnapshot. For example, if your device has 2 physical pixels for each logical pixel in each dimension, you would pass a scaleFactor of 2.0f.

It’s an 800 * 480 screen, and the dimensions of the component are also 800*480.

I just tried modifying the GraphicsDemo so that it saves a snapshot to a jpeg file on my desktop on a 1-second timer. The output looks properly anti-aliased here:

Can you provide any more details which might be relevant? What platform are you running on? Are you using a recent JUCE version? Is there anything special about the paths you’re drawing?

The platform is Windows, I am using the most recent version of JUCE and the paths which are poorly aliased are CenteredArcs

The same test on Windows looks fine here. Maybe I’m misunderstanding the problem - could you provide a screenshot showing what you’re currently seeing?

Also, is it possible that you’re drawing multiple arcs over the top of each other? I think this could lead to anti-aliasing problems. For example, if I modify the demo so that it draws the same path 20 times each frame, then it becomes much more pixelated:

I think this is because the transparent pixels around the edge of the shape end up getting added repeatedly, making them much darker than they should be to produce a ‘smooth’ shape. If you’re drawing lots of similar stacked shapes, you might need to try avoiding drawing shapes in the background where possible.

I’ll give limiting background drawing. I am: Drawing some shapes using paths, and a fill ellipse; creating a component snapshot image, then using a JPEGImageFormat to write the image to a MemoryOutputStream. This stream is written to our device.

That was it. The painting of the paths over and over caused the blocky aliasing. Thanks for the help!!