home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3986 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: the-fly.zip.com.au!not-for-mail
  2. From: stuartm@zip.com.au (Stuart Mackinnon)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: *SLOW* colour cycling.. :(
  5. Date: 15 Feb 1996 00:48:24 GMT
  6. Organization: Very Little
  7. Message-ID: <4ftvso$u6q@the-fly.zip.com.au>
  8. References: <311c0fb8@beachyhd.demon.co.uk> <71270149@sunshine.stud.uni-frankfurt.de>
  9. NNTP-Posting-Host: zipper.zip.com.au
  10. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  11.  
  12. Martin Steigerwald (steigerw@stud.uni-frankfurt.de) wrote:
  13. > Adam schrieb in comp.sys.amiga.programmer ueber "*SLOW* colour cycling..
  14. > :(":
  15. > A>void cycle_colours(void) { int currcycle,i;
  16. > A>
  17. > A>CyclePos = (CyclePos + 20) % Colours;
  18. > A>
  19. > A>currcycle = CyclePos;
  20. > A>
  21. > A>for (i=0; i<Colours; i++) {
  22. > A>
  23. > A>SetRGB32(&(Screen1->ViewPort),i,Red[currcycle],Green[currcycle],Blue[currcycle]);
  24. > A>
  25. > A>currcycle = (currcycle+1) % Colours; } }
  26. > Remove SetRGB32 from the loop and place
  27. > LoadRGB32 after it, do set the whole new palette with one system call :-)
  28. > Calling SetRGB32 256 times in a loop couldnt be that fast.
  29.  
  30. In fact the autodoc for LoadRGB32 says that it is faster than SetRGB32 even for 1
  31. colour, which means it is substantially faster for 256 colours. LoadRGB32 is the
  32. best function to use. I know, I wrote a screen colour cycler a year or so ago. Its
  33. even available on aminet - I could probably even give away the source if someone
  34. really wanted it (even though it was one of the first decent programs I did and
  35. I am disgusted at the code I wrote then - all those nasty globals).
  36.  
  37. Regards,
  38.  
  39. Stuart MacKinnon.
  40. -- 
  41.  
  42. +- Stuart MacKinnon ------------------------------------ stuartm@zip.com.au -+
  43. |  VIC20, CBM 128+1571, A1000+Sidecar, CD32, A4000/040+A4091+A2065+RetinaZ3! |
  44. |  Registered BeBox Developer - for those at the bleeding edge.              |
  45. |  PHONE: +61 2 398 4578 (AH)                            +61 2 693 0445 (BH) |
  46. +--- Aztec C - Use it to MANXimise code inefficiency! -----------------------+
  47.