Home... About... Arrange... FAQ... Customers...

Sample 21 - Drawing text without antialiasing

The sample shows how to draw a text string without antialiasing.

By default antialiasing is always turned on. Now you can draw text without antialiasing for palette images that were created with CreateImagePalette method, or created from GIF, PNG (8-bit) images, or converted using ConvertToPalette, ConvertToPaletteNoAlpha methods.

TextAntialias.vbs



' Define object variable
Dim im                                                          

' Create object
Set im = CreateObject("ActiveImage.Images.1")        

width = 180
height = 60
' Create image with specified width and height
im.CreateImagePalette width,height
im.SetColor 255,255,255
im.DrawFilledRectangle 0,0,width,height

'Set path to true type fonts
im.SetFontPathTTFAuto

'Set font size
im.SetFontSizeTTF 14

'Set Font Name
im.SetFontTTF "arial"

im.SetColor 0,0,0

im.SetTextAntialias  0
im.DrawTextTTF 10,20, "Text no  antialias"

im.SetTextAntialias  1
im.DrawTextTTF 10,35, "Text antialias"


' Set PNG format
im.SetImageType 0
' Save Image to file.
im.WriteToFile "C:\AI\textantialias.png"

' Set BMP format
im.SetImageType 4                                        
' Save Image to file. BMP format.
im.WriteToFile "C:\AI\textantialias.bmp"                           

' Set Jpeg format
im.SetImageType 1                                       
' Set Jpeg quality
im.SetJpegQuality 100                                   
im.WriteToFile "C:\AI\textantialias.jpg"

' Set Gif format
im.SetImageType 3                                        
'Convert to palette (no alpha)
im.ConvertToPaletteNoAlpha
' Save Image to file. 
im.WriteToFile "C:\AI\textantialias.gif"                           

im.DestroyImage                                           ' Delete image and free memory
Set im = Nothing                                           ' Clear the variable



Picture 1. textantialias.jpg (size - 0,9Kb)


If you have any questions or bug reports, write to active.image@tonec.com for technical support.


© 2000-2001 All Rights Reserved

Tonec Inc., 16835 Algonquin Street #400, Huntington Beach, CA, 92649, fax: (509) 752-1450, e-mail: info@tonec.com