Status & Roadmap
Authors & License
Funding U++
Search on this site

SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo



BufferPainter : public Painter

BufferPainter is software implementation of Painter interface which uses ImageBuffer as the painting target.


Public Method List


ImageBuffer& GetBuffer()

const ImageBuffer& GetBuffer() const

Returns current output ImageBuffer.



BufferPainter& Co(bool b = true)

Activates multithreaded optimizations. Default is off. Activating makes sense for larger outputs



BufferPainter& PreClip(bool b = true)

If active, Painter tries to test whether actual path can intersect current output buffer and skips processing it completely if not. This can improve performance if rendering small part of very large drawing and actually sending everything to Painter anyway with transformations scaling and transforming content drawing to current ImageBuffer target. However, prechecking path has performance costs too so whether this option should be active or not depends on case by case basis. Default is off.



BufferPainter& ImageCache(bool b = true)

BufferPainter& NoImageCache()

Can be used to deactivate caching of image scaling data. Default of on. Probably best left on.



void Create(ImageBuffer& ib, int mode = MODE_ANTIALIASED)

Initializes Painter to target ib. mode can be MODE_ANTIALIASED (normal antialising, usually the best), MODE_NOAA (not recommened, obsolete), MODE_SUBPIXEL (improved horizontal resolution by subpixel rendering, slower). Note that it for performance reasons, it makes sense to reuse BufferPainter instance, especially if using multithreaded mode (Co) - it saves time for internal buffer allocations.



void Finish()

Makes sure that all scheduled painting operations are finished. Called by destructor



Constructor detail


BufferPainter(ImageBuffer& ib, int mode = MODE_ANTIALIASED)

Initializes BufferPainter and calls Create(ib, mode).



BufferPainter(PainterTarget& t, double tolerance = Null)

Special mode where rendering is targeted to PainterTarget. Experimental.




Default constructor. You are supposed to call Create to assign an ImageBuffer.





ImagePainter : public BufferPainter

Convenience class that extends BufferPainter to easily create Image output.


Constructor detail


ImagePainter(Size sz, int mode = MODE_ANTIALIASED)

ImagePainter(int cx, int cy, int mode = MODE_ANTIALIASED)

Creates Painter witch canvas of given size.


Public Method List


Image GetResult()

operator Image()

Finishes painting operations and returns resulting Image.





DrawPainter : public ImagePainter

Convenience method that simplifies using Painter in Ctrl::Draw. DrawPainter destructor writes resulting Image to the Draw surface.



Constructor detail


DrawPainter(Draw& w, Size sz, int mode = MODE_ANTIALIASED)

DrawPainter(Draw& w, int cx, int cy, int mode = MODE_ANTIALIASED)

Creates Painter object for current Draw, size should be in most cases be equal to Ctrl::Draw Size parameter.



Do you want to contribute?