ngorelic@csm9a.UUCP (Noel Gorelick) (06/10/88)
I'm trying to display an image in a window in a screen. Simple, No? I have opened the screen with depth=5, and opened the window without any problems. My image is a dpaint brush (the moon from DpaintI), and was made with Brush2C, and is included as a .h file. So when I tell it to DisplayImage(r,&picture,0,0), how come all I get is a blank window? Am I missing some fundamental thinggy, or what? Here's the code: It's short, but the image file was too long to include. /* <all it has is the actual hexnumbers anyway> */ ---- source "prog.c"----- #include <exec/types.h> #include <intuition/intuition.h> #include <brush/moon.h> struct Image picture = { 0,0, /* LeftEdge, TopEdge */ 53,47,5, /* Width, Height, Depth */ &pictureData[0], 31,0, /* PlanePick, PlaneOnOff */ NULL, /* Pointer to next Image */ }; struct IntuitionBase *IntuitionBase; struct RastPort *r; struct NewScreen SS1 = { 0,0,640,200,3, /* LEdge,TEdge,Width,Height,Depth */ 1,2, /* DetailPen,BlockPen */ NULL, /* ViewModes */ CUSTOMSCREEN, /* Type */ NULL, /* *Font */ "Screen", /* Title */ NULL,NULL /* Gadgets,CustomBitMap */ }; struct NewWindow WW1 = { 0,0,640,200, /* LEdge,TEdge,Width,Height */ -1,-1, /* DetailPen,BlockPen */ NULL, /* IDCMP */ ACTIVATE|SMART_REFRESH|BORDERLESS|GIMMEZEROZERO, NULL,NULL, /* FirstGadget,CheckMark */ NULL, /* Title */ NULL, /* Screen <- fill this in when we make it */ NULL, /* BitMap */ 0,0,0,0, /* MinW,MinH,MaxW,MaxH <- Defaults to W,H */ CUSTOMSCREEN /* Type */ }; struct Window *W1; struct Screen *S1; #define I_REV 33 main() { VOID delay_f(); if(!(IntuitionBase=(struct IntuitionBase *) OpenLibrary("intuition.library",I_REV))) { printf("cant open intbase"); exit(); } /* open screen and window */ S1 = (struct Screen *)(OpenScreen(&SS1)); WW1.Screen = S1; W1=(struct Window *)(OpenWindow(&WW1)); r=W1->RPort; DrawImage(r,&picture,0,0); CloseWindow(W1); CloseScreen(S1); } /* -------- moon.h ---------- <image file> */ USHORT pictureData[] = { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0400,0x0000,0x0000, ... you get the idea ... } ---------------------------------------------------------------- "You want it should sing too?" | ngorelic@csm9a <Never have figured out what goes here> ...isis!csm9a!ngorelic "Dis-Claimer Dat-Claimer, to look at | hpuecoa!bgphp1!ngorelic at 'em, you'd never know the diff." | deutero!bgphp1!ngorelic
avery@puff.cs.wisc.edu (Aaron Avery) (06/11/88)
Your code appears to be missing something. You never seem to set the screen's color palette. You can use LoadRGB4 or SetRGB4 to do this. -- Aaron Avery (avery@puff.cs.wisc.edu) ({seismo,caip,allegra,harvard,rutgers,ihnp4}!uwvax!puff!avery)
rlcarr@athena.mit.edu (Rich Carreiro) (06/11/88)
You'll probably hear this from a million people, but make sure the image data (the pictData array in your case) is in CHIP memory. Either use AllocMem and copy it to CHIP, or use your compiler options to force data hunks into CHIP. I had the same problem compiling some example programs I had (like speechtoy, dadc, etc.) when I added memory because the preinitialized data was ending up in FAST and the custom chips couldn't touch it. If, on the other hand, o Amiga gods, I completely misunderstood the way CHIP mem is working here, please forgive a lowly Amiga programming novice. Thankk you for your continued support. ******************************************************************************* * Rich Carreiro "...and she's buying a stairway to heaven." * * rlcarr@athena.mit.edu - "Stairway to Heaven" by Led Zeppelin * *******************************************************************************
cmcmanis%pepper@Sun.COM (Chuck McManis) (06/11/88)
In article <740@csm9a.UUCP> ngorelic@csm9a.UUCP (Noel Gorelick) writes: >I'm trying to display an image in a window in a screen. Simple, No? Pretty basic stuff... >I have opened the screen with depth=5, and opened the window without any >problems. My image is a dpaint brush (the moon from DpaintI), and was >made with Brush2C, and is included as a .h file. > >So when I tell it to DisplayImage(r,&picture,0,0), how come all I get is >a blank window? Am I missing some fundamental thinggy, or what? I betcha you have fast ram and don't tell AmigaDOS to force the loading of the picture data into chip ram. Am I right? Two solutions, run FixHunk on your executable (it's on Fish Disk 6 or so) or check to see if your picture data is in chip ram if (TypeOfMem(picturedata) & MEMF_CHIP) /* I'm in chip */ and if it isn't AllocMem some chip ram, copy it in and then call DrawImage on the copy in CHIP ram. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you.
berry@hor-res.UUCP (No comment) (06/14/88)
In article <740@csm9a.UUCP>, ngorelic@csm9a.UUCP (Noel Gorelick) writes: > > > > I'm trying to display an image in a window in a screen. Simple, No? > > I have opened the screen with depth=5, and opened the window without any Ahh, according to the source here the screen is depth "3". > #include <exec/types.h> > #include <intuition/intuition.h> > #include <brush/moon.h> Technically "moon" is a C data structure (I'd call it moon.c). no biggie though. > struct Image picture = { > 0,0, /* LeftEdge, TopEdge */ > 53,47,5, /* Width, Height, Depth */ Here you say the Image is 5 bit planes, in the screen structure you say you only want 3 bit planes. Intuition could be getting confused, or worse writing 3 bitplanes of pictureData and 2 bit planes of zeros. That's what plane pick on/off does, fills or zeros specified planes. > struct NewScreen SS1 = { > 0,0,640,200,3, /* LEdge,TEdge,Width,Height,Depth */ Change this | > 1,2, /* DetailPen,BlockPen */ > NULL, /* ViewModes */ I'd also make this HIRES instead of NULL. unless you want LORES. The rest looks ok. I'd get some sample programs from a BBS or look in the Intuition Reference (or Rom Kernal Manual) for some intro on Amiga programming. Keep trying, you'll get it. -- -Steve Berry- ...!bunny!hor-res!berry "Dare to be gorgeous and unique. But don't ever be cryptic or otherwise Unfathomable. Make it unforgettably great." Intuition Reference Manual, pg 231.