🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #2842

Re: DrawImage() woes. (LONG)

#2842
From: Peter Cherna
Date: Fri, 19 Jan 1990 17:04
65 lines
2286 bytes
In article <1990Jan17.101103.10084@gdt.bath.ac.uk> mapjilg@gdr.bath.ac.uk (J I L Gold) writes:
>Is your image in chip RAM? If not, that's probably why you get junk.

Yes on this count.

>If your C compiler supports it, write
>	struct Image chip Hope = {...
>or if not,
>	struct Image Hope;
>	struct Image *ChipHope;
>	.
>	.
>	.
>	ChipHope = (struct Image *)AllocMem(sizeof(struct Image),
>						MEMF_CHIP|MEMF_CLEAR);
>OK?


Emphatic NOT OK on this count.

You've fallen victim to a common misconception.  It is not the Image
_structure_ itself that needs to be in chip RAM, but the Image _DATA_.
So you really want to say


    UWORD chip myImageData[] =
	{
	/*  hex uwords describing your image */
	};

    struct Image myImage =
	{
	..., ...,	/* Image LeftEdge and TopEdge */
	..., ...,	/* Image Width and Height */
	...,		/* Image Depth */
	myImageData,	/* Pointer to Image Data */
	..., ...,	/* Image PlanePick and PlaneOnOff */
	...,		/* NextImage (usually NULL) */
	};

If your compiler doesn't support the "chip" keyword, then
leave out the word "chip" above and say

	ChipData = (UWORD *)AllocMem(sizeof(ImageData), MEMF_CHIP);
	if (ChipData)
	    {
	    CopyMem(ImageData, ChipData, sizeof(ImageData));
	    myImage.ImageData = ChipData;
	    ...
	    }
	else
	    {
	    /*  chip mem allocation failed */
	    }

>-- 
>-- 
>#  J.Gold                            |    mapjilg@uk.ac.bath.gdr               #
>#  University of Bath , UK           |    jilg@uk.ac.bath.maths                #

     Peter
--
     Peter Cherna, Software Engineer, Commodore-Amiga, Inc.
     {uunet|rutgers}!cbmvax!peter    peter@cbmvax.cbm.commodore.com
My opinions do not necessarily represent the opinions of my employer.
Technical Details
Message-ID: <9389@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!oliveb!amiga!cbmvax!peter
References: <487@dsoft.UUCP> <1990Jan17.101103.10084@gdt.bath.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!oliveb!amiga!cbmvax!peter
From: peter@cbmvax.commodore.com (Peter Cherna)
Newsgroups: comp.sys.amiga.tech
Subject: Re: DrawImage() woes. (LONG)
Keywords: DrawImage(), PlanePick, PlaneOnOff
Message-ID: <9389@cbmvax.commodore.com>
Date: 19 Jan 90 17:04:34 GMT
References: <487@dsoft.UUCP> <1990Jan17.101103.10084@gdt.bath.ac.uk>
Reply-To: peter@cbmvax.commodore.com (Peter Cherna)
Organization: Commodore, West Chester, PA
Lines: 65