Re: wrapping one image over other

New Message Reply Date view Thread view Subject view Author view

ceti (ceti++at++worldnet.net)
Wed, 26 Feb 1997 12:53:58 +0000


>yes, this is what i am looking for. i am familiar with showcase and
>image tools and importing the images to showcase. could u please
>tell me how to use the alpha channel and wherein this is available
>in showcase. thanks you for your mail sir
>parthi

when you insert sgi image file, showcase asks you if you want to use or discard
alpha channel: use it.

If showcase does the import directly, there is no alpha on your image.

then insert the second one.
If you put image 2 on image 1 then you'll see 1 trought 2.
if you need 2 throught 1, just push image 2 to the bottom of the stack.

Take care, when using imgworks, it adds a full opaque alpha bitplane, even
if the image had none before.

Now if you need to change this alpha, I can give you a C code that mix RGB
and a RGB black and white to create a RGBA image.

I use the color to greyscale option of imgworks to generate the B&W image.
The mask is taken in the first color buffer, so if it is .bw or .int it is
ok, if it is .rgb or .rgba, just the red buffer is taken as mask.

/*
* addalpha - Read RGB and RGB colored to grey scale images files
* to create a RGBA
*
* To compile: cc addalpha.c -o addalpha -limage
*
* BILLARD Olivier C&I Software
*
* parts from : SGI - Paul Haeberli - 1991
*/
#include <gl/image.h>

main(argc,argv)
int argc;
char **argv;
{
IMAGE *imagergb;
IMAGE *imagea;
IMAGE *imagergba;
int x, y, z;
short *rbuf, *gbuf, *bbuf,*abuf;

/* print usage message */
if( argc<4 )
        {
        fprintf(stderr,"usage: addalpha rgbinfile alphainfile outfile\n");
        exit(1);
        }

/* open the image file */
if( (imagergb=iopen(argv[1],"r")) == NULL )
        {
        fprintf(stderr,"addalpha: can't open input file %s\n",argv[1]);
        exit(1);
        }
if( (imagea=iopen(argv[2],"r")) == NULL )
        {
        fprintf(stderr,"addalpha: can't open input file %s\n",argv[2]);
        exit(1);
        }
if(
(imagergba=iopen(argv[3],"w",RLE(1),3,imagergb->xsize,imagergb->ysize,4)) ==
NULL )
        {
        fprintf(stderr,"addalpha: can't open input file %s\n",argv[3]);
        exit(1);
        }

/* print a little info about the image */
printf("Image x and y size in pixels: %d %d\n",imagergb->xsize,imagergb->ysize);
printf("Image zsize in channels: %d\n",imagergb->zsize);
printf("Image pixel min and max: %d %d\n",imagergb->min,imagergb->max);

/* allocate buffers for image data */
rbuf = (short *)malloc(imagergb->xsize*sizeof(short));
gbuf = (short *)malloc(imagergb->xsize*sizeof(short));
bbuf = (short *)malloc(imagergb->xsize*sizeof(short));
abuf = (short *)malloc(imagergb->xsize*sizeof(short));

imagergba->zsize >= 4;
for(y=0; y<imagergb->ysize; y++)
        {
        printf("row %d: \n",y);
        getrow(imagergb,rbuf,y,0);
        getrow(imagergb,gbuf,y,1);
        getrow(imagergb,bbuf,y,2);
        getrow(imagea,abuf,y,0);
        putrow(imagergba,rbuf,y,0);
        putrow(imagergba,gbuf,y,1);
        putrow(imagergba,bbuf,y,2);
        putrow(imagergba,abuf,y,3);

        }
        iclose(imagergb);
        iclose(imagea);
        iclose(imagergba);

printf("done\n");
}

==================================================================
      _/_/ _/ _/_/_/ _/ _/ _/_/_/ _/_/_/ _/_/_/
    _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
   _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/
  _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
  _/_/ _/_/_/ _/_/_/ _/ _/_/_/ _/_/_/ _/ _/
                                                               
     BILLARD Olivier - Engineer R&D - C&I Software
     1 avenue de la mer - 44380 PORNICHET - FRANCE
     Tel: +33 2 40 11 68 72 Fax: +33 2 40 61 68 14
  Email: ceti++at++worldnet.net URL:http://www.worldnet.net/~ceti
=================================================================
                          \\\|||///
                         \\ - - //
                          ( ++at++ ++at++ )
       +----------------oOOo-(_)-oOOo----------------------+
| " We don't inherit the world from our ancestors, |
| it's only a loan from our children ." |
| Antoine de Saint Exupery. |
       +-------------------------Oooo----------------------+
                         oooO ( )
                        ( ) ) /
                         \ ( (_/
                          \_)

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:44 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.