设置密文在图片上1 jpeg
程序员文章站
2024-02-15 17:24:16
...
package com.Dao;
import java.io.*;
import com.sun.image.codec.jpeg.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
public class Test
{
/**
* 设置密文在图片上
*
* @param g
* @param onOff
* @param buffHeight
* @param strEnc
* @see [类、类#方法、类#成员]
*/
public static void addCipherText(Graphics g, String onOff, int buffHeight, String strEnc)
{
String mobile = "15011112222";
try
{
strEnc = EncryptUtil.encrypt(mobile, "7cp0kqc84yv9nzs2");
}
catch (Exception e)
{
e.printStackTrace();
}
if (onOff.equals("1"))
{
g.drawString(strEnc, 15, 35);
g.drawString(strEnc, 200, buffHeight - 35);
for (int j = 0; j < 5; j++)
{
g.drawString(strEnc, 200, j * 200);
}
}
else
{
g.drawString(strEnc, 15, 35);
g.drawString(strEnc, 200, buffHeight - 35);
for (int i = 0; i < getBuf(buffHeight); i++)
{
for (int j = 0; j < 5; j++)
{
g.drawString(strEnc, 200, j * 200 * i);
}
}
}
}
/**
* <一句话功能简述> <功能详细描述>
*
* @param buffHeight
* @return
* @see [类、类#方法、类#成员]
*/
public static int getBuf(int buffHeight)
{
int buf = 0;
if (buffHeight % 1000 == 0)
{
buf = buffHeight / 1000;
}
else
{
buf = buffHeight / 1000 + 1;
}
return buf;
}
import java.io.*;
import com.sun.image.codec.jpeg.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
public class Test
{
/**
* 设置密文在图片上
*
* @param g
* @param onOff
* @param buffHeight
* @param strEnc
* @see [类、类#方法、类#成员]
*/
public static void addCipherText(Graphics g, String onOff, int buffHeight, String strEnc)
{
String mobile = "15011112222";
try
{
strEnc = EncryptUtil.encrypt(mobile, "7cp0kqc84yv9nzs2");
}
catch (Exception e)
{
e.printStackTrace();
}
if (onOff.equals("1"))
{
g.drawString(strEnc, 15, 35);
g.drawString(strEnc, 200, buffHeight - 35);
for (int j = 0; j < 5; j++)
{
g.drawString(strEnc, 200, j * 200);
}
}
else
{
g.drawString(strEnc, 15, 35);
g.drawString(strEnc, 200, buffHeight - 35);
for (int i = 0; i < getBuf(buffHeight); i++)
{
for (int j = 0; j < 5; j++)
{
g.drawString(strEnc, 200, j * 200 * i);
}
}
}
}
/**
* <一句话功能简述> <功能详细描述>
*
* @param buffHeight
* @return
* @see [类、类#方法、类#成员]
*/
public static int getBuf(int buffHeight)
{
int buf = 0;
if (buffHeight % 1000 == 0)
{
buf = buffHeight / 1000;
}
else
{
buf = buffHeight / 1000 + 1;
}
return buf;
}
推荐阅读