home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4629 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.8 KB  |  103 lines

  1. Path: news.sci.fi!usenet
  2. From: caprice@sci.fi (Niklas Lakanen)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Screen W/Custom Pens.   HELP!
  5. Date: 2 Mar 1996 13:22:39 GMT
  6. Organization: Scifi Communications International, http://www.sci.fi/, helpdesk@sci.fi, (931)3186277
  7. Message-ID: <2454.6635T892T1782@sci.fi>
  8. References: <4h3geg$qa4@aggedor.rmit.EDU.AU>
  9. NNTP-Posting-Host: xvi.dyn.sci.fi
  10. X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
  11.  
  12. >static UWORD mypens[] = {
  13. >     0x999, 0x000, 0xfff, 0x57a,
  14. >     0x888, 0xaaa, 0xa98, 0xe9a, ~0
  15. >     };
  16.  
  17. Pens are not the colors you want to the screen. With them you can define
  18. which colornumber to use in different places on the screen.
  19.  
  20. There are 12 pens that you are able to define:
  21. DETAILPEN
  22. BLOCKPEN
  23. TEXTPEN
  24. SHINEPEN
  25. SHADOWPEN
  26. FILLPEN
  27. FILLTEXTPEN
  28. BACKGROUNDPEN
  29. HIGHLIGHTTEXTPEN
  30. /* V39 and above */
  31. BARDETAILPEN
  32. BARBLOCKPEN
  33. BARTRIMPEN
  34.  
  35. So, this is what you do if you want to use pen number 1 as DETAILPEN, 3 as
  36. BLOCKPEN, and so on:
  37.  
  38. UWORD mypens[] = {
  39.     1, 3, 1, 2, 2, 2, 2, 1, 1, 3, 4, 5 };
  40. ...
  41.     SA_Pens, (ULONG)mypens,
  42. ...
  43.  
  44. >I have the Depth correct etc... it opens fine but the colours are not
  45. >even the ones I have specified. if I just have { ~0 } in the array, it
  46. >opens fine w/the WB colours in the correct places and all.
  47.  
  48. {~0} uses the default pens.
  49.  
  50. >I have also tried putting
  51. >   SA_Colors,  (ULONG)otherpens,
  52. >otherpens being
  53. >struct UWORD otherpens[] = {~0};
  54.  
  55. I undestoood that you want to change the palette, am I right?
  56.  
  57. SA_Colors tag wants an array of ColorSpec structures as an argumet.
  58.  
  59. /* From intuition.h */
  60. struct ColorSpec
  61. {
  62.     WORD    ColorIndex; /* -1 terminates an array of ColorSpec  */
  63.     UWORD   Red;    /* only the _bottom_ 4 bits recognized */
  64.     UWORD   Green;  /* only the _bottom_ 4 bits recognized */
  65.     UWORD   Blue;   /* only the _bottom_ 4 bits recognized */
  66. };
  67.  
  68.  
  69. To define the colors for 8 color screen:
  70.  
  71. struct ColorSpec mycolors[9]=
  72.     {
  73.           0, 9, 9, 9,       // GRAY
  74.           1, 0, 0, 0,       // BLACK
  75.           2, 0,15, 0,       // GREEN
  76.           3,15,15, 0,       // YELLOW
  77.           4, 0, 0,15,       // BLUE
  78.           5,15, 0,15,       // MAGENTA
  79.           6, 0,15,15,       // CYAN
  80.           7,15,15,15,       // WHITE
  81.           -1,0, 0, 0};      // TERMINATOR
  82.     ...
  83.     OpenScreenTags(
  84.     ...
  85.     SA_Colors, mycolors,
  86.     ...
  87.  
  88.  
  89. As you can see, this method is useable only with screens with colors up to 16.
  90. To define colors for 256-color screen it's posiible to use SA_Colors32 tag. It
  91. takes as a parameter a table which it can pass to LoadRGB32() function.
  92.  
  93. >Any help will be nice.. since the RKRM's only mention that you can change
  94. >the palette, but no proper example (which would have been easy since it
  95. >says something like: 'The following example doesn't have custom pens, but
  96. >you can do it')
  97.  
  98. I write quite bad English, but hope this helps you even a little..
  99.  
  100.  
  101. - Caprice
  102.  
  103.