Exemplo n.º 1
0
int binary_cb(void)
{
    Image* tmp = gc.image;
    if (tmp != NULL) {
        IupSetfAttribute(gc.msgbar, "TITLE", "Grey scale image ...");
        gc.image = tmp->GreyCopy();
        repaint_cb(gc.canvas);   /* repaint canvas */
        delete tmp;
        tmp = gc.image;
        gc.image = tmp->Binary();
        repaint_cb(gc.canvas);   /* repaint canvas */
        delete tmp;
        IupSetfAttribute(gc.msgbar, "TITLE", "Binary scale image ...");
    }
    return IUP_DEFAULT;
}
Exemplo n.º 2
0
int count_cb(void)
{
    IupSetfAttribute(gc.msgbar, "TITLE", "Counting...");
    Image* tmp = gc.image;
    int count = 0;
    if (tmp != NULL) {
        gc.image = tmp->Binary();
        delete tmp;
        count = gc.image->Count();
        if (count > 0) {
            string c = "Components: " + std::to_string(count);
            IupSetfAttribute(gc.msgbar, "TITLE", c.c_str());
        }
    }

    repaint_cb(gc.canvas);   /* repaint canvas */
    return IUP_DEFAULT;
}