Tonec.com Bringing Internet Technology Innovations to Market since 1991
  News Products Outsourcing About Us Contact Us
what's new?what's new? featuresfeatures samplessamples manualmanual downloaddownload buybuy
  Tonec Homepage
ProductsActive Imagesamples

Please view complete list of samples

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
Set im = Nothing
' Delete image and free memory
' Clear the variable

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

Next sample >> 

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

  TonecPrivacy Policy
  © 1999-2005. Tonec, Inc. All rights reserved.