This helped me to write the code at the bottom.
There seems to be something missing. I say that because when I use this I get a corrupt image.
Now the funny thing is if I run OWB the corruption goes away.
I can do this with my app open and the corruption just automatically disappears in my app?
So OWB is obviously doing something to correct something in the background that fixes things live?
Can someone help me?
Code:
Code: Select all
pSelf->ad_TextPointerIcon = pSelf->ad_IIcon->GetIconTags(NULL,
ICONGETA_GetDefaultName, "textpointer",
ICONGETA_FailIfUnavailable, TRUE,
TAG_DONE);
pSelf->ad_TextPointer = MakePointerFromIcon(pSelf,
pSelf->ad_TextPointerIcon, pSelf->ad_Window->WScreen);
Object *MakePointerFromIcon(struct AppData *pSelf,
struct DiskObject *pIcon, struct Screen *pScreen)
{
UBYTE *pIconImage;
int32 iWidth, iHeight;
// Remap icon image; actually I don't understand why remapping is even required for a sprite?
pSelf->ad_IIcon->LayoutIcon(pIcon, (struct Screen *) ~0UL,
TAG_DONE);
// Get the image data and its width and height.
pSelf->ad_IIcon->IconControl(pIcon,
ICONCTRLA_GetImageData1, &pIconImage,
ICONCTRLA_GetWidth, &iWidth,
ICONCTRLA_GetHeight, &iHeight,
TAG_DONE);
if(pIconImage)
{
uint32 iXOffset, iYOffset;
// Get the XOffset specified in the tooltypes.
char *pFind = (char *) pSelf->ad_IIcon->FindToolType(
pIcon->do_ToolTypes, "XOFFSET");
IDOS->StrToLong(pFind, &iXOffset); // Defaults to 0.
// Get the YOffset specified in the tooltypes.
pFind = (char *) pSelf->ad_IIcon->FindToolType(
pIcon->do_ToolTypes, "YOFFSET");
IDOS->StrToLong(pFind, &iYOffset); // Defaults to 0.
// Create the pointer object that you can set for window.
Object *pPointer =
pSelf->ad_IIntuition->NewObject(NULL, "pointerclass",
POINTERA_ImageData, pIconImage,
POINTERA_Width, iWidth,
POINTERA_Height, iHeight,
POINTERA_XOffset, -iXOffset,
POINTERA_YOffset, -iYOffset,
TAG_DONE);
return pPointer;
}
return NULL;
}