浏览代码

Implement pipi_blit().

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3547 92316355-f0b4-4df1-b90c-862c8a59935f
master
sam 15 年前
父节点
当前提交
fb7d1905d2
共有 3 个文件被更改,包括 30 次插入0 次删除
  1. +1
    -0
      pipi/Makefile.am
  2. +28
    -0
      pipi/context.c
  3. +1
    -0
      pipi/pipi.h

+ 1
- 0
pipi/Makefile.am 查看文件

@@ -59,6 +59,7 @@ render_sources = \
render/screen.c

combine_sources = \
combine/blit.c \
combine/rgb.c \
combine/merge.c \
combine/minmax.c \


+ 28
- 0
pipi/context.c 查看文件

@@ -79,6 +79,7 @@ pipi_command_t const *pipi_get_command_list(void)
{ "wrap", 0 },
{ "combine", 0 },
{ "split", 0 },
{ "blit", 1 },
{ "mean", 0 },
{ "merge", 1 },
{ "min", 0 },
@@ -461,6 +462,33 @@ int pipi_command(pipi_context_t *ctx, char const *cmd, ...)
ctx->images[ctx->nimages - 3] = dst;
ctx->nimages -= 2;
}
else if(!strcmp(cmd, "blit"))
{
pipi_image_t *dst;
char const *arg;
va_list ap;
int x, y;

if(ctx->nimages < 2)
return -1;
va_start(ap, cmd);
arg = va_arg(ap, char const *);
va_end(ap);
x = atoi(arg);
arg = strchr(arg, 'x');
if(!arg)
return -1;
y = atoi(arg + 1);

dst = pipi_blit(ctx->images[ctx->nimages - 2],
ctx->images[ctx->nimages - 1], x, y);
if(dst == NULL)
return -1;
pipi_free(ctx->images[ctx->nimages - 2]);
pipi_free(ctx->images[ctx->nimages - 1]);
ctx->images[ctx->nimages - 2] = dst;
ctx->nimages--;
}
else if(!strcmp(cmd, "merge"))
{
pipi_image_t *dst;


+ 1
- 0
pipi/pipi.h 查看文件

@@ -167,6 +167,7 @@ __extern pipi_image_t *pipi_rgb(pipi_image_t *, pipi_image_t *, pipi_image_t *);
__extern pipi_image_t *pipi_red(pipi_image_t *);
__extern pipi_image_t *pipi_green(pipi_image_t *);
__extern pipi_image_t *pipi_blue(pipi_image_t *);
__extern pipi_image_t *pipi_blit(pipi_image_t *, pipi_image_t *, int, int);
__extern pipi_image_t *pipi_merge(pipi_image_t *, pipi_image_t *, double);
__extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
__extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);


正在加载...
取消
保存