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 9


Image Information.


Filled rectangles, color manipulation

transparent.vbs

Dim im
Set im = CreateObject("ActiveImage.Images.1")
im.CreateImagePalette 300,400

'im.SetAlphaBlending 0
im.SetColor 255,255,255


im.Fill 0,0
im.SetColor 0,0,0
im.DrawText 0,0, "Draw Image"

d = 20
Randomize

For i = 0 to 3
r = 255
g = Round(Rnd()*127)
b = 127 - Round(Rnd()*127)
a = Round(Rnd()*127)

if i = 2 then im.SetTransparent 1

im.SetColor r,g,b
im.DrawFilledRectangle 0,i*20+d,20,(i+1)*20+d
'im.SetColor 0,0,0 
im.DrawText 25,i*20+d, i &" rgba=" & r & "," & g & "," & b & "," & a & " "

r = im.GetColorRed
g = im.GetColorGreen
b = im.GetColorBlue
a = im.GetColorAlpha

im.DrawText 150,i*20+d, "real rgba=" & r & "," & g & "," & b & "," & a & " "
next
'im.SetColorByIndex(1)
'im.SetTransparent 1

ct = im.GetColorTotal
w = 140
im.SetColor 0,0,0
im.DrawText 0,w - 30, "Read Image Information:"
im.DrawText 0,w - 20, "Colors Total:" & ct

For j = 0 to ct - 1
im.SetColorByIndex(j)
r = im.GetColorRed
g = im.GetColorGreen
b = im.GetColorBlue
a = im.GetColorAlpha

im.DrawFilledRectangle 0,j*20+w,20,(j+1)*20+w
im.DrawText 25,j*20+w, "read: rgba=" & r & "," & g & "," & b & "," & a & " "

next 
msgbox im.GetTransparent
im.WriteToFile "C:\ct.png"
im.DestroyImage
Set im = Nothing


 rectangle.jpg
 Picture 1. ct.png (size - 4 Kb)

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.