Example #1
0
struct RastPort *ScratchRast_New(int Width, int Height, char Planes)
{
struct RastPort *This;
int loop;

/* Planes must be < 8, since we steal the topmost entry for our Mask */

if(Planes > 7)
	return(NULL); /* Zo zorry. */

Width = ROUNDUP(Width,32);

if(This=AllocMem(sizeof(struct RastPort), MEMF_CLEAR))
	{
	InitRastPort(This);
	This->RP_User=(void *)Width; /* cope with it. */
	if(This->BitMap = AllocMem(sizeof(struct BitMap), MEMF_CLEAR))
		{
		InitBitMap(This->BitMap, Planes, Width, Height);
		for(loop = 0; loop < Planes; loop++)
			{
			if(!(This->BitMap->Planes[loop] = AllocRaster(Width, Height)))
				{
				break;
				} /* if */
			} /* for */
		if(loop == Planes)
			{
			This->BitMap->Planes[7] = AllocRaster(Width, Height);
			} /* if */
		if(loop != Planes) /* aborted early */
			{
			for(loop = 0; loop < Planes; loop++)
				{
				if(This->BitMap->Planes[loop])
					{
					FreeRaster(This->BitMap->Planes[loop], Width, Height);
					This->BitMap->Planes[loop] = NULL;
					} /* if */
				} /* for */
			} /* if */
		else /* Success! Rice */
			{
			return(This);
			} /* else */
		FreeMem(This->BitMap, sizeof(struct BitMap));
		} /* if */
	FreeMem(This, sizeof(struct RastPort));
	} /* if */

return(NULL);
} /* ScratchRast_New() */
Example #2
0
VOID BltMaskRPort (struct BitMap *source, WORD srcLeft,WORD srcTop, struct RastPort *destination, WORD dstLeft,WORD dstTop,WORD dstWidth,WORD dstHeight, PLANEPTR maskPlane)
{
  if(GetBitMapAttr(source, BMA_FLAGS) & BMF_INTERLEAVED)
  {
    struct BitMap mask;

    InitBitMap(&mask, 8, GetBitMapAttr(source, BMA_WIDTH), GetBitMapAttr(source, BMA_HEIGHT));

    for(UWORD i = 0; i < 8; i++)
       mask.Planes[i] = maskPlane;

    BltBitMapRastPort(source, srcLeft, srcTop, destination, dstLeft, dstTop, dstWidth, dstHeight, MINTERM_B_EQUALS_C);
    BltBitMapRastPort(&mask, srcLeft,srcTop, destination, dstLeft, dstTop, dstWidth, dstHeight, MINTERM_B_OR_C);
    BltBitMapRastPort(source, srcLeft, srcTop, destination, dstLeft, dstTop, dstWidth, dstHeight, MINTERM_B_EQUALS_C);
  }
  else
  {
    BltMaskBitMapRastPort(source, srcLeft, srcTop, destination, dstLeft, dstTop, dstWidth, dstHeight, (ABC | ABNC | ANBC), maskPlane);
  }
}
Example #3
0
///
/// MyBltMaskBitMapRastPort()
static void MyBltMaskBitMapRastPort(struct BitMap *srcBitMap, LONG xSrc, LONG ySrc, struct RastPort *destRP, LONG xDest, LONG yDest, LONG xSize, LONG ySize, ULONG minterm, APTR bltMask)
{
  ENTER();

  if(GetBitMapAttr(srcBitMap, BMA_FLAGS) & BMF_INTERLEAVED)
  {
    LONG src_depth = GetBitMapAttr(srcBitMap, BMA_DEPTH);
    struct Rectangle rect;
    struct BltHook hook;

    // Define the destination rectangle in the rastport
    rect.MinX = xDest;
    rect.MinY = yDest;
    rect.MaxX = xDest + xSize - 1;
    rect.MaxY = yDest + ySize - 1;

    // Initialize the hook
    InitHook(&hook.hook, BltMaskHook, NULL);
    hook.srcBitMap = srcBitMap;
    hook.srcx = xSrc;
    hook.srcy = ySrc;
    hook.destx = xDest;
    hook.desty = yDest;

    // Initialize a bitmap where all plane pointers points to the mask
    InitBitMap(&hook.maskBitMap, src_depth, GetBitMapAttr(srcBitMap, BMA_WIDTH), GetBitMapAttr(srcBitMap, BMA_HEIGHT));
    while(src_depth)
    {
      hook.maskBitMap.Planes[--src_depth] = bltMask;
    }

    // Blit onto the Rastport */
    DoHookClipRects(&hook.hook, destRP, &rect);
  }
  else
  {
    BltMaskBitMapRastPort(srcBitMap, xSrc, ySrc, destRP, xDest, yDest, xSize, ySize, minterm, bltMask);
  }

  LEAVE();
}
Example #4
0
VOID MyBltMaskBitMapRastPort( struct BitMap *srcBitMap, LONG xSrc, LONG ySrc, struct RastPort *destRP, LONG xDest, LONG yDest, LONG xSize, LONG ySize, ULONG minterm, APTR bltMask)
{
	if (GetBitMapAttr(srcBitMap,BMA_FLAGS)&BMF_INTERLEAVED)
	{
		LONG src_depth = GetBitMapAttr(srcBitMap,BMA_DEPTH);
		struct Rectangle rect;
		struct BltMaskHook hook;

		/* Define the destination rectangle in the rastport */
		rect.MinX = xDest;
		rect.MinY = yDest;
		rect.MaxX = xDest + xSize - 1;
		rect.MaxY = yDest + ySize - 1;

		/* Initialize the hook */
#if defined(__AMIGAOS4__) || defined(__MORPHOS__) || defined(__AROS__)
		hook.hook.h_Entry = (HOOKFUNC)hookEntry;
		hook.hook.h_SubEntry = (HOOKFUNC)HookFunc_BltMask;
#else
		hook.hook.h_Entry = (HOOKFUNC)HookFunc_BltMask;
#endif
		hook.srcBitMap = srcBitMap;
		hook.srcx = xSrc;
		hook.srcy = ySrc;
		hook.destx = xDest;
		hook.desty = yDest;

		/* Initialize a bitmap where all plane pointers points to the mask */
		InitBitMap(&hook.maskBitMap,src_depth,GetBitMapAttr(srcBitMap,BMA_WIDTH),GetBitMapAttr(srcBitMap,BMA_HEIGHT));
		while (src_depth)
			hook.maskBitMap.Planes[--src_depth] = (PLANEPTR)bltMask;

		/* Blit onto the Rastport */
		DoHookClipRects(&hook.hook,destRP,&rect);
	} else
	{
		BltMaskBitMapRastPort(srcBitMap, xSrc, ySrc, destRP, xDest, yDest, xSize, ySize, minterm, (PLANEPTR)bltMask);
	}
}
struct DragObj * PRIVATE CreateDragObj(struct DragGadget *dg,int x,int y)
{
  struct Screen *scr;
  struct RastPort *rp;
  struct DragObj *gdo;
  ULONG line;
  int wordwidth;
  int width,height,depth;
  int i = 0,xpos,ypos;

  scr = dg->dg_Window->WScreen;
  rp = &scr->RastPort;

  if (dg->dg_Flags & DGF_IMAGES && ((struct ImageNode *)dg->dg_Object.od_Object)->in_Image)
    dg->dg_Image = ((struct ImageNode *)dg->dg_Object.od_Object)->in_Image;

  if (!dg->dg_Width || !dg->dg_Height)
  {
    if ((dg->dg_Type == LISTVIEW_KIND) && !dg->dg_Image)
    {
      dg->dg_Width = dg->dg_Gadget->Width-20;
      dg->dg_Height = dg->dg_ItemHeight;
    }
    else if (!dg->dg_RenderHook && dg->dg_Image)
    {
      dg->dg_Width = dg->dg_Image->Width;
      dg->dg_Height = dg->dg_Image->Height;
    }
    else  /* be sure width & height are not zero */
    {
      dg->dg_Width = dg->dg_Gadget->Width;
      dg->dg_Height = dg->dg_Gadget->Height;
    }
  }
  width = dg->dg_Width;
  height = dg->dg_Height;
  memset(&dm,0,sizeof(struct DropMessage));

  if (dg->dg_Type == LISTVIEW_KIND)
  {
    xpos = dg->dg_Gadget->LeftEdge+2;
    ypos = dg->dg_Gadget->TopEdge+2;
    dg->dg_Object.od_Object = NULL;

    if (y < ypos || y > ypos+dg->dg_Gadget->Height-5)
      return(NULL);
    line = (y-ypos)/dg->dg_ItemHeight;
    ypos += line*dg->dg_ItemHeight;

    GT_GetGadgetAttrs(dg->dg_Gadget,dg->dg_Window,NULL,GTLV_Labels,&dg->dg_List,TAG_END);
    if (dg->dg_List && !IsListEmpty(dg->dg_List))
    {
      GT_GetGadgetAttrs(dg->dg_Gadget,dg->dg_Window,NULL,GTLV_Top,&i,TAG_END);
      i += line;
      if (i < CountNodes(dg->dg_List))
      {
        struct Node *ln;

        dm.dm_SourceEntry = i;
        for(ln = dg->dg_List->lh_Head;i;i--,ln = ln->ln_Succ);

        if (dg->dg_Flags & DGF_TREEVIEW && TREENODE(ln)->tn_Flags & TNF_STATIC)
        {
          mx = ~0L;      // avoid a following drag
          return(NULL);
        }
        dg->dg_Object.od_Object = ln;

        if (dg->dg_ObjectFunc)
          dg->dg_ObjectFunc(dg->dg_Window,dg->dg_Gadget,&dg->dg_Object,dm.dm_SourceEntry);
      }
    }
  }
  else
  {
    if (dg->dg_ObjectFunc)
      dg->dg_ObjectFunc(dg->dg_Window,dg->dg_Gadget,&dg->dg_Object,0L);

    dm.dm_SourceEntry = dg->dg_SourceEntry;
    xpos = x-width/2;
    ypos = y-height/2;
  }
  if (!dg->dg_Object.od_Object)
  {
    mx = ~0L;        // avoid a following drag
    return(NULL);
  }
  wordwidth = (width + 15) >> 4;
  depth = GetBitMapAttr(rp->BitMap,BMA_DEPTH);

  if (dg->dg_Object.od_Object && (gdo = AllocMem(sizeof(struct DragObj), MEMF_CLEAR | MEMF_PUBLIC)))
  {
#ifdef LOCKLAYERS
    LockLayers(&scr->LayerInfo);
    UnlockLayer(dg->dg_Window->RPort->Layer);
#endif

    gdo->do_Screen = scr;
    gdo->do_ScrRPort = rp;

    gdo->do_BitMap = AllocBitMap(width,height,depth,BMF_CLEAR | BMF_MINPLANES,!(GetBitMapAttr( rp->BitMap, BMA_FLAGS ) & BMF_INTERLEAVED) ? rp->BitMap : NULL);
    gdo->do_SaveBack = AllocBitMap(width,height,depth,BMF_CLEAR | BMF_MINPLANES,rp->BitMap);
    gdo->do_RefreshMap = AllocBitMap(width*2,height*2,depth,BMF_CLEAR | BMF_MINPLANES,rp->BitMap);

    if (GetBitMapAttr(gdo->do_BitMap,BMA_FLAGS) & BMF_STANDARD)
      i = MEMF_CHIP | MEMF_PUBLIC;
    else
      i = 0;

    gdo->do_FullShadow = AllocMem(2*wordwidth*height,i | MEMF_CLEAR);
    gdo->do_HalfShadow = AllocMem(2*wordwidth*height,i);

    if (gdo->do_BitMap && gdo->do_SaveBack && gdo->do_RefreshMap && gdo->do_FullShadow && gdo->do_HalfShadow)
    {
      InitRastPort(&gdo->do_RPort);
      gdo->do_RPort.BitMap = gdo->do_BitMap;
      InitRastPort(&gdo->do_RefreshRPort);
      gdo->do_RefreshRPort.BitMap = gdo->do_RefreshMap;

      gdo->do_DragGadget = dg;
      CopyMem(&dg->dg_Object,&dm.dm_Object,sizeof(struct ObjectDescription));
      dm.dm_Window = dg->dg_Window;
      dm.dm_Gadget = dg->dg_Gadget;

      /*** create the drag&drop image ***/

      if (dg->dg_RenderHook)
      {
        struct LVDrawMsg lvdm;

        SetFont(&gdo->do_RPort,scr->RastPort.Font);
        lvdm.lvdm_MethodID = LV_DRAW;
        lvdm.lvdm_RastPort = &gdo->do_RPort;
        lvdm.lvdm_DrawInfo = GetScreenDrawInfo(scr);
        lvdm.lvdm_Bounds.MinX = 0;
        lvdm.lvdm_Bounds.MinY = 0;
        lvdm.lvdm_Bounds.MaxX = width-1;
        lvdm.lvdm_Bounds.MaxY = height-1;
        lvdm.lvdm_State = LVR_SELECTED;
        CallHookPkt(dg->dg_RenderHook,dm.dm_Object.od_Object,&lvdm);
        FreeScreenDrawInfo(scr,lvdm.lvdm_DrawInfo);
      }
      else if (dg->dg_Image)
        DrawImage(&gdo->do_RPort,dg->dg_Image,0,0);
      else
        ClipBlit(dg->dg_Window->RPort,xpos,ypos,&gdo->do_RPort,0,0,width,height,0xc0);

      /*** initialize drag object structure ***/

      gdo->do_X = -9999;
      gdo->do_Y = ypos+dg->dg_Window->TopEdge;
      gdo->do_PX = -9999;
      gdo->do_Width = width;
      gdo->do_Height = height;
      gdo->do_DeltaX = xpos-x+dg->dg_Window->LeftEdge;
      gdo->do_DeltaY = ypos-y+dg->dg_Window->TopEdge;
      gdo->do_Mask = gdo->do_FullShadow;

      /*** create masks (transparent and full imagery) ***/

      if (CyberGfxBase && (GetBitMapAttr(gdo->do_BitMap,BMA_FLAGS) & BMF_STANDARD) == 0L)
      {
        struct BitMap tbm;
        ULONG  col;

        InitBitMap(&tbm,1,width,height);
        tbm.Planes[0] = (UBYTE *)gdo->do_FullShadow;

        /* if (!GetCyberMapAttr(gdo->do_BitMap, CYBRMATTR_PIXELFMT)) */

        if (GetBitMapAttr(gdo->do_BitMap, BMA_DEPTH) > 8L)
        {
          ULONG triplet[3];

          GetRGB32(scr->ViewPort.ColorMap,0L,1L,triplet);
          col = (triplet[0] & 0xff0000) | (triplet[1] & 0xff00) | (triplet[2] & 0xff);
        }
        else
          col = 0;

        // ExtractColor(rp,&tbm,col,xpos,ypos,width,height);
        ExtractColor(&gdo->do_RPort,&tbm,col,0,0,width,height);

        BltBitMap(&tbm,0,0,&tbm,0,0,width,height,0x50,0xff,NULL);  // invertieren der Maske
      }
      else
      {
        UWORD *p = gdo->do_FullShadow;

        for(ypos = 0;ypos < height;ypos++)
        {
          for(xpos = 0;xpos < wordwidth;xpos++,p++)
          {
            for(i = 0;i < depth;i++)
              *p |= *((UWORD *)gdo->do_BitMap->Planes[i]+ypos*(gdo->do_BitMap->BytesPerRow >> 1)+xpos);
          }
        }
      }

      {
        UWORD *p = gdo->do_HalfShadow;

        CopyMem(gdo->do_FullShadow,p,2*wordwidth*height);
        for(line = 0x5555,ypos = 0;ypos < height;ypos++)
        {
          line = ~line;
          for(xpos = 0;xpos < wordwidth;xpos++,p++)
            *p &= (UWORD)line;
        }
      }

      if (!boopsigad)
        FakeInputEvent();
      UpdateDragObj(gdo,gdo->do_X,gdo->do_Y);    /* show drag object */

      return(gdo);
    }
Example #6
0
/*
 * Check whether the appearance of the VSprite has been changed
 * somehow. If for example the Image Data has changed, then
 * I will try to update the BitMap of the IntVSprite structure
 * to the new image data.
 */
BOOL _ValidateIntVSprite(struct IntVSprite * ivs, 
                         struct RastPort * rp,
                         BOOL force_change,
                         struct GfxBase * GfxBase)
{
	struct VSprite * vs = ivs->VSprite;
	/*
	 * Check whether the ImageData pointer has changed
	 */
	if (vs->ImageData != ivs->OrigImageData ||
	    force_change) {
		struct BitMap bm;

#if 0
kprintf("%s: Imagedata has changed (old:%p-new:%p)!\n",
        __FUNCTION__,
        vs->ImageData,
        ivs->OrigImageData);
kprintf("PlanePick: %02x, rp->BitMap:%p\n",vs->PlanePick,rp->BitMap);
#endif
		/*
		 * Only need to get a new bitmap if
		 * something in the size of the bob has changed.
		 */
		if ((ivs->Width  != vs->Width )  ||
		    (ivs->Height != vs->Height)  ||
		    (ivs->Depth  != vs->Depth )    ) {
			if (NULL != ivs->ImageData)
				FreeBitMap(ivs->ImageData);

			if (NULL != ivs->SaveBuffer)
				FreeBitMap(ivs->SaveBuffer);
			/*
			 * Now get a new bitmap
			 */

			ivs->ImageData = AllocBitMap(vs->Width<<4,
			                             vs->Height,
			                             vs->Depth,
			                             BMF_CLEAR,
			                             rp->BitMap);

			ivs->SaveBuffer = AllocBitMap(vs->Width<<4,
			                              vs->Height,
			                              vs->Depth,
			                              0,
			                              rp->BitMap);
			ivs->Width  = vs->Width;
			ivs->Height = vs->Height;
			ivs->Depth  = vs->Depth;
		}

		ivs->OrigImageData = vs->ImageData;

		/*
		 * Blit the image data from the VSprite into the
		 * ImageData (BitMap) of the IntVSprite
		 */
		InitBitMap(&bm,
		           ivs->Depth,
		           ivs->Width<<4,
		           ivs->Height);

    	    	{
		    UBYTE *imagedata = (UBYTE *)vs->ImageData;
		    WORD  d, shift;
		    
		    for (d = 0, shift = 1; d < 8; d++, shift *= 2)
		    {
		    	if (vs->PlanePick & shift)
			{
			    bm.Planes[d] = imagedata;
			    imagedata += (bm.Rows * bm.BytesPerRow);
			}
			else
			{
			    bm.Planes[d] = (vs->PlaneOnOff & shift) ? (PLANEPTR)-1 : NULL;
			}
		    }
		    
		}
		
		BltBitMap(&bm,
		          0,
		          0,
		          ivs->ImageData,
		          0,
		          0,
		          ivs->Width << 4,
		          ivs->Height,
		          0x0c0,
		          vs->PlanePick,
		          NULL);
			  
	}
	
	return TRUE;
}
main(int argc, char *argv[])
{
    unsigned char str[256];
    int i;
    int j;
    struct RastPort rp;
    unsigned char *pp;
    struct BitMap bm = {
	256, 	/* bytes per row */
	8,	/* rows */
	0,	/* flags */
	1,	/* depth */
	0,	/* pad */
	0 	/* planes */
	};
    struct TextAttr ta;
    struct TextFont *tf;
    struct FontRequester *fr;
    struct TagItem frtags[] = {
	ASL_Hail, (ULONG)"NetBSD font choices",
	ASL_Width, 640,
	ASL_Height, 400,
	ASL_LeftEdge, 10,
	ASL_TopEdge, 10,
	ASL_OKText, (ULONG)"Dump",
	ASL_CancelText, (ULONG)"Cancel",
	ASL_FontName, (ULONG)"topaz.font",
	ASL_FontHeight, 8L,
	ASL_FontStyles, FS_NORMAL,
	ASL_FuncFlags, FONF_STYLES | FONF_FIXEDWIDTH,
	TAG_DONE
	    };

    /* Let the user pick a font to dump */
    if (fr = (struct FontRequester *)
	AllocAslRequest(ASL_FontRequest, frtags)) {
	if (!AslRequest(fr, NULL)) {
	    FreeAslRequest(fr);
	    fprintf(stderr, "User requested exit\n");
	    exit (0);
	}
	ta.ta_Name = (STRPTR)malloc(strlen(fr->fo_Attr.ta_Name));
	strcpy(ta.ta_Name, fr->fo_Attr.ta_Name);
	ta.ta_YSize = fr->fo_Attr.ta_YSize;
	ta.ta_Style = fr->fo_Attr.ta_Style;
	ta.ta_Flags = fr->fo_Attr.ta_Flags;
	FreeAslRequest(fr);
    } else {
	fprintf(stderr, "Can't allocate Font Requestor\n");
	exit (1);
    }

    /* Open the selected font */
    tf = (struct TextFont *)OpenDiskFont (&ta);
    if (! tf) {
	fprintf (stderr, "Can't open font: %s\n", ta.ta_Name);
	exit (1);
    }
#ifdef DEBUG
    fprintf(stderr, "Information on selected font:\n");
    fprintf(stderr, "Name=%s\n", ta.ta_Name);
    fprintf(stderr, "Height=%d tf_Style=%x tf_Flags=%x Width=%d Baseline=%d\n",
	    tf->tf_YSize, tf->tf_Style, tf->tf_Flags, tf->tf_XSize, tf->tf_Baseline);
#endif

    /* Check for NetBSD restrictions */
    if (tf->tf_Flags & FPF_PROPORTIONAL) {
	fprintf(stderr, "NetBSD does not support proportional fonts\n");
	exit (1);
    }
    if (tf->tf_XSize > NetBSDwidth) {
	fprintf(stderr, "NetBSD does not support fonts wider than %d pixels\n", NetBSDwidth);
	exit (1);
    }

    /* Allocate area to render font in */
    InitBitMap(&bm, 1, 256 * NetBSDwidth, tf->tf_YSize);
    InitRastPort (&rp);
    rp.BitMap = &bm;
    bm.Planes[0] = pp = AllocRaster (256 * NetBSDwidth, tf->tf_YSize);
    if (!pp) {
	fprintf (stderr, "Can't allocate raster!\n");
	exit (1);
    }

    /* Initialize string to be rendered */
    for (i = 32; i < 256; i++) {
	str[i - 32] = i;
    }

    /* Render string with selected font */
    SetFont (&rp, tf);
    SetSoftStyle(&rp, ta.ta_Style ^ tf->tf_Style,
		 FSF_BOLD | FSF_UNDERLINED | FSF_ITALIC);
    Move (&rp, 0, tf->tf_Baseline);
    ClearEOL(&rp);
    if (tf->tf_XSize != NetBSDwidth) {
	/* right-justify char in cell */
	Move (&rp, NetBSDwidth - tf->tf_XSize, tf->tf_Baseline);
	/* Narrow font, put each character in space of normal font */
	for (i = 0; i < (256 - 32); i++) {
	    Text (&rp, &str[i], 1);
	    Move (&rp, rp.cp_x + (NetBSDwidth - tf->tf_XSize), rp.cp_y);
	}
    } else {
	Text (&rp, str, 256 - 32);
    }

    /* Dump them.. */
    printf ("/* Generated automatically by fontdumper.c. *DONT* distribute\n");
    printf ("   this file, it may contain information Copyright by Commodore!\n");
    printf ("\n");
    printf ("   Font: %s/%d\n", ta.ta_Name, tf->tf_YSize);
    printf (" */\n\n");

    printf ("unsigned char kernel_font_width  = %d;\n", tf->tf_XSize);
    printf ("unsigned char kernel_font_height = %d;\n", tf->tf_YSize);
    printf ("unsigned char kernel_font_baseline = %d;\n", tf->tf_Baseline);
    printf ("short         kernel_font_boldsmear = %d;\n", tf->tf_BoldSmear);
    printf ("unsigned char kernel_font_lo = 32;\n");
    printf ("unsigned char kernel_font_hi = 255;\n\n");

    printf ("unsigned char kernel_cursor[] = {\n");
    for (j = 0; j < (tf->tf_YSize -1); j++) {
	printf ("0xff, ");
    }
    printf ("0xff };\n\n");

    printf ("unsigned char kernel_font[] = {\n");
    for (i = 0; i < 256 - 32; i++) {
	printf ("/* %c */", i + 32);
	for (j = 0; j < tf->tf_YSize; j++) {
	    printf (" 0x%02x,", pp[i+j*256]);
	    }
	printf ("\n");
    }
    printf ("};\n");

    CloseFont (tf);
    FreeRaster (pp, 256 * NetBSDwidth, tf->tf_YSize);
    return (0);
}
Example #8
0
void ami_init_mouse_pointers(void)
{
	int i;
	struct RastPort mouseptr;
	struct DiskObject *dobj;
	uint32 format = IDFMT_BITMAPPED;
	int32 mousexpt=0,mouseypt=0;

	InitRastPort(&mouseptr);

	for(i=0;i<=AMI_LASTPOINTER;i++)
	{
		BPTR ptrfile = 0;
		mouseptrbm[i] = NULL;
		mouseptrobj[i] = NULL;
		char ptrfname[1024];

#ifdef __amigaos4__
		if(nsoption_bool(truecolour_mouse_pointers))
		{
			ami_get_theme_filename((char *)&ptrfname,ptrs32[i], false);
			if(dobj = GetIconTags(ptrfname,ICONGETA_UseFriendBitMap,TRUE,TAG_DONE))
			{
				if(IconControl(dobj, ICONCTRLA_GetImageDataFormat, &format, TAG_DONE))
				{
					if(IDFMT_DIRECTMAPPED == format)
					{
						int32 width = 0, height = 0;
						uint8* data = 0;
						IconControl(dobj,
							ICONCTRLA_GetWidth, &width,
							ICONCTRLA_GetHeight, &height,
							ICONCTRLA_GetImageData1, &data,
							TAG_DONE);

						if (width > 0 && width <= 64 && height > 0 && height <= 64 && data)
						{
							STRPTR tooltype;

							if(tooltype = FindToolType(dobj->do_ToolTypes, "XOFFSET"))
								mousexpt = atoi(tooltype);

							if(tooltype = FindToolType(dobj->do_ToolTypes, "YOFFSET"))
								mouseypt = atoi(tooltype);

							if (mousexpt < 0 || mousexpt >= width)
								mousexpt = 0;
							if (mouseypt < 0 || mouseypt >= height)
								mouseypt = 0;

							static uint8 dummyPlane[64 * 64 / 8];
                   			static struct BitMap dummyBitMap = { 64 / 8, 64, 0, 2, 0, { dummyPlane, dummyPlane, 0, 0, 0, 0, 0, 0 }, };

							mouseptrobj[i] = NewObject(NULL, "pointerclass",
												POINTERA_BitMap, &dummyBitMap,
												POINTERA_XOffset, -mousexpt,
												POINTERA_YOffset, -mouseypt,
												POINTERA_WordWidth, (width + 15) / 16,
												POINTERA_XResolution, POINTERXRESN_SCREENRES,
												POINTERA_YResolution, POINTERYRESN_SCREENRESASPECT,
												POINTERA_ImageData, data,
												POINTERA_Width, width,
												POINTERA_Height, height,
												TAG_DONE);
						}
					}
				}
			}
		}
#endif

		if(!mouseptrobj[i])
		{
			ami_get_theme_filename(ptrfname,ptrs[i], false);
			if(ptrfile = Open(ptrfname,MODE_OLDFILE))
			{
				int mx,my;
				UBYTE *pprefsbuf = AllocVec(1061,MEMF_PRIVATE | MEMF_CLEAR);
				Read(ptrfile,pprefsbuf,1061);

				mouseptrbm[i]=AllocVec(sizeof(struct BitMap),MEMF_PRIVATE | MEMF_CLEAR);
				InitBitMap(mouseptrbm[i],2,32,32);
				mouseptrbm[i]->Planes[0] = AllocRaster(32,32);
				mouseptrbm[i]->Planes[1] = AllocRaster(32,32);
				mouseptr.BitMap = mouseptrbm[i];

				for(my=0;my<32;my++)
				{
					for(mx=0;mx<32;mx++)
					{
						SetAPen(&mouseptr,pprefsbuf[(my*(33))+mx]-'0');
						WritePixel(&mouseptr,mx,my);
					}
				}

				mousexpt = ((pprefsbuf[1056]-'0')*10)+(pprefsbuf[1057]-'0');
				mouseypt = ((pprefsbuf[1059]-'0')*10)+(pprefsbuf[1060]-'0');

				mouseptrobj[i] = NewObject(NULL,"pointerclass",
					POINTERA_BitMap,mouseptrbm[i],
					POINTERA_WordWidth,2,
					POINTERA_XOffset,-mousexpt,
					POINTERA_YOffset,-mouseypt,
					POINTERA_XResolution,POINTERXRESN_SCREENRES,
					POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT,
					TAG_DONE);

				FreeVec(pprefsbuf);
				Close(ptrfile);
			}

		}

	} // for
}