BuildPalette
The BuildPalette function rebuilds image palette to produce accurate picture with
anti-alias effect
TextOut
nImportantColors
Parameters
-
nImportantColors
-
Specifies the number of impotant colors in the image. These are first
nImportantColors colors in the image palette. These palette
entries will not be changed.
Remarks
This method reconstructs image palette and changes its entries except
first nImportantColors colors. If you plan to use this function,
the image should have some extra-space in the palette. For example, you
create image with 128 colors, and use first 8 colors in the palette for drawing
text, shapes etc. Just after usage of this function, the palette entries
8-127 may be changed.
Use this function just before calling GifImage function to
improve your image quality, if you used some operations which can require
additional colors in the palette, like drawing text with font, different from
the one with default height.
See too
CreateImage,
SetColor
Example
<%@ Language=VBScript %>
<%
Response.ContentType="image/gif"
set obj=Server.CreateObject("shotgraph.image")
size=100
obj.CreateImage size,size,16
obj.SetColor 0,255,255,255
obj.SetColor 1,0,0,0
obj.SetColor 2,255,108,0
obj.SetBgColor 0
obj.FillRect 0,0,size-1,size-1
obj.SetTextAlign "TA_CENTER","TA_BASELINE"
obj.SetBkColor 0
obj.SetTextColor 1
obj.CreateFont "Arial",0,22,0,True,False,False,False
obj.TextOut size/2,24,"Text1"
obj.SetTextColor 2
obj.CreateFont "Arial",0,15,0,True,False,False,False
obj.TextOut size/2,size/2,"Text2"
obj.BuildPalette 3
img=obj.GifImage(-1,1,"")
Response.BinaryWrite(img)
%>
Results:
Without BuildPalette |
With BuildPalette |
 |
 |