Common/FSImage.cs

(开头部分) 14KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Web;
using System.Drawing;
using System.Drawing.Imaging;





/// <summary>
/// 生成水印、缩略图、生成有指定内容的图片
/// </summary>
public class FSImage
{
    private int _width;
    private int _height;
    private string _title = "www.netcms";    //文字标题
    private Color _bgcolor = Color.White;
    private int _fontsize = 14;  //字号
    private string _familyname = "仿宋";   //字体
    private FontStyle _fontstyle = FontStyle.Regular;
    private Color _forcecolor = Color.Black;
    private string _filepath = "";   //获取路径及文件名
    private PointF _txtpos;
    private long _quality = 100;
    private string _waterpos = "0";
    private string _waterpath = "";
    /// <summary>
    /// 构建函数
    /// </summary>
    /// <param name="width">生成图片的宽度。
    /// 如果小于或等于零:高度也小于或等于零,则图片按原图的大小(水印或缩略图)或标题文字的大小生成图片;如高度大于零,则按高度优先比例缩放原图
    /// 如果大于零:高度也大于零,按指定大小生成新图片;如果高度小于等于零,则按宽度优先比较缩放图片</param>
    /// <param name="height">图片高度,见图片宽度注释</param>
    /// <param name="filepath">原文件物理磁盘路径(水印、缩略图)或保存文件路径(按文字生成图片)</param>
    public FSImage(int width, int height, string filepath)
    {
        _txtpos = new PointF(-1, -1);
        _width = width;
        _height = height;
        _filepath = filepath.Replace("/", "\\");
    }
    /// <summary>
    /// 水印或生成图片的文字,默认为:www.netcms
    /// </summary>
    public string Title
    {
        set { _title = value; }
        get { return _title; }
    }
    /// <summary>
    /// 以像素为单位的字体大小,默认为:14
    /// </summary>
    public int FontSize
    {
        get { return _fontsize; }
        set { _fontsize = value; }
后面还有 379 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。