Parcourir la source

* 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)))


git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2781 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
jylam il y a 16 ans
Parent
révision
bdabe44f3a
2 fichiers modifiés avec 31 ajouts et 0 suppressions
  1. +23
    -0
      pipi/context.c
  2. +8
    -0
      src/pipi.c

+ 23
- 0
pipi/context.c Voir le fichier

@@ -663,6 +663,29 @@ int pipi_command(pipi_context_t *ctx, char const *cmd, ...)
(val - 1) * sizeof(*ctx->images));
ctx->images[ctx->nimages - 1] = tmp;
}
else if(!strcmp(cmd, "line"))
{
char const *arg;
va_list ap;
int x1, y1, x2, y2, aa = 0, ret;
uint32_t color = 0;

if(ctx->nimages < 1)
return -1;

va_start(ap, cmd);
arg = va_arg(ap, char const *);
va_end(ap);

ret = sscanf(arg, "%d,%d,%d,%d,%08x,%d",
&x1, &y1, &x2, &y2, &color, &aa);
if(ret < 5) return -1;

ctx->images[ctx->nimages] = pipi_copy(ctx->images[ctx->nimages - 1]);
pipi_draw_line(ctx->images[ctx->nimages],
x1, y1, x2, y2, color, aa);
ctx->nimages++;
}
else
{
return -1;


+ 8
- 0
src/pipi.c Voir le fichier

@@ -228,6 +228,14 @@ int main(int argc, char *argv[])
if(pipi_command(ctx, "overlay") != 0)
return EXIT_FAILURE;
}
else if(!strcmp(argv[0], "--line"))
{
if(argv[6] == NULL)
return EXIT_FAILURE;
if(pipi_command(ctx, "line", argv[1]) != 0)
return EXIT_FAILURE;
argv++;
}
else if(!strcmp(argv[0], "--output") || !strcmp(argv[0], "-o"))
{
if(argv[1] == NULL)


Chargement…
Annuler
Enregistrer