home *** CD-ROM | disk | FTP | other *** search
/ AMIGA PD 1 / AMIGA-PD-1.iso / Programme_zum_Heft / Programmieren / Kurztests / ACE / archive / ACEPRGS.LHA / gfx / image.b < prev    next >
Text File  |  1994-11-10  |  2KB  |  66 lines

  1. {*
  2. ** An example of the use of Intuition Images in ACE.
  3. **
  4. ** Author: David J Benn
  5. **   Date: 6th November 1994
  6. *}
  7.  
  8. STRUCT Image
  9.   SHORTINT LeftEdge
  10.   SHORTINT TopEdge
  11.   SHORTINT xWidth    '..Width is a reserved word.
  12.   SHORTINT Height
  13.   SHORTINT Depth    
  14.   ADDRESS  ImageData
  15.   BYTE        PlanePick
  16.   BYTE       PlaneOnOff
  17.   ADDRESS  NextImage    '..Pointer to next Image structure.
  18. END STRUCT
  19.  
  20. CONST NULL = 0&
  21. CONST iHeight = 22
  22.  
  23. LIBRARY "intuition.library"
  24. DECLARE FUNCTION DrawImage(rastPort&, theImage&, left&, top&) LIBRARY intuition
  25.  
  26. DECLARE STRUCT Image theImage
  27. ADDRESS image_addr
  28.  
  29. image_addr = ALLOC(iHeight*SIZEOF(SHORTINT),0)  '..iHeight short words of CHIP RAM.
  30. IF image_addr = NULL THEN STOP
  31. DIM image_data%(iHeight) ADDRESS image_addr
  32. FOR i%=0 TO iHeight-1
  33.   READ image_data%(i%)
  34. NEXT
  35. '..2 bitplanes worth of data (16 x 11 bits x 2 bitplanes).
  36. DATA &H3C0,&H3C0,&H3C0,&H3C0,&HFFFF,&HFFFF,&HFFFF,&H3C0,&H3C0,&H3C0,&H3C0
  37. DATA &H3C0,&H3C0,&H3C0,&H3C0,&HFFFF,&HFFFF,&HFFFF,&H3C0,&H3C0,&H3C0,&H3C0
  38.  
  39. theImage->LeftEdge     = 0
  40. theImage->TopEdge     = 0
  41. theImage->xWidth     = 16
  42. theImage->Height     = iHeight\2
  43. theImage->Depth     = 2
  44. theImage->ImageData     = @image_data%    '..Could use image_addr here.
  45. theImage->PlaneOnOff     = 0
  46. theImage->NextImage    = NULL
  47.  
  48. SCREEN 1,640,200,2,2
  49. WINDOW 1,,(0,0)-(640,200),32,1
  50.  
  51. theImage->PlanePick     = 1
  52. DrawImage(WINDOW(8),theImage,270&,110&)
  53.  
  54. theImage->PlanePick     = 2
  55. DrawImage(WINDOW(8),theImage,290&,110&)
  56.  
  57. theImage->PlanePick     = 3
  58. DrawImage(WINDOW(8),theImage,310&,110&)
  59.  
  60. WHILE INKEY$="" AND NOT MOUSE(0):SLEEP:WEND
  61.  
  62. WINDOW CLOSE 1
  63. SCREEN CLOSE 1
  64. LIBRARY CLOSE
  65. END
  66.