Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How to change color of annotate multi-text ?

Wu Kenneth
2010-03-11
2013-03-27
  • Wu Kenneth
    Wu Kenneth
    2010-03-11

    I am trying to annotate text onto a picture.
    I use fillColor("black") to set color of line 1(text),
    and I change color to "red" or "blue", then I do "annotate" again,
    but it seems to not work, the text on the picture only one color (black).

    =========  code  ================
    Image backGround(arg->background->fileName);

            backGround.density(arg->background->density);
            backGround.fontPointsize(arg->background->fontPointsize);
            backGround.font(arg->background->usedFontFileName);
            if (arg->background->strokeColor)
                backGround.strokeColor(Color());
            backGround.fillColor(arg->background->fillColor);
            // Start to annotate
            Image pic = backGround;

            for (int i = 0; i < arg->nmOfAnnotatedText; i++) {
                pic.annotate(arg->annotatedTextInfo_.text, arg->annotatedTextInfo.locationStr);
            }
            // Start to do animation
            // Start to create output picture
    ======================

    If any, please inform me.
    Thanks!
    _

     
  • Wu Kenneth
    Wu Kenneth
    2010-03-11

    Sorry, I want to add some message…

    I annotate line 1 using black,  and I want to annotate line 2 using blue, line 3 using red or green ……  
    annotate text on One picture using multi-color.

     
  • >  if (arg->background->strokeColor)
    >  backGround.strokeColor(Color());

    I think this will only set the stroke color if it isn't already
    defined.  Try removing the "if" clause to reset it each
    time.

    Glenn

     
  • Wu Kenneth
    Wu Kenneth
    2010-03-12

    Thank you, I will try it.