How to... get foreground and background color in a shape?

Thorsten Zachmann t.zachmann at zagge.de
Mon Mar 12 16:17:29 GMT 2012


On Monday, March 12, 2012 16:20:03 Friedrich W. H. Kossebau wrote:
> Hi,
> 
> hopefully soon a new version of the prison library is released, which will
> enable me to easily control the foreground and background colors of the
> barcode image, without doing my own QImage manipulation hacks which I
> avoided so far, so it's just black on white for now.
> 
> But after an initial quick code browsing I could not see yet how foreground
> and background colors are handled in the shapes.
> 
> Could anybody please give me some pointers how to expose the foreground and
> background color properties of a shape, so they can be controlled by the
> color tools e.g. in the bottom panel?

The following functions are there to set the background and border

void KoShape::setBackground(KoShapeBackground *fill)

KoShape::setBorder(KoShapeBorderModel *border)

however they might do things a bit different to what you would like to do. If 
you just want to specify 2 colors and don't want support for gradients e.g. 
and not to be able to set it like for the other shapes then you can also add 2 
options to the option widget of the barcode.

Hope that helps,

Thorsten



More information about the calligra-devel mailing list