FontBlendColour
FontBlendColour FontIndex, BlendColour
 
Parameters:

    FontIndex = The index of the font you wish to set the backdrop blend colour of
    BlendColour = The backdrop colour this font should be blended with
Returns: NONE
 

      The FontBlendColour command sets the Font backdrop blend colour. This will only take effect on fonts that use the FontDrawMode 2 rendering methods..


      The purpose of this blend mode, is to allow text to appear anti aliased when drawn over the same backdrop colour, without the font render engine having to read the pixels from the backdrop.



FACTS:


      * Not all font types can react to DrawMode changes. See FontDrawMode for more about drawmodes.




 
Example Source: Download This Example
  // Load the standard windows Arial font
  LoadFont "Arial",1,32,0
  
  // Load the CRF version of this font
  AlphaFont=LoadNewFont("..\../Media/Arial.crf",0,0)
  
  
  
  Dim Colours(1000)
  For lp=0 To GetArrayElements(Colours(),1)
     Colours(lp)=RndRGB()
  Next
  
  
; Set the Blend colour for Font draw mode #2
  FontBlendColour AlphaFont,$ffff0000
  
  
  // Make an fx image the screen of the screen to draw every onto
  
  Screen     =GetFreeImage()
  sw               =GetScreenWidth()
  sh               =GetScreenHeight()
  Screen=NewFXImage(sw,sh)
  
  
  // Set the time when the demo will change the drawmode
  NextDrawmodeChange=Timer()+4000
  
  
  Do
     
     LockBuffer
     RenderToImage Screen
     
     // Clear or shadebox the backdrop
     Select GetFontDrawMode(AlphaFont)
         Case 0
             Cls RGB(0,0,0)
         Case 1
             c1=255
             c2=$304050
             c3=$a0a000
             ShadeBox 0,0,sw,sh,c1,c2,c3,c4
         Case 2
             Cls GetFontBlendColour(AlphaFont)
     EndSelect
     
     // Draw this message to the screen a bunch of times
     SetFont AlphaFont
     Test$="testing Fonttesting Fonttesting Fonttesting Fonttesting Font"
     
     Alevel=AlphaLevel
     Ypos=0
     For lp=0 To 40
        If Ypos<GetScreenHeight()
           Ypos=(lp+1)*25
           Ink Colours(lp) |  ALevel*$1000000
           Text 0,Ypos,test$+Str$(lp)
           ALevel=(ALevel+1And 255
        EndIf
     Next
     UnLockBuffer
     AlphaLevel=(AlphaLevel+1And 255
     
     RenderToScreen
     DrawImage Screen,0,0,false
     
     
     // Display what draw mode the font #2 is using
     SetFont 1
     SetCursor 0,0
     
     Ink $ffffff
     Select GetFontDrawMode(AlphaFont)
         Case 0
             Print "Font DrawMode [0] = Solid Render"
         Case 1
             Print "Font DrawMode [1] = Alpha Blend To Buffer"
         Case 2
             Print "Font DrawMode [2] = Alpha Blend To Colour"
     EndSelect
     
     //
     If KeyState(32Or Timer()>NextDrawModeChange
        D=GetFontDrawMode(AlphaFont)+1
        If d>2 Then D=0
        FontDrawMode AlphaFont,d
        FlushKeys
     NextDrawmodeChange=Timer()+4000
  EndIf
  
  
  
  
  Sync
  Loop
  
  
  
 
Related Info: GetFontDrawMode | GetFontHeight | GetFontMaskColour | GetFontName$ | GetFontStatus | GetFontStyle | GetFontType | GetFontWidth | LoadFont | MakeBitmapFont :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com