Copyright © 2002-2009 MultiMedia Soft 
Return to index  
 
How to manage alpha channel transparency 
The use of alpha channel transparency can be used to create very interesting vanishing effects: starting from version 2 of the SDK, a variable transparency (alpha channel based and ranging from 0 to 255) was available for texts only; starting from version 3, you can manage alpha channel transparency for all of the control's elements, including surface, pictures, texts and cells: transparency can assume separate values for each of these elements (see below) or, at runtime, all at the same time and with the same value with a single call to the abmSetTotalTransparentFactor function. 
Note that the use of transparency will cost more CPU ticks so, if rendering speed is critical for your application, you should avoid its use. 
If you need to manage each of the control's elements transparency separately, here is a summary of the needed operations: 
 
  • Surface transparency 
  • Below you can see a screenshot of a form (white background) with a picture control containing a set of three identical buttons: the left one has the transparent factor set to 0 (total opacity, anti-alias with the form background color), the center one has the property set to 1 (total opacity, anti-alias with the underlying picture) and the right one has the property set to 128 (semi-transparent): 
     
    At runtime the transparent factor can be changed through the SurfaceTransparentFactor property. Note that, in case the underlying picture should change, you could force a refresh of the control using the abmRefreshTransparentControl method. 
    When you have buttons with a SpecialEffect applied, like the buttons above, you have the possibility to decide which zone of the button will be affected by the alpha channel transparency through the SurfaceTransparentZone property and you will have results like the following: 
      
    NOTE: when using alpha channel transparency on the control's surface, the control will merge its graphical representation only with the contents of its own parent window (the control container: could be a form or a frame control). 
     
  • Text transparency 
  • Below you can see a screenshot of two buttons with a background picture and a "A" as caption text; the text of left button is completely opaque (Transparency set to 0), while the right one is semi-transparent (Transparency set to 128): as you can see the underlying picture can be seen through the "A" 
     
    At runtime the text transparent factor can be changed through the nTransparentFactor field of the TEXT_DESC data structure associated to the abmSetTextSettingOnPos function. 
     
  • Pictures transparency 
  • Below you can see a screenshot of two buttons with a background picture; the picture of left button is completely opaque (Transparency set to 0), while the right one is semi-transparent (Transparency set to 128): as you can see the underlying picture can be seen through the "A" 
     
    At runtime the picture transparent factor can be changed through the PictureTranspFactor property. 
     
  • Cells background's transparency 
  • Below you can see a screenshot of three buttons with a background picture inserted through the control's Picture property; the button on the left is the original button with no visible cell; the button in the middle has a cell with a caption text, a cyan solid background and a 5 pixels wide blue border; the button on the right has exactly the same characteristics as the one on the middle but (as seen on the screenshot above) the Background transparent factor has been set to 158: as you can see, the original button's picture can be seen through the cell's background. 
     
    At runtime the cell's background transparency can be changed through the cell's BackTranspFactor property. 
     
  • Cells text's transparency 
  • Below you can see a screenshot identical to the one seen before: the only difference is the "My cell caption" text whose Transparency field has been set to 165. 
     
    At runtime the text's transparent factor can be changed through the nTransparentFactor field of the TEXT_DESC data structure associated to the cell's TextSetting property. 
     
  • Cells picture's transparency 
  • Below you can see a screenshot of three buttons with a background picture inserted through the control's Picture property; the button on the left is the original button with no visible cell; the button in the middle has a cell with a caption text and a background picture; the button on the right has exactly the same characteristics as the one on the middle but (as seen on the screenshot above) the the picture's Transparent factor has been set to 128: as you can see, the original button's picture can be seen through the cell's picture. 
     
    At runtime the cell's picture transparent factor can be changed through the cell's PictureTranspFactor property. 
     
     
     
     
     
     
     
     
    Copyright © 2002-2009 MultiMedia Soft 
    Return to index