[futurebasic] Re: [FB] Displaying a bitmap

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1999 : Group Archive : Group : All Groups

From: Charlie Dickman <charlied@...>
Date: Sat, 27 Nov 1999 20:05:55 -0500
>Charlie Dickman wrote:
>
>  > >  > Fellow FBers,
>  > >  >
>  > >  > If I have an icon bitmap in memory how do I display it in a rect on
>  > >  > the screen? Is it a copybits call? If so, what are the bitmap
>  > >  > parameters? Do I have to (somehow) put it into a GWorld first? If so,
>  > >  > how? Does it go nicely into an edit field? How?
>  > >  >
>  > >  > Any info will be greatly appreciated.
>  >
>  > Thanks to everyone who responded to my plea but I'm afraid I confused
>  > the situation by using the word "icon". What I have is a bitmap
>  > retrieved from the desktop database via PBDTGetIcon. It is not a
>  > resource that can be drawn with DRAWCICON or any other routine
>  > intended to dray icon resources. Nor is it a PICT resource or a
>  > picture created with PICTURE ON/OFF.
>  >
>  > I tried specifying the handle to PICTURE FIELD and get an empty
>  > picture field. If i feed the handle to COPYBITS I get a memory access
>  > crash (even though the FBII Handbook says that COPYBITS can handle
>  > bitmaps (I'm probably feeding it the wrong address via #hndl&+2)).
>  > Can anybody suggest a next move?
>
>Hi Charlie,
>
>According to IM, you ARE retrieving the bitmap for an Icon that represents a
>file of a given type and creator. It is described in detail in IM: More
>Macintosh Toobox, page 9-12. I'm using the Toolbox Assistant onscreen version
>myself. I could not locate PBDTGetIcon in the Toolbox calls, so I wonder if,
>perhaps, it is not supported by FB - II or 3. However, it appears that, before
>you call this FN, you need to load the PB with certain information so it knows
>what you're looking for, and the bitMap is then returned in the ioDTBuffer,
>which is a "pointer" to a buffer that holds the icon's data. To test whether
>your call worked you should be able to read the ioResult. This is all "fairly"
>complex. Are you sure you set up everything properly in the first place? I
>suspect you've been trying to display invalid data.
>
>Joe Wilkins

Joe,

PBDTGetIcon is not directly supported by FBII. I am using the following code...

LOCAL FN PBDTGetIcon(@DTPBlock&, asynch%)
   DIM osErr%
   LONG IF asynch%
     `  MOVE.L    ^DTPBlock&,A0
     `  MOVE.W    #$0023,D0
     `  DC.W      $A660
     `  MOVE.W    D0,^osErr%
   XELSE
     `  MOVE.L    ^DTPBlock&,A0
     `  MOVE.W    #$0023,D0
     `  DC.W      $A260
     `  MOVE.W    D0,^osErr%
   END IF
END FN = osErr%

I have loaded the necessary parameters into the DTPblock and have 
verified them on both input and output via MacsBug. I have verified 
that I get the appropriate -5012 error code when I ask for an APPL 
that is not in the DTDB and that I get a 0 return code and data shows 
up in my ioDTBuffer that doesn't show up when the return code is 
-5012. I have also verified that the osERR returned by the function 
call matches the ioResult returned in the DTPBlock. Everything checks 
out.

It's taken quite a bit to get this far and I'm sure that I'm missing 
something that's likely quite simple but it confounds me.

The data that comes back in the ioDTBuffer looks like a bitmap image 
- the trick remains to display the image (sigh). And while it is the 
bitmap of an icon the routines to plot icons won't work because it IS 
NOT AN ICON RESOURCE!



Charlie Dickman
charlied@...