[comp.windows.x] converting suntools icon to X icon

john@UF.MSC.UMN.EDU (John Salmi) (07/28/87)

this is a quick & dirty hack to transpose your favorite suntools icon to
an X-readable icon.   if this has already been done, sorry.  if not, enjoy!

/* foo.c */

#define	vax_height	64
#define	vax_width	64
static	vax_bits[]	=	{
#include	"/uf/c/john/images/nude" /* your favorite suntools icon */
};

main()
{
	int	i, j, v, new;
	int	len;

	len = vax_height * vax_width / 16;
	printf("#define	vax_width	%d\n", vax_width);
	printf("#define	vax_height	%d\n", vax_height);
	printf("static	short	vax_bits[]	=	{");
	for(i=0; i < len; i++) {
		v = vax_bits[i];

		new = 0;
		for(j=0; j < 16; j++)
			if( v & (01 << j))
				new |= (01 << (15-j));

		if( (i % 8) == 0)	printf("\n\t");
		printf("0x%04x,", new & 0xffff);
	}
	printf("};\n");
}


---
	-john salmi
	-minnesota supercomputer center, inc.
	-minneapolis

	internet:  john@umn-rei-uc.arpa -or- john@uc.msc.umn.edu
	uucp:      {ihnp4, rutgers!meccts}!umn-cs!umnd-cs!jsalmi

	" instant asshole - just add alcohol "