home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / colorwhl.zip / ColorWheel.txt < prev    next >
Text File  |  1999-08-15  |  5KB  |  151 lines

  1. TColorWheel and TValueBar components
  2. for SpeedSoft Sibyl
  3.  
  4. Written by Aaron Lawrence (aaronl@clear.net.nz)
  5.  
  6. Summary
  7. -------
  8.  
  9. This package contains two Sibyl components that you can use in
  10. your projects. They are designed to work together to allow a
  11. user to pick a color from the full available range. They work
  12. in any color depth (they look better at 16 bit or 24 bit of course).
  13.  
  14. They are similar to the mixed color picker built into OS/2 Warp 4,
  15. but these ones can be used in your programs.
  16.  
  17. The color wheel lets you pick a hue ( e.g. red, blue...) and a
  18. saturation ( how strong the color is, e.g. pale, vivid ).
  19. The value bar then lets you pick the value ( brightness ) of the
  20. color.
  21.  
  22. These three selections go together to provide you with a normal
  23. Sibyl TColor (RGB).
  24.  
  25. License
  26. -------
  27.  
  28. These components are freeware, but comments would be appreciated!
  29. I make no warranty as to the safe operation of these components... etc.
  30.  
  31. You may modify the source code and use it in your own projects.
  32.  
  33. What you need
  34. -------------
  35.  
  36. You should have these files:
  37.  
  38. ColorMapping.pas
  39. ColorWheel.pas
  40. ColorWheel.bmp
  41. ValueBar.bmp
  42.  
  43. Installation
  44. ------------
  45.  
  46. Load the two files (ColorMapping.pas and ColorWheel.pas) into
  47. Sibyl, and compile them (ColorMapping first) with Project - Compile.
  48.  
  49. Then, use Component - Install Component
  50. Select ColorWheel.SPU (which you just produced by compiling ColorWheel.pas)
  51.  
  52. Click the >> button to add both components.
  53.  
  54. Click OK.
  55.  
  56. Notes:
  57. - If you have a project open, Sibyl may ask if you want to save it,
  58.   since it needs to close the project to install the components.
  59.  
  60. - If you're reinstalling these components, Sibyl will say an Error for
  61.   each one, but will reinstall them anyway :-|
  62.  
  63. The components should now appear under the User tab.
  64.  
  65. Using the components
  66. --------------------
  67.  
  68. Normally, you use both a color wheel and a value bar.
  69.  
  70. 1. Put a color wheel on your form.
  71.  
  72. 2. Put a value bar on your form beside the wheel.
  73.  
  74. 3. Set the ColorWheel's ValueBar property to the ValueBar
  75.    you just put on the form.
  76.  
  77. The two components are now linked together. When a selection is
  78. made in the color wheel the value bar will update to show the range
  79. for that selection.
  80.  
  81. (Note: you won't see the colours til you run the program)
  82.  
  83. Reading and setting the color
  84. -----------------------------
  85.  
  86. To set the color being displayed, use the SetSelectedColor method
  87. of the color wheel.
  88.  
  89. To read the color selected, read the SelectedColor property
  90. of the Value Bar.
  91.  
  92. If you want to know when the user picks a color, you
  93. can use the OnChange event in the ValueBar.
  94.  
  95. That's about all you *need* to know. The rest is some optional properties.
  96.  
  97. Other properties - TColorWheel
  98. ------------------------------
  99.  
  100. Color - same as usual, the background color.
  101. CursorSize - size of the cross hair
  102. MarginWidth - the width of the blank area around the wheel.
  103.               This is used to draw the cursor on and for
  104.               easy selection of edge colors.
  105. WhiteAreaPercentage - the percentage of the radius from the centre,
  106.                       that is held to pure white. This makes it possible
  107.                       to easily select white. ( 0 - 50 )
  108. Hue, Saturation: the current hue and saturation. (read only)
  109.  
  110. Notes: if the margins are wider than the control you will see nothing
  111. if the cursor is too big it will just 'clip' to the edge of the control.
  112. You can use this effect to get full cross hairs by making the CursorSize large
  113.  
  114. Other properties - TValueBar
  115. ----------------------------
  116.  
  117. Color - same as usual, the background color.
  118. CursorHeight - height of the selection cursor.
  119. MarginWidth - the width of the blank area around the bar.
  120. Value - the currently selected value 0 .. 1 where 1 is brightest
  121.         and 0 is black
  122. Dither - if set to false only solid colours will be displayed (default)
  123.          if you set this to true the value bar will use patterns to
  124.          display intermediate colours
  125.  
  126.          This also affects the colours you can select.
  127.  
  128. SetHS - this method sets the hue and saturation. Normally it's
  129.         called by the colorwheel component.
  130.  
  131. Problems/limitations
  132. --------------------
  133.  
  134. Sadly, the color wheel is quite slow to draw, although since
  135. it doesn't get redrawn very often this doesn't matter so much. Moving
  136. the cursor around is fast.
  137.  
  138. I can't get Sibyl's bitmap creation & drawing to work properly, so I don't
  139. have any means to fix this (it's limited by the speed OS/2 draws a pixel).
  140.  
  141. The value bar is fast enough.
  142.  
  143. The look of these controls could be enhanced further but that would mainly
  144. be luxury - they look pretty cool anyway! (IMHO)
  145.  
  146. If you have any ideas or comments (especially nice ones) feel free to mail me.
  147. aaronl@clear.net.nz
  148. or
  149. aaronl@pec.co.nz (may change soon)
  150.  
  151.