canvas教程

AspJpeg2.0组件教程完整版 aspjpeg教程(2)

字号+ 作者:H5之家 来源:H5之家 2015-10-22 15:39 我要评论( )

1. % 2. Set Jpeg = Server.CreateObject(Persits.Jpeg) 3. Jpeg.Open Server.MapPath(2.jpg) 4. '开始写文字 5. Jpeg.Canvas.Font.Color = nbsp; 'red 颜色 6. Jpeg.Canvas.Font.Family = Courier New '字体 7. Jp

1. <%   
2. Set Jpeg = Server.CreateObject("Persits.Jpeg")   
3. Jpeg.Open Server.MapPath("2.jpg")   
4. '开始写文字   
5. Jpeg.Canvas.Font.Color = &000000    'red 颜色   
6. Jpeg.Canvas.Font.Family = "Courier New"    '字体   
7. Jpeg.Canvas.Font.Bold = True    '是否加粗   
8. Jpeg.Canvas.Print 10, 10, "Copyright (c) XYZ, Inc."   
9. '打印坐标x 打印坐标y 需要打印的字符   
10. '以下是对图片进行边框处理   
11. Jpeg.Canvas.Pen.Color = &H000000    'black 颜色   
12. Jpeg.Canvas.Pen.Width = 2    '画笔宽度   
13. Jpeg.Canvas.Brush.Solid = False    '是否加粗处理   
14. Jpeg.Canvas.Bar 1, 1, Jpeg.Width, Jpeg.Height   
15. '起始X坐标 起始Y坐标 输入长度 输入高度   
16. Jpeg.Save Server.MapPath("1.jpg")    '保存   
17. %> 

<%
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath("2.jpg")
'开始写文字
Jpeg.Canvas.Font.Color = &000000    'red 颜色
Jpeg.Canvas.Font.Family = "Courier New"    '字体
Jpeg.Canvas.Font.Bold = True    '是否加粗
Jpeg.Canvas.Print 10, 10, "Copyright (c) XYZ, Inc."
'打印坐标x 打印坐标y 需要打印的字符
'以下是对图片进行边框处理
Jpeg.Canvas.Pen.Color = &H000000    'black 颜色
Jpeg.Canvas.Pen.Width = 2    '画笔宽度
Jpeg.Canvas.Brush.Solid = False    '是否加粗处理
Jpeg.Canvas.Bar 1, 1, Jpeg.Width, Jpeg.Height
'起始X坐标 起始Y坐标 输入长度 输入高度
Jpeg.Save Server.MapPath("1.jpg")    '保存
%>

9、如何用AspJpeg组件进行图片合并?
AspJpeg 1.3+ enables you to place images on top of each other via the method DrawImage. To use this method, you must create two instances of the AspJpeg objects and populate both of them with images via calls to Open (or OpenBinary). When calling Canvas.DrawImage, the 2nd instance of AspJpeg is passed as an argument to this method, along with the X and Y offsets (in pixels):
使用该方法,您必需创建两个AspJpeg实例对象
view plaincopy to clipboardprint?

1. <%  
2. Set Jpeg1 = Server.CreateObject("Persits.Jpeg")  
3. Set Jpeg2 = Server.CreateObject("Persits.Jpeg")  
4. Jpeg1.Open Server.MapPath("t.jpg")  
5. Jpeg2.Open Server.MapPath("t1.jpg")  
6. Jpeg1.Canvas.DrawImage 10, 10, Jpeg2 ' optional arguments omitted  
7. jpeg1.save Server.mappath("tt.jpg")  
8. %> 

<%
Set Jpeg1 = Server.CreateObject("Persits.Jpeg")
Set Jpeg2 = Server.CreateObject("Persits.Jpeg")
Jpeg1.Open Server.MapPath("t.jpg")
Jpeg2.Open Server.MapPath("t1.jpg")
Jpeg1.Canvas.DrawImage 10, 10, Jpeg2 ' optional arguments omitted
jpeg1.save Server.mappath("tt.jpg")
%>

10、如何用AspJpeg组件进行图片切割?

AspJpeg 1.1+ is also capable of cutting off edges from, or cropping, the resultant thumbnails via the method Crop(x0, y0, x1, y1). The size of the cropped image is specified by the coordinates of the upper-left and lower-right corners within the resultant thumbnail, not the original large image.
view plaincopy to clipboardprint?

1. <%  
2. Set Jpeg = Server.CreateObject("Persits.Jpeg")  
3. Jpeg.Open Server.MapPath("t.jpg")  
4. jpeg.Crop 20, 30, jpeg.Width - 20, jpeg.Height - 10   
5. jpeg.save Server.mappath("tt.jpg")  
6. Response.write("<img src=tt.jpg>")  
7. %> 

<%
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath("t.jpg")
jpeg.Crop 20, 30, jpeg.Width - 20, jpeg.Height - 10
jpeg.save Server.mappath("tt.jpg")
Response.write("<img src=tt.jpg>")
%>

11、如何用AspJpeg组件创建验证码?

创建验证码原理上和创建水印差不多。
view plaincopy to clipboardprint?

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • fd详细教程|Excel_VBA_详细教程

    fd详细教程|Excel_VBA_详细教程

    2017-05-02 18:01

  • SketchBook 2014 基础入门视频教程

    SketchBook 2014 基础入门视频教程

    2017-05-01 11:00

  • HTML样式CSS

    HTML样式CSS

    2017-05-01 10:03

  • HTML5 Canvas 绘图实例教程

    HTML5 Canvas 绘图实例教程

    2017-04-28 13:09

网友点评