jopa@tkk.tele.fi (Jorma Paananen TKK-tt) (03/06/91)
I have troubles with cicn resources. Compiler is THINK C 4.0.2. I created cicn with ResEdit 2.0b2, both color and b&w version of cicn. Following code works ok for ICONs aIconHandle = GetIcon (iconID); PlotIcon (&aRect, aIconHandle); aIconHandle = GetNamedResource ('ICON', iconNamePstr); PlotIcon (&aRect, aIconHandle); following code works for cicns, color or b&w. aCIconHandle = GetCIcon (iconID); PlotCIcon (&aRect, aCIconHandle); but why doesn't this work (plots only garbage) when run in Mac with color, when run in Mac with b&w screen, the b&w version of the cicn plots ok. aCIconHandle = (CIconHandle) GetNamedResource ('cicn', iconNamePstr); PlotCIcon (&aRect, aCIconHandle); Jorma Paananen, jopa@tkk.tele.fi
anders@verity.com (Anders Wallgren) (03/08/91)
From IM-V, page 76: "The GetCIcon function allocates a CIcon data structure and initializes it using the information in the resource type 'cicn' with the specified ID. ... "Since GetCIcon creates a new CIcon data structure each time it is called, your application shouldn't call GetCIcon before each call to PlotCIcon..." ------ Interpreted, this means: you _must_ load the icon by calling GetCIcon once and _only_ once, before calling PlotCIcon. Since I really wanted to load my icon by name, I think worked around this limitations by using the name to find the 'cicn' resource and then took the resource id of that and created the CIcon with GetCIcon. anders
Greg@AppleLink.Apple.Com (Greg Marriott) (03/08/91)
In article <1991Mar06.143904.23891@tkk.tele.fi>, jopa@tkk.tele.fi (Jorma Paananen TKK-tt) writes: > following code works for cicns, color or b&w. > > aCIconHandle = GetCIcon (iconID); > PlotCIcon (&aRect, aCIconHandle); > > but why doesn't this work (plots only garbage) when run in Mac with > color, when run in Mac with b&w screen, the b&w version of the cicn > plots ok. > > aCIconHandle = (CIconHandle) GetNamedResource ('cicn', iconNamePstr); > PlotCIcon (&aRect, aCIconHandle); GetCIcon does more than just getting the 'cicn' resource. It also fills out the color icon data structures in memory (putting the color table into a handle, etc...). Greg Marriott Blue Meanie Apple Computer, Inc.