Changeset 2781 for libpipi


Ignore:
Timestamp:
Aug 27, 2008, 2:40:38 PM (12 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added line to pipi tool (format x1,y1,x2,y2,color,aa, width coordinates as ints, color as hex quadret, aa as an optionnal bit which controls

antialiasing (default: aliased (bracket)))

Location:
libpipi/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/context.c

    r2761 r2781  
    664664        ctx->images[ctx->nimages - 1] = tmp;
    665665    }
     666    else if(!strcmp(cmd, "line"))
     667    {
     668        char const *arg;
     669        va_list ap;
     670        int x1, y1, x2, y2, aa = 0, ret;
     671        uint32_t color = 0;
     672
     673        if(ctx->nimages < 1)
     674            return -1;
     675
     676        va_start(ap, cmd);
     677        arg = va_arg(ap, char const *);
     678        va_end(ap);
     679
     680        ret = sscanf(arg, "%d,%d,%d,%d,%08x,%d",
     681               &x1, &y1, &x2, &y2, &color, &aa);
     682        if(ret < 5) return -1;
     683
     684        ctx->images[ctx->nimages] = pipi_copy(ctx->images[ctx->nimages - 1]);
     685        pipi_draw_line(ctx->images[ctx->nimages],
     686                       x1,  y1,  x2,  y2, color, aa);
     687        ctx->nimages++;
     688    }
    666689    else
    667690    {
  • libpipi/trunk/src/pipi.c

    r2755 r2781  
    229229                return EXIT_FAILURE;
    230230        }
     231        else if(!strcmp(argv[0], "--line"))
     232        {
     233            if(argv[6] == NULL)
     234                return EXIT_FAILURE;
     235            if(pipi_command(ctx, "line", argv[1]) != 0)
     236                return EXIT_FAILURE;
     237            argv++;
     238        }
    231239        else if(!strcmp(argv[0], "--output") || !strcmp(argv[0], "-o"))
    232240        {
Note: See TracChangeset for help on using the changeset viewer.