china youjomoible free护士821手机怎么截屏

j2me 在手机上,截屏你的程序 - J2ME - mobile - ITeye论坛
j2me 在手机上,截屏你的程序
锁定老帖子
精华帖 (1) :: 良好帖 (2) :: 新手帖 (0) :: 隐藏帖 (0)
等级: 初级会员
来自: 沈阳
发表时间:&&
相关知识库:
KJAVA在这里人气不算很旺,不过这磨灭不了我们这群热爱着J2ME开发的人们的激情。
关于这个截屏程序,是需要附加到你的项目中的,因为j2me的手机没听说双线程的。
此截屏程序的原理:
把缓冲画笔所在的画布img_buffer转成PNG格式保存到指定路径下,image转png需要一些插值加文件头的操作。
这段代码网上有,我也是copy过来进行创新的。
你需要做的是:
1.在你的canvas里定义截屏类的对象,初始值null。
2.在你的canvas里定义一个boolean变量,初始值true。
3.在你的canvas里的初始化或者构造方法里new 一个截屏类的对象。
4.在你的canvas里run方法里如同下面代码一样改造,repaint()方法就是重绘方法,c就是截屏类的实例,c.save()方法是保存图片的方法。
public void run() {
while (true) {
startTime = System.currentTimeMillis();
if(b_isPaint)
repaint(); //重绘
mainForm.paint(gg);
c.save(img_buffer); //c是截屏类实例,save方法是保存图片方法,img_buffer是当前缓冲。
b_isPaint =
timeTaken = System.currentTimeMillis() - startT
if (timeTaken & 1000 / DefaultProperties.FPS) {
Thread.sleep(1000 / DefaultProperties.FPS - timeTaken);
} catch (Exception e) {
e.printStackTrace();
5.你想要以何种触发事件触发这个截屏方法,如果想要触摸屏点击触发,参考以下方法。其他触发方法照之改之。
protected void pointerPressed(int x, int y) {
if(x & 30 && x & 0 && y & 30 && y & 0)
b_isPaint =
color = 0;
if(b_isPaint)
mainForm.pointerPressed(x, y);//程序主触屏事件
6.在你的程序里添加截屏类(CGAMG.java)
第45行写你要保存的路径。
import javax.microedition.lcdui.*;
import java.io.*;
import javax.microedition.io.file.FileC
import javax.microedition.io.C
public class CGame extends Canvas {
public void paint(Graphics g)
//Image2Bytes by AnderLu
//生成的byte[]数组可直接用于外部存储为.png格式的图片文件看图软件可直接打开
public static int IDATPOS;
public static int haha = 0;
public static byte[] HEADChunk = {
(byte) 0x89, (byte) 0x50,
(byte) 0x4E, (byte) 0x47,
(byte) 0x0D, (byte) 0x0A,
(byte) 0x1A, (byte) 0x0A,
public static byte[] tRNSChunk = {
(byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x01,
(byte) 0x74, (byte) 0x52,
(byte) 0x4E, (byte) 0x53,
(byte) 0x00,
(byte) 0x40, (byte) 0xE6,
(byte) 0xD8, (byte) 0x66,
public static byte[] IENDChunk = {
(byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00,
(byte) 0x49, (byte) 0x45,
(byte) 0x4E, (byte) 0x44,
(byte) 0xAE, (byte) 0x42,
(byte) 0x60, (byte) 0x82
public void save(Image im)
byte data[] = Image2Bytes(im);
this.img = Image.createImage(data, 0, data.length);
saveFile("file:///E:/jieping/" + haha +".png", data); //路径,haha变量递增 保存名为1.png,2.png
/**保存文件
* @path:路径
* @fileData:文件数据
* @return: 0:出现异常,1:保存成功
public int saveFile(String path, byte[] fileData) {
FileConnection fc =
fc = (FileConnection) Connector.open(path, Connector.READ_WRITE);
if (!fc.exists()) {
fc.create();
OutputStream os = fc.openOutputStream();
os.write(fileData);
os.flush();
os.close();
fc.close();
} catch (IOException ex) {
ex.printStackTrace();
public byte[] Image2Bytes(Image img) {
int w = img.getWidth();
int h = img.getHeight();
int offset = 0;
byte buffer[] = new byte[(w * 4 + 1) * h + offset];
getImageBufferForImageARGB8888(img, buffer, w, h, offset);
System.gc();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dout = new DataOutputStream(baos);
WritePng(dout, w, h, buffer, null, false, offset);
byte[] data = baos.toByteArray();
writeCRC(data, 8); //更新IHDR CRC
writeCRC(data, 33); //更新PLTE CRC
writeCRC(data, IDATPOS); //更新IDAT CRC
System.gc();
} catch (IOException ex) {
ex.printStackTrace();
public static void writeCRC(byte[] data, int chunkpos) {
int chunklen = ((data[chunkpos] & 0xFF) && 24)
| ((data[chunkpos + 1] & 0xFF) && 16)
| ((data[chunkpos + 2] & 0xFF) && 8)
| (data[chunkpos + 3] & 0xFF);
int sum = CRCChecksum(data, chunkpos + 4, 4 + chunklen) ^ 0
int pos = chunkpos + 8 +
data[pos] = (byte) ((val & 0xFF000000) && 24);
data[pos + 1] = (byte) ((val & 0xFF0000) && 16);
data[pos + 2] = (byte) ((val & 0xFF00) && 8);
data[pos + 3] = (byte) (val & 0xFF);
public static int[] crc_ //CRC 表
public static int CRCChecksum(byte[] buf, int off, int len) {
if (crc_table == null) {
crc_table = new int[256];
for (mkn = 0; mkn & 256; mkn++) {
for (mkk = 0; mkk & 8; mkk++) {
if ((mkc & 1) == 1) {
mkc = 0xedb88320 ^ (mkc &&& 1);
mkc = mkc &&& 1;
crc_table[mkn] =
for (n = n & len + n++) {
c = crc_table[(c ^ buf[n]) & 0xff] ^ (c &&& 8);
public static long adler32(long adler, byte[] buf, int index, int len) {
int BASE = 65521;
int NMAX = 5552;
//TODO remove this function at all
if (buf == null) {
return 1L;
long s1 = adler & 0
long s2 = (adler && 16) & 0
while (len & 0) {
k = len & NMAX ? len : NMAX;
while (k &= 16) {
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
s1 += buf[index++] & 0
if (k != 0) {
s1 += buf[index++] & 0
} while (--k != 0);
s1 %= BASE;
s2 %= BASE;
return (s2 && 16) | s1;
public static void WritePng(DataOutputStream output, int width, int height,
byte[] buffer, byte[] colors,
boolean Transparent, int offset) throws
IOException {
int adler = (int) adler32(1l, buffer, offset, buffer.length - offset);
byte[] lenNlen = { //压缩块的LEN和NLEN信息
(byte) 0xfa, (byte) 0x7e,
(byte) 0x05, (byte) 0x81
IDATPOS = 0;
output.write(HEADChunk);
IDATPOS += HEADChunk.
output.writeInt(13); //len
output.writeInt(); //IHDR type code
output.writeInt(width); //写宽度
output.writeInt(height); //写高度
output.writeByte(8); //1Bitdepth
if (colors == null) {
output.writeByte(6); //2ColorType
output.writeByte(3); //2ColorType
output.writeByte(0); //3CompressionMethod
output.writeByte(0); //4Filter method
output.writeByte(0); //5Interlace method
output.writeInt(0); //写crc
IDATPOS += 25;
if (colors != null) {
output.writeInt(colors.length); //len
output.writeInt(); //type code
output.write(colors); //data
output.writeInt(0); //crc
IDATPOS += colors.length + 12;
if (Transparent) {
output.write(tRNSChunk);
IDATPOS += tRNSChunk.
byte[] dpixels =
int bufferlen = dpixels.length -
int blocklen = 32506;
int blocknum = 1;
if ((dpixels.length % blocklen) == 0) {
blocknum = bufferlen /
blocknum = (bufferlen / blocklen) + 1;
int IDATChunkLen = (bufferlen + 6 + blocknum * 5);
output.writeInt(IDATChunkLen); //len
output.writeInt(); //idat type code
output.writeShort((short) 0x78da); //78da
for (int i = 0; i & i++) {
int off = i *
int len = bufferlen -
if (len &= blocklen) {
lenNlen[0] = (byte) 0;
lenNlen[0] = (byte) 1;
int msb = (len & 0xff);
int lsb = (len &&& 8);
lenNlen[1] = (byte)
lenNlen[2] = (byte)
lenNlen[3] = (byte) (msb ^ 0xff);
lenNlen[4] = (byte) (lsb ^ 0xff);
output.write(lenNlen);
output.write(dpixels, off + offset, len);
output.writeInt(adler); //IDAT adler
output.writeInt(0); //IDAT crc
output.write(IENDChunk);
public static void getImageBufferForImageARGB8888(Image img, byte[] rawByte,
int w, int h, int off) {
int[] raw = new int[w];
for (int j = 0; j & j++) {
img.getRGB(raw, 0, w, 0, j, w, 1);
for (int i = 0; i & raw. i++) {
int ARGB = raw[i];
int a = (ARGB & 0xff000000) && 24;
int r = (ARGB & 0xff0000) && 16;
int g = (ARGB & 0xff00) && 8;
int b = ARGB & 0
if (i % w == 0) {
rawByte[n] = (byte)
rawByte[n + 1] = (byte)
rawByte[n + 2] = (byte)
rawByte[n + 3] = (byte)
System.gc();
注意:截屏命名是以1、2、3、4数字++命名的,如1.png,2.png等等,该程序设计的触发截屏事件是点击屏幕左上角,这个根据具体需要随意改了,并且图片保存命名规则也需要完善下。
曾尝试过截屏的时候弄点提示,但这是万万不可的,在屏幕上出现任何提示都将会被截屏记录下来,所以我在写这个功能的时候,很是认真的考虑了截屏的完整性及安全性,只要触发了,程序会自动屏蔽所有操作等待截屏操作结束,结束后恢复,也就是说机器慢的,触发截屏了,你在点或者做其他的程序界面的操作,那都是不可能的,截屏生成保存文件这个过程结束后才可以。
附件:截屏类(其实就是把image对象转成png并保存到指定路径的方法)
下载次数: 105
javaichiban
等级: 初级会员
来自: 北京
发表时间:&&
好文!!
另外我记得在真彩色png图中,PLTE, tRNS等块应该是可以省略的。
请登录后投票
跳转论坛:移动开发技术
Web前端技术
Java企业应用
编程语言技术内容字号:
段落设置:
字体设置:
精准搜索请尝试:
Win10 Mobile手机Continuum平板模式截图独家揭秘
来源:作者:玄隐责编:玄隐
Continuum手机平板模式是2015年4月微软宣布的旗舰重要特性,允许用户将手机屏幕无缝映射到较大屏幕上,辅以键鼠,实现PC操作的效果。不过自从发布以来,微软从未正式演示过。昨天,宏碁Win10旗舰手机Jade Primom,现场有过该特性演示。外媒WinBeta带来一些重要的演示资料。随着该功能第一次开启,微软就试图打造贴近你熟悉的桌面操作系统。有熟悉的任务栏,有开始菜单、后退、搜索、任务视图等等。开始菜单就是手机的开始屏幕,当然也可以滑动到右边的程序列表。应用启动后,Win10通用应用开始发挥长处,自适应窗口大小,虽然看起来像Win10 PC桌面,但是实际上来自Win10手机。这里主要利用的场景就是Office Mobile的使用,用户可以使用键盘和鼠标,并且还支持日常的快捷键操作。不过我们注意到在使用应用时不会在最上面的状态栏,可能让人不适应。不过你可以将鼠标移到屏幕最上方,就可以唤出手机上的状态栏,比如设置WiFi等等。所有的UWP应用都满足Continuum手机平板模式,因为在开发时就被设置可以调整窗口大小。这意味着像应用商店、闹钟、新闻、天气、设置等等都可以使用。当处于Continuum手机平板模式时,你也可以正常使用Win10手机。比如,当你正在使用Excel Continuum模式操作时,这时候来短信或者电话,你可以在手机上处理,并且Excel Continuum模式不会被终止。微软是Continuum手机的赢家,不过遗憾的是,这仅适用于最新的Win10旗舰手机,有着硬件上的要求。Win10旗舰手机还能开启Miracast无线Continuum模式,或者使用有线的USB-C与HDMI或显示接口的连接转换。微软预计将在10月份发布Win10旗舰手机Lumia950、Lumia950 XL,将提供Continuum手机平板模式功能的完整支持。(via: WinBeta)
软媒旗下软件:
IT之家,软媒旗下科技门户网站 - 爱科技,爱这里。
Copyright (C) , All Rights Reserved.Win10 Mobile预览版10162截图曝光|win10|mobile-手机行情_华商网数码
Win10 Mobile预览版10162截图曝光
[摘要]微软正在测试Win10 Mobile Build 10159,这可能是下一个快速推送版本。在Win10手机版10158中,微软加入了新的应用透明动态磁贴、人脉动态显示、新版本的电子钱包、应用商店移除Beta等。
  看起来,微软Win10
Mobile的开发速度正在加快。我们正在等待下一代Win10手机版推送时,外媒WindowsMania.pl今天曝光了Win10
Mobile预览版10162的系统截图。  外媒称,微软正在测试Win10 Mobile Build
10159,这可能是下一个快速推送版本。在Win10手机版10158中,微软加入了新的应用透明动态磁贴、人脉动态显示、新版本的电子钱包、应用商店移除Beta等。 编辑:丁旭
相关热词搜索:
相关阅读:
增值电信业务经营许可证B2-
陕网文许字[7号
本网法律顾问 陕西赢弘律师事务所
王正兴 律师 联系方式:
华商应用:不只是快捷 移动办公族必须Get截屏技巧
 作者: 厂商投稿 编辑:
&&& 随着智能功能越来越强大,的办公属性在不断增强。由于移动端并非电脑,所以在截图上并没有那么方便,如果你是一个移动办公一族,那么在处理手机截屏这件事上,其实有着很多提高工作效率的方法。&&& 在使用电脑工作的时候,我们可以通过很多方式截图,如QQ自带的截图Ctrl+Alt+A的截图快捷键,还有很多浏览器自带的截图功能。但是一旦离开PC,使用手机时,截图也有很多种实现方法。iPhone的方式是同时按住键和Home键,很多安卓手机采用了键+音量键、音量键+虚拟按键等多种组合方式,这种以组合按键进行截图的方式,是目前大部分手机的常态设置。由于组合顺序不同,而且在按压时需要多个键位同时配合,所以在记忆操作方式和具体操作时,会给用户带来很多麻烦。&&& 有没有一种截屏方式,能够简单又好用?华为Mate S的指关节2.0就带来了截屏的非凡体验。在Mate S上截屏,你不需要按各种组合键,只要使用指关节连续敲击屏幕两下,随着清脆的咔嚓提示音,都会将任何界面的全屏图像截取出来。有时我们并不想截取全屏,比如聊天记录的分享,经常会遇到只想分享一部分的情况。如果这时你用的是iPhone,那么需要截图完成后进入照片库将截图进行剪裁,才能发送。而在Mate S上,只需要用指关节在屏幕上滑出想截取的范围,形成一个封闭的形状,即可轻松截图出各种局部,甚至可以随你滑动的形状截出异形图形。&&& 3G的普及将移动互联从WAP文字带进了读图时代,4G、5G的发展则将让移动互联迈进了视频时代,视频分享成为目前很多用户的使用需求。但是遇到想分享手机屏幕内容的情况,目前无论是还是终端厂商都没有给出很好的解决方案,直到Mate S上指关节录屏功能的出现。▲&&& 其实,用户对于手机录屏的需求潜力非常大,随着手机成为生产力制造工具,很多专业操作需要在手机上完成,一旦涉及一些繁琐操作,录屏教程就显得非常有必要。而视频、游戏等娱乐性内容的创造与分享,也让录屏会得到大部分用户的青睐。在Mate S上想要实现录屏,只要使用双指关节敲击屏幕两次,即可开始录屏,而且还可以选择是保存成高清视频还是便于网络分享的小视频格式,覆盖用户的不同使用和分享需求。&&& 相信很多移动办公族每天都会围绕截屏、录屏进行不少操作,而Mate S通过指关节2.0技术,将截屏和录屏方式轻松融入到人手的日常操作中,让截屏录屏的操作过程不再复杂,这不仅仅让截屏录屏更快捷,也开创了除了点击、滑动外的全新人机交互维度。相信使用过Mate S的截屏录屏之后,你会很快适应并且爱不释手。

我要回帖

更多关于 xhamster moible 的文章

 

随机推荐