aardio快捷为图片加水印
编辑时间:2018-10-22 作者:金满斗 浏览量:2627 来源:原创

几句话的事,哎,我大aardio就是屌。

话不多说,上代码。


import inet.http;
import gdip;
import gdip.bitmap;
import process;

var baiduLogo = inet.http().get("https://www.baidu.com/img/bd_logo1.png");
var bmp = gdip.bitmap( baiduLogo );
var graphics = bmp.getGraphics();

//创建刷子
var brush = gdip.solidBrush(0xFFFF0000);

//创建FontFamily 
var family = gdip.family("宋体");

//创建stringFormat 
var strformat = gdip.stringformat ( ); 

//设置样式
strformat.align = 0/*_GdipStringAlignmentNear*/;

//创建Font
var curFont = family.createFont(  15,2/*_GdipFontStyleItalic*/, 2/*_GdipUnitPixel*/)

//设置文字抗据齿
graphics.smoothingMode = 4/*_GdipSmoothingModeAntiAlias*/ ;

//消除走样,且边作平滑处理
graphics.textRenderingHint = 3/*_GdipTextRenderingHintAntiAliasGridFit*/;

//设置文字区域
rclayout = gdip.RECTF(); 
rclayout.x = 15
rclayout.y = 15
rclayout.width = 500 //在这里指的是宽度
rclayout.height = 150 //在这里指的是高度
	
graphics.drawString( "Hellow world! 这是我们第一个GDI+文字~!!"  , curFont
, rclayout, strformat,brush);

//删除所有GDI+对象   
brush.delete()
curFont.delete()
strformat.delete();
family.delete(); 

bmp.save("\drawSring.bmp");
process.exploreSelect("\drawSring.bmp")


来说两句吧