Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hpcvca!stan From: stan@hpcvca.CV.HP.COM (Stan Gibbs) Newsgroups: comp.sys.amiga.tech Subject: Trouble with Images Message-ID: <1410018@hpcvca.CV.HP.COM> Date: 16 May 89 17:17:00 GMT Organization: Hewlett-Packard Co., Corvallis, Oregon Lines: 75 I have been working my way through all of the Intuition functions, writing simple programs to test my understanding. I have been having real trouble with the Image structure and DrawImage() to create an image in a window. For all my effort, I can't seem to generate an image that corresponds to what I want. I have included the errant code below, and would appreciate any help. I am trying to simply create an hourglass shaped field inside a 16x16 image boundary. I can generate a solid field by setting PlanePick to 0x0000 and using PlaneOnOff to select the color -- no problem. But when I try to display the image data, I get an image which both does not correspond to what I think I'm asking for and is not constant, that is, from run to run the pixel colors are different. I'm not using any special compiler (LC5.0) or linker options. What am I missing? Pointers to example sources would be very useful. Thanks. ============================================================================ | Stan Gibbs | | stan@cv.hp.com || {hplabs,tektronix}!hp-pcd!stan | ============================================================================ #include #include struct Window *NoBorder; struct RastPort *r; USHORT imagepts[] = {0xffff,0x7ffe,0x3ffc,0x1ff8, 0x0ff0,0x07e0,0x03c0,0x03c0, 0x03c0,0x03c0,0x07e0,0x0ff0, 0x1ff8,0x3ffc,0x7ffe,0xffff, 0xffff,0x7ffe,0x3ffc,0x1ff8, 0x0ff0,0x07e0,0x03c0,0x03c0, 0x03c0,0x03c0,0x07e0,0x0ff0, 0x1ff8,0x3ffc,0x7ffe,0xffff}; struct Image picture = {0,0,16,16,2,NULL,0x0003,0x0000,NULL}; main() { ULONG flags,iflags; SHORT x,y,w,h; UBYTE c0,c1; extern VOID delay_func(),OpenIntuition(); OpenIntuition(); /* opens intuition, contains window support routines */ x = y = 0; w = 640; h = 200; c1 = 0x00; c0 = 0x01; flags = ACTIVATE | SMART_REFRESH | BORDERLESS; iflags = NULL; if ((NoBorder = (struct Window *) make_window(x,y,w,h,NULL,flags,iflags, c0,c1,NULL,NULL)) == NULL) { printf("Window Open Failed\n"); exit(); } picture.ImageData = imagepts; r = NoBorder->RPort; DrawImage(r,&picture,50,50); delay_func(100); CloseWindow(NoBorder); }