Re: Transparent textures - how to create?

New Message Reply Date view Thread view Subject view Author view

ceti (ceti++at++worldnet.net)
Wed, 02 Oct 1996 11:53:15 +0100


>Is there any simple downloadable tool to do this?
At the end sample of the code I'm using
>How can I specify a transparent color. ImgWorks doesn't seem to do it.
img works add an alpha layer that is constant and set to opaque.
to be sure , check using import image in showcase, if a layer is present,
showcase asks to use or discard it.
>We have ALIAS PowerAnimator 7.5 but we don't know if it can be done there.
may be I don't know.
-----
Photoshop is a good tool for this.

--- here a sample c prog addalpha
use : generate your rgb image and a black and white containing
your alpha information in sgi format.
then addalpha file.rgb mask.rgb out.rgba
to check, try the showcase import
/*
* from readimage
* BILLARD OLIVIER - 1992
* To compile: cc addalpha.c -o addalpha -limage
*
*
*/

#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,"readimage: can't open input file %s\n",argv[1]);
            exit(1);
         
    }

if( (imagea=iopen(argv[2],"r")) == NULL )
         
    {
         
    fprintf(stderr,"readimage: 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,"readimage: 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);

}

 /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
< _/_/ _/ _/_/_/ _/ _/ _/_/_/ _/_/_/ _/_/_/ >
< _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ >
< _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/ >
< _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ >
< _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ >
< _/_/ _/_/_/ _/_/_/ _/ _/_/_/ _/_/_/ _/ _/ >
< >
< BILLARD Olivier - Ingeneer R&D ++at++ C&I Software >
< 1 avenue de la mer - 44380 PORNICHET - FRANCE >
< Tel: +33 40 11 68 72 Fax: +33 140 61 68 14 >
< Email: ceti++at++worldnet.net >
 \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

=======================================================================
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:53:42 PDT

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