<% 'ASPimage ---> imageglue wrapper class 'www.websupergoo.com for support on imageglue 'USEAGE 'put an include at the top of your file ' 'then replace your ASPimage declarations with this 'Set Image = new aspimage 'Released under GPL 'written by lonetechie.com 'no warranty written or expressed 'Some functions may be incomplete or missing completly, modify to your own use! Class ASPImage Private strFileName Private objImage Private strFontName Private UseTexture private canvas private mycol private TextureCanvas private Mask private ItalicV private BoldV private TextStyleString private FlipimageV Private Sub Class_Initialize Set canvas = Server.CreateObject("ImageGlue6.Canvas") Set mycol = Server.CreateObject("ImageGlue6.XColor") UseTexture = false End Sub Private Sub Class_Terminate set mycol = nothing Set canvas = Nothing End Sub 'depricated functions '//////////// Public Property Get AntiAliasText AntiAliasText = false End Property Public Property Let AntiAliasText (newValue) 'do nothing End Property Public Property Get AutoClear AutoClear = false End Property Public Property Let AutoClear (newValue) 'do nothing End Property Public Property Get dpi dpi = 0 End Property Public Property Let dpi(newValue) 'do nothing End Property Public Property Get padsize 'nothing End Property Public Property Let padsize(newValue) 'do nothing End Property '/////////// 'end depricated Public Property Get pencolor pencolor = canvas.pencolor End Property Public Property Let pencolor(passedColor) NewColor = hex(passedColor) do while(len(NewColor) < 6) NewColor = "0"&NewColor loop NewColor = right(NewColor,2)&MID(NewColor,3,2)&left(NewColor,2) canvas.pencolor= "#"& NewColor End Property Public Property Get brushcolor brushcolor = canvas.paintcolor End Property Public Property Let brushcolor(passedColor) NewColor = hex(passedColor) do while(len(NewColor) < 6) NewColor = "0"&NewColor loop NewColor = right(NewColor,2)&MID(NewColor,3,2)&left(NewColor,2) canvas.paintcolor= "#"& NewColor End Property Public Property Get brushstyle 'nothing End Property Public Property Let brushstyle(newValue) 'do nothing End Property Public sub rectangle(pTopX,pTopY,pBottomX,pBottomY) canvas.DrawShape "rect", "Pos="&pTopX&","&pTopY&" Size="&pBottomX-pTopX&","&pBottomY-pTopY&" Operation=both OpenGL=true" End sub Public Property Get Jpegquality Jpegquality = 0 End Property Public Property Let Jpegquality(newValue) 'do nothing End Property Public function AddFont(passedPath) AddFont = true end function Public Property Get FontName FontName = canvas.textfont End Property Public Property Let FontName (newFileName) canvas.textfont= newFileName End Property Public Property Let AutoSize (newFileName) ' End Property Public Property Get Italic Italic = ItalicV End Property Public Property Let Italic (newvalue) ItalicV = newvalue TextStyleString = "" if BoldV = true then TextStyleString = "bold" end if if ItalicV = true then if(TextStyleString = "") then TextStyleString = "italic" else TextStyleString = TextStyleString & ", italic" end if end if Canvas.TextStyle = TextStyleString End Property Public Property Get Bold Bold = BoldV TextStyleString = "" if BoldV = true then TextStyleString = "bold" end if if ItalicV = true then if(TextStyleString = "") then TextStyleString = "italic" else TextStyleString = TextStyleString & ", italic" end if end if Canvas.TextStyle = TextStyleString End Property Public Property Let Bold (newvalue) BoldV = newvalue End Property Public Property Get UnderLine ' End Property Public Property Let UnderLine (newvalue) ' End Property Public Property Get strikeout ' End Property Public Property Let strikeout (newvalue) ' End Property Public Property Get halign halign = canvas.halign End Property Public Property Let halign (newvalue) canvas.halign = newvalue End Property Public Property Get error ' End Property Public Property Let imageformat (newvalue) ' End Property Public Property Get FileName FileName = strFileName End Property Public Property Let FileName (newFileName) strFileName = newFileName End Property Public sub FlipImage (newFileName) FlipImageV = newFileName Set canvas2 = Server.CreateObject("ImageGlue6.Canvas") canvas2.Height = canvas.height canvas2.Width = canvas.width canvas2.DrawCanvas canvas.image, "pos=0,0" canvas.clear canvas.height = canvas2.height canvas.width = canvas2.width canvas.DrawCanvas canvas2.image, "pos=-"&Canvas2.width&",0 Scale=-1,1,0,0" set canvas2 = nothing End sub Public Function LoadImage (newFileName) canvas.DrawFile newFileName,"" End Function Public Property Get MaxX MaxX = canvas.Width End Property Public Property Get MaxY MaxY = canvas.Height End Property Public Property Let MaxX(passedX) canvas.Width = passedX End Property Public Property Let MaxY(passedY) canvas.Height = passedY End Property Public Property Get FontColor FontColor = canvas.textcolor End Property Public Property let FontColor(passedColor) NewColor = hex(passedColor) do while(len(NewColor) < 6) NewColor = "0"&NewColor loop NewColor = right(NewColor,2)&MID(NewColor,3,2)&left(NewColor,2) canvas.textcolor = "#"& NewColor End Property Public Property Get BackgroundColor 'Set mycol = Server.CreateObject("ImageGlue6.XColor") 'tempixel = Canvas.GetColor(passedX &","& passedY) 'mycol.string = canvas.color 'BackgroundColor = mycol.rgb 'set mycol = nothing BackgroundColor = canvas.color End Property Public Property let BackgroundColor(passedColor) NewColor = hex(passedColor) do while(len(NewColor) < 6) NewColor = "0"&NewColor loop NewColor = right(NewColor,2)&MID(NewColor,3,2)&left(NewColor,2) canvas.color = "#"& NewColor End Property Public Property Get FontSize FontColor = canvas.textsize End Property Public Property let FontSize(passedSize) canvas.textsize = passedSize End Property public sub FloodFill (passedX,passedY,passedColor,passedvalue) canvas.Select "notcolor", "keycolor=0xFF,0xFF,0xFF tolerance=10.0" Set ca2 = CreateObject("ImageGlue6.Canvas") ca2.Color = "#"& hex(passedColor) ca2.Width = canvas.Width ca2.Height = canvas.Height ca2.DrawCanvas canvas.Image, "Mode=Transparent" canvas.clear 'canvas.color = "#"& hex(passedColor) canvas.height = ca2.height canvas.width = ca2.width canvas.drawCanvas ca2.image, "Mode=transparent" set ca2 = nothing end sub public sub AddImage (passedSource,posX,posY) Canvas.drawFile passedSource,"mode=transparent POS="&posX&","&posY end sub Public function TextWidth(passedText) Canvas.TextArea passedText, "Pos="&canvas.width&","&canvas.height, mywidth, myheight, mylineheight TextWidth = mywidth End function Public function TextHeight(passedText) Canvas.TextArea passedText, "Pos="&canvas.width&","&canvas.height, mywidth, myheight, mylineheight TextHeight = myheight End function Public function GetPixel(passedX,passedY) on error resume next temppixel = Canvas.GetColor(passedX &","& passedY) if(error.count > 0) then repsonse.write(Error.description) end if mycol.string = temppixel GetPixel = mycol.rgb end function Public function CropImage(passedTopX,passedTopY,passedWidth,passedHeight) Set canvas2 = Server.CreateObject("ImageGlue6.Canvas") canvas2.Height = passedHeight canvas2.Width = passedWidth canvas2.DrawCanvas canvas.image, "pos="&passedTopX*-1&","&passedTopY*-1&" SrcRect="&passedTopX&","&passedTopY&","&passedTopX+passedWidth&","&passedTopY+passedHeight canvas.clear canvas.height = canvas2.height canvas.width = canvas2.width canvas.DrawCanvas canvas2.image, "" set canvas2 = nothing set rc = nothing end function Public Sub TextOut (passedText,xPos,yPos,Dtext) if UseTexture then Set mask = Server.CreateObject("ImageGlue6.Canvas") mask.color = "black" mask.width = canvas.width mask.height = canvas.height mask.textcolor = "white" mask.textsize = canvas.textsize mask.textfont = canvas.textfont mask.textstyle = canvas.textstyle mask.drawtext passedText,"Pos="& xPos &","& yPos &" size="&canvas.width-30&","&canvas.height TextureCanvas.SetChannel "alpha", mask.image canvas.DrawCanvas TextureCanvas.Image,"Mode=transparent Pos=0,0 size="&mask.width&","&mask.height mask.clear set mask = nothing else canvas.DrawText passedText, "Pos="& xPos &","& yPos &" size="&canvas.width-30&","&canvas.height end if End Sub Public Sub LoadTexture (passedTexture) Set TextureCanvas = Server.CreateObject("ImageGlue6.Canvas") Set gr = Server.CreateObject("ImageGlue6.Graphic") gr.SetFile passedTexture NewWidth = gr(1).width NewHeight = gr(1).height TextureCanvas.width = canvas.width TextureCanvas.height = canvas.height TextureCanvas.DrawFile passedTexture,"" 'we need to cover the entire canvas with the texture do while(NewHeight < TextureCanvas.height+gr(1).height) TextureCanvas.DrawFile passedTexture,"pos=0,"&NewHeight-gr(1).height do while(NewWidth < TextureCanvas.width) TextureCanvas.DrawFile passedTexture,"pos="&NewWidth&","&NewHeight-gr(1).height NewWidth = NewWidth + gr(1).width loop NewWidth = gr(1).width NewHeight = NewHeight + gr(1).height loop UseTexture = true set gr = nothing End Sub Public Sub ClearTexture() UseTexture = false set TextureCanvas = nothing end Sub Public Sub ResizeR (newWidth, newHeight) set newCanvas = Server.CreateObject("ImageGlue6.Canvas") newCanvas.drawCanvas canvas.Image, "size=" & newWidth & "," & newHeight canvas.clear Canvas.height = newHeight Canvas.width = newWidth canvas.drawCanvas newCanvas.Image,"" set newCanvas = nothing End Sub Public Function SaveImage () canvas.saveas strFileName,"Quality=high" End Function End Class %>