CompuServe Thread

#Screen Image HELP!

3 messages in this thread
#17641From: Steve Jackson GamesDec 11, 1991 4:29 PM
I'm having a bit of a problem popping a custom image up on a Screen. This is slightly modified from Andres' C Manual. When I add in a bunch of stuff for opening a window and use DrawImage (main_window, &titlescreen_image,0,0) it works fine, and draws the custom image on the screen. When I got rid of the Window routines and attempt to attach it to the Screen's RastPort, the image no longer appears. Any guesses? —- cut here —-#include <intuition/intuition.h> #include <intuition/screens.h> #include <graphics/display.h> #include "title.h" #define WIDTH 640 #define HEIGHT 400 #define DEPTH 4 struct IntuitionBase *IntuitionBase; struct GfxBase *GfxBase; struct Screen *main_screen; struct NewScreen my_new_screen= { 0, 0, WIDTH, HEIGHT, DEPTH, 0, 1, INTERLACE|HIRES, CUSTOMSCREEN, NULL, "Test 1.0", NULL, NULL }; /* Insert a big titlescreen_data[] collection here. */ struct Image titlescreen_image= { 0, 0, WIDTH, HEIGHT, DEPTH, titlescreen_data, 0x000F, 0x0000, NULL }; main() { IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library",0); GfxBase = (struct GfxBase *) OpenLibrary( "graphics.library", 0 ); main_screen= (struct Screen *) OpenScreen( &my_new_screen ); /* lots of color assignments using SETRGB4 deleted */ DrawImage( main_screen->RastPort, &titlescreen_image, 0, 0); /* This doesn't work */ Delay( 50 * 30); CloseScreen( main_screen ); CloseLibrary( GfxBase ); CloseLibrary( IntuitionBase ); }
#17645From: KEITH YOUNGDec 11, 1991 6:43 PM
Steve, Ok, looks like there are a few problems here… first off, your image 'data' will need to be in CHIP memory, you can get it there using a compiler keyword (SAS), link option (SAS/Manx) or by allocating some chip memory then copying the data there. Since you said that it worked on your window, I'll assume you already knew this and that that is not the problem. Next thing I see is that you have the image width/height set to the size of the screen… if the image IS that size, then this is ok too, otherwise, you'll need to set the image diminsions to the actual width/height of the imagery. And finally (and this is probably your problem) is that the Rastport in the screen structure is actually an 'instance' of a RastPort structure and not a pointer to one, so the DrawImage() call should be: DrawImage( &main_screen->RastPort, &titlescreen_image, 0, 0); I tried this using your code as a base and it works fine. Cheers, Keith
#17700From: Steve Jackson GamesDec 13, 1991 1:25 AM
Yep, that was the problem (&main_screen->RastPort). Now if I can just figure out why I'm losing 13K of chip memory every time I run it… Thanks! Loyd