Method Image.GIF.render_block()
- Method render_block
string render_block(object img, object colortable, int x, int y, int localpalette)
string render_block(object img, object colortable, int x, int y, int localpalette, object alpha)
string render_block(object img, object colortable, int x, int y, int localpalette, object alpha, int r, int g, int b)
string render_block(object img, object colortable, int x, int y, int localpalette, int delay, int transp_index, int interlace, int user_input, int disposal)
string render_block(object img, object colortable, int x, int y, int localpalette, object alpha, int r, int g, int b, int delay, int interlace, int user_input, int disposal)- Description
-
This function gives a image block for placement in a GIF file, with or without transparency. The some options actually gives two blocks, the first with graphic control extensions for such things as delay or transparency.
Example:
img1=<ref>Image.Image</ref>([...]); img2=<ref>Image.Image</ref>([...]); [...] // make your very-nice images nct=<ref>Image.Colortable</ref>([...]); // make a nice colortable write(<ref>Image.GIF.header_block</ref>(xsize,ysize,nct)); // write a GIF header write(<ref>Image.GIF.render_block</ref>(img1,nct,0,0,0,10)); // write a render block write(<ref>Image.GIF.render_block</ref>(img2,nct,0,0,0,10)); // write a render block [...] write(<ref>Image.GIF.end_block</ref>()); // write end block // voila! A GIF animation on stdout.
The above animation is thus created:
object nct=Image.Colortable(lena,32,({({0,0,0})})); string s=GIF.header_block(lena->xsize(),lena->ysize(),nct); foreach ( ({lena->xsize(), (int)(lena->xsize()*0.75), (int)(lena->xsize()*0.5), (int)(lena->xsize()*0.25), (int)(1), (int)(lena->xsize()*0.25), (int)(lena->xsize()*0.5), (int)(lena->xsize()*0.75)}),int xsize) { object o=lena->scale(xsize,lena->ysize()); object p=lena->clear(0,0,0); p->paste(o,(lena->xsize()-o->xsize())/2,0); s+=Image.GIF.render_block(p,nct,0,0,0,25); } s+=Image.GIF.netscape_loop_block(200); s+=Image.GIF.end_block(); write(s);
- Parameter img
-
The image.
- Parameter colortable
-
Colortable with colors to use and to write as palette.
- Parameter x
- Parameter y
-
Position of this image.
- Parameter localpalette
-
If set, writes a local palette.
- Parameter alpha
-
Alpha channel image; black is transparent.
- Parameter r
- Parameter g
- Parameter b
-
Color of transparent pixels. Not all decoders understands transparency. This is ignored if localpalette isn't set.
- Parameter delay
-
View this image for this many centiseconds. Default is zero.
- Parameter transp_index
-
Index of the transparent color in the colortable. -1 indicates no transparency.
- Parameter user_input
-
If set: wait the delay or until user input. If delay is zero, wait indefinitely for user input. May sound the bell upon decoding. Default is non-set.
- Parameter disposal
-
Disposal method number;
- Note
-
This is in the advanced sector of the GIF support; please read some about how GIFs are packed.
The user_input and disposal method are unsupported in most decoders.
- See also