Exemplo n.º 1
0
static void ProcessBitmap(UnpackedBitmap *bitmap,const char *name,int numargs,const char **args)
{
    int x,y,w,h;
    if(numargs<4)
    {
        x=0;
        y=0;
        w=bitmap->width;
        h=bitmap->height;

        if(numargs>0) RunFilter(bitmap,args[0]);
    }
    else
    {
        x=atoi(args[0]);
        y=atoi(args[1]);
        w=atoi(args[2]);
        h=atoi(args[3]);

        TestRectangle(x,y,w,h,bitmap);

        if(numargs>4) RunFilter(bitmap,args[4]);
    }

    PrintPartialBitmapPixelArray(bitmap,x,y,w,h,name,0);

    printf("const Bitmap %s=",name);
    PrintPartialBitmapInitializer(bitmap,x,y,w,h,name,0,"");
    printf(";\n");
}
Exemplo n.º 2
0
static void ProcessAdaptiveBitmap(UnpackedBitmap *bitmap,const char *name,int numargs,const char **args)
{
    int x,y,w,h;
    if(numargs<4)
    {
        x=0;
        y=0;
        w=bitmap->width;
        h=bitmap->height;

        if(numargs>0) RunFilter(bitmap,args[0]);
    }
    else
    {
        x=atoi(args[0]);
        y=atoi(args[1]);
        w=atoi(args[2]);
        h=atoi(args[3]);

        TestRectangle(x,y,w,h,bitmap);

        if(numargs>4) RunFilter(bitmap,args[4]);
    }

    if(!IsPartialBitmapTransparent(bitmap,x,y,w,h)) PrintPartialBitmapPixelArray(bitmap,x,y,w,h,name,0);

    printf("const AdaptiveBitmap * const %s=",name);
    PrintAdaptiveBitmapPointerFromPartialBitmap(bitmap,x,y,w,h,name,0,"");
    printf(";\n");
}
Exemplo n.º 3
0
static void ProcessRLEBitmap(UnpackedBitmap *bitmap,const char *name,int numargs,const char **args)
{
    UnpackedRLEBitmap *rle;
    if(numargs<4)
    {
        if(numargs>0) RunFilter(bitmap,args[0]);

        rle=AllocRLEBitmapFromBitmap(bitmap);
    }
    else
    {
        int x=atoi(args[0]);
        int y=atoi(args[1]);
        int width=atoi(args[2]);
        int height=atoi(args[3]);

        TestRectangle(x,y,width,height,bitmap);

        if(numargs>4) RunFilter(bitmap,args[4]);

        rle=AllocRLEBitmapFromPartialBitmap(bitmap,x,y,width,height);
    }
    if(!rle) exit(1);

    printf("const RLEBitmap * const %s=\n(const RLEBitmap *)&(", name);
    PrintRLEStructDefinition(rle);
    printf(")");
    PrintRLEBitmapInitializer(rle,"");
    printf(";\n");

    free(rle);
}
Exemplo n.º 4
0
int WINAPI _export Message(unsigned long Msg,void *InData,void *OutData)
{
  switch(Msg)
  {
    case FMMSG_GETINFO:
      {
        GetInfoOutData *data=(GetInfoOutData *)OutData;
        GetMsg(mName,data->MenuString);
        lstrcpy(data->HotkeyID,"generic_filter");
        data->Flags=FMMSG_FILTER|FMMSG_CONFIG;
      }
      return TRUE;
    case FMMSG_FILTER:
      RunFilter(static_cast<MsgPanelInData *>(InData)->hPlugin,static_cast<MsgPanelInData *>(InData)->index);
      return TRUE;
    case FMMSG_CONFIG:
      Config();
      return TRUE;
  }
  return FALSE;
}
Exemplo n.º 5
0
PERROR
RunFilterCommand( FRAME *frame, STRPTR filtername, STRPTR args )
{
    PPTREXXARGS *ra;
    char buffer[100];
    PERROR res;

    if( !args ) args = "";

    if( ra = SimulateRexxCommand( frame, args ) ) {
        sprintf( buffer, "NAME=%s ARGS=%ld", filtername, ra->process_args );

        if( (res = RunFilter( frame, buffer )) != PERR_OK ) {
            ReplyRexxWaitItem( ra );
        }
    } else {
        res = PERR_OUTOFMEMORY;
    }

    return res;
}
Exemplo n.º 6
0
static void ProcessAdaptiveBitmapArray(UnpackedBitmap *bitmap,const char *name,int numargs,const char **args)
{
    int fw=atoi(args[0]);
    int fh=atoi(args[1]);

    if(fw<=0)
    {
        fprintf(stderr,"Invalid frame width.\n");
        exit(1);
    }

    if(fh<=0)
    {
        fprintf(stderr,"Invalid frame height.\n");
        exit(1);
    }

    int x,y,width,height;
    if(numargs<6)
    {
        x=0;
        y=0;
        width=bitmap->width;
        height=bitmap->height;
        if(numargs>2) RunFilter(bitmap,args[2]);
    }
    else
    {
        x=atoi(args[2]);
        y=atoi(args[3]);
        width=atoi(args[4]);
        height=atoi(args[5]);

        TestRectangle(x,y,width,height,bitmap);

        if(numargs>6) RunFilter(bitmap,args[6]);
    }

    int numcols=width/fw;
    int numrows=height/fh;

    for(int row=0; row<numrows; row++)
        for(int col=0; col<numcols; col++)
        {
            int n=col+row*numcols;
            int fx=x+col*fw;
            int fy=y+row*fh;
            if(!IsPartialBitmapTransparent(bitmap,fx,fy,fw,fh)) PrintPartialBitmapPixelArray(bitmap,fx,fy,fw,fh,name,n);
        }

    printf("const AdaptiveBitmap * const %s[%d]=\n",name,numcols*numrows);
    printf("{\n");

    for(int row=0; row<numrows; row++)
        for(int col=0; col<numcols; col++)
        {
            int n=col+row*numcols;
            int fx=x+col*fw;
            int fy=y+row*fh;
            PrintAdaptiveBitmapPointerFromPartialBitmap(bitmap,fx,fy,fw,fh,name,n,"\t");
            printf(",\n");
        }

    printf("};\n");
}
Exemplo n.º 7
0
static void ProcessRLEBitmapArray(UnpackedBitmap *bitmap,const char *name,int numargs,const char **args)
{
    int fw=atoi(args[0]);
    int fh=atoi(args[1]);

    if(fw<=0)
    {
        fprintf(stderr,"Invalid frame width.\n");
        exit(1);
    }

    if(fh<=0)
    {
        fprintf(stderr,"Invalid frame height.\n");
        exit(1);
    }

    int x,y,width,height;
    if(numargs<6)
    {
        x=0;
        y=0;
        width=bitmap->width;
        height=bitmap->height;
        if(numargs>2) RunFilter(bitmap,args[2]);
    }
    else
    {
        x=atoi(args[2]);
        y=atoi(args[3]);
        width=atoi(args[4]);
        height=atoi(args[5]);

        TestRectangle(x,y,width,height,bitmap);

        if(numargs>6) RunFilter(bitmap,args[6]);
    }

    int numcols=width/fw;
    int numrows=height/fh;

    printf("const RLEBitmap * const %s[%d]=\n",name,numcols*numrows);
    printf("{\n");

    for(int row=0; row<numrows; row++)
        for(int col=0; col<numcols; col++)
        {
            int fx=x+col*fw;
            int fy=y+row*fh;

            UnpackedRLEBitmap *rle=AllocRLEBitmapFromPartialBitmap(bitmap,fx,fy,fw,fh);
            if(!rle) exit(1);

            printf("\t(const RLEBitmap *)&(");
            PrintRLEStructDefinition(rle);
            printf(") ");
            PrintRLEBitmapInitializer(rle,"\t");
            printf(",\n");

            free(rle);
        }

    printf("};\n");
}