关于javalibpng的信息
本篇文章给大家谈谈javalibpng,以及对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、CVI里怎么使用opencv函数
- 2、如何开发Java动态人脸识别
- 3、opencv 分水岭分割算法的问题,算出的marker是用-1来表示分割线是什么意思,下面两种convertTo能解释下吗
- 4、APK反编译后回编译失败是为什么?
- 5、200分c/c++/java/c#读取png图片
- 6、如何只生成 chrome.sln 工程文件以便编译 chromium
CVI里怎么使用opencv函数
整个项目的结构图:
编写DetectFaceDemo.java,代码如下:
[java] view
plaincopyprint?
package com.njupt.zhb.test;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;
//
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
public class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());
// Create a face detector from the cascade file in the resources
// directory.
//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());
//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());
//注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误
/*
* Detected 0 faces Writing faceDetection.png libpng warning: Image
* width is zero in IHDR libpng warning: Image height is zero in IHDR
* libpng error: Invalid IHDR data
*/
//因此,我们将第一个字符去掉
String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);
CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);
Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "faceDetection.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
package com.njupt.zhb.test;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;
//
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
public class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());
// Create a face detector from the cascade file in the resources
// directory.
//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());
//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());
//注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误
/*
* Detected 0 faces Writing faceDetection.png libpng warning: Image
* width is zero in IHDR libpng warning: Image height is zero in IHDR
* libpng error: Invalid IHDR data
*/
//因此,我们将第一个字符去掉
String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);
CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);
Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "faceDetection.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
3.编写测试类:
[java] view
plaincopyprint?
package com.njupt.zhb.test;
public class TestMain {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
System.loadLibrary("opencv_java246");
new DetectFaceDemo().run();
}
}
//运行结果:
//Hello, OpenCV
//
//Running DetectFaceDemo
///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml
//Detected 8 faces
//Writing faceDetection.png
package com.njupt.zhb.test;
public class TestMain {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
System.loadLibrary("opencv_java246");
new DetectFaceDemo().run();
}
}
//运行结果:
//Hello, OpenCV
//
//Running DetectFaceDemo
///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml
//Detected 8 faces
//Writing faceDetection.png
如何开发Java动态人脸识别
1.环境搭建
整个项目的结构图
2.编写DetectFaceDemo.java,代码如下:
[java] view plaincopy
package com.njupt.zhb.test;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;
//
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
public class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());
// Create a face detector from the cascade file in the resources
// directory.
//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());
//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());
//注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误
/*
* Detected 0 faces Writing faceDetection.png libpng warning: Image
* width is zero in IHDR libpng warning: Image height is zero in IHDR
* libpng error: Invalid IHDR data
*/
//因此,我们将第一个字符去掉
String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);
CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);
Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "faceDetection.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
3.编写测试类:
[java] view plaincopy
package com.njupt.zhb.test;
public class TestMain {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
System.loadLibrary("opencv_java246");
new DetectFaceDemo().run();
}
}
//运行结果:
//Hello, OpenCV
//
//Running DetectFaceDemo
///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml
//Detected 8 faces
//Writing faceDetection.png
opencv 分水岭分割算法的问题,算出的marker是用-1来表示分割线是什么意思,下面两种convertTo能解释下吗
整个项目的结构图:
编写DetectFaceDemo.java,代码如下:
[java] view
plaincopyprint?
package com.njupt.zhb.test;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;
//
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
public class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());
// Create a face detector from the cascade file in the resources
// directory.
//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());
//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());
//注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误
/*
* Detected 0 faces Writing faceDetection.png libpng warning: Image
* width is zero in IHDR libpng warning: Image height is zero in IHDR
* libpng error: Invalid IHDR data
*/
//因此,我们将第一个字符去掉
String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);
CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);
Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "faceDetection.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
package com.njupt.zhb.test;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;
//
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
public class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());
// Create a face detector from the cascade file in the resources
// directory.
//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());
//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());
//注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误
/*
* Detected 0 faces Writing faceDetection.png libpng warning: Image
* width is zero in IHDR libpng warning: Image height is zero in IHDR
* libpng error: Invalid IHDR data
*/
//因此,我们将第一个字符去掉
String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);
CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);
Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "faceDetection.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
3.编写测试类:
[java] view
plaincopyprint?
package com.njupt.zhb.test;
public class TestMain {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
System.loadLibrary("opencv_java246");
new DetectFaceDemo().run();
}
}
//运行结果:
//Hello, OpenCV
//
//Running DetectFaceDemo
///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml
//Detected 8 faces
//Writing faceDetection.png
package com.njupt.zhb.test;
public class TestMain {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
System.loadLibrary("opencv_java246");
new DetectFaceDemo().run();
}
}
//运行结果:
//Hello, OpenCV
//
//Running DetectFaceDemo
///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml
//Detected 8 faces
//Writing faceDetection.png
APK反编译后回编译失败是为什么?
、反编译=回编译后分别是
smali目录 回编译为 classes.dex 文件
res目录 回编译为 resources.arsc 文件
2、回编译顺序
在回编译时,会先检查“源”即resources
当你汉化文件,修改出错了(缺少一个符号也不行),
那么回编译会自动跳过编译res文件夹,直接回编译smali 。
所以,如果没有对smali(classes.dex)汉化,那么建议大家删掉这个文件夹,
这要会大大加快回编译速度。1、反编译=回编译后分别是
smali目录 回编译为 classes.dex 文件
res目录 回编译为 resources.arsc 文件
2、回编译顺序
在回编译时,会先检查“源”即resources
当你汉化文件,修改出错了(缺少一个符号也不行),
那么回编译会自动跳过编译res文件夹,直接回编译smali 。
所以,如果没有对smali(classes.dex)汉化,那么建议大家删掉这个文件夹,
这要会大大加快回编译速度。
3、出错问题1
在汉化时,往往会不小心删掉一些符号,如 "" ""符号等等。
string name="app_name"File Manager/string
string name="app_name"文件管理器/string
string name="app_name"文件管理器/string
这些小小的错误都会导致回编时译检查出错。
所以汉化时,注意对校,然后再回编译。
建议使用一些高级的文本编辑器,支持语法高亮视图的。
4、出错问题2
最近发现有些APK文件 反编译后,就算不汉化直接回编译,都会出错。
有可能的原因1,反编译后XML文件语法中@符号 前面多了"\" (\@ ),
用文本编辑工具 直接替换【\@】为【@】,应该可以解决。
建议使用最新版本的反编译工具。
5、建议大家使用新版本的APKTool工具,
当然如果新的有问题也可以试试旧的一、系统文件汉化再次强调
1、汉化Settings.apk(系统设置)、MMS.apk(信息)、Phone.apk(电话)、
等等系统文件,一定要先 安装构架,具体看另个文件
关于APKTool工具反编译Settings.apk问题。
2、系统文件汉化完后不需要签名,直接替换汉化后的文件,就可以了。
主要是,系统文件放在系统目录,无需再次读取签名获得权限,已经是高级了。
二、打包说明
1、通常汉化完回编译后,会自动生成所有APK内的文件,或者自动生成*.APK文件。
但是建议大家不要直接使用该文件,进了使用替换法,替换掉你汉化后的文件,
如:resources.arsc,如果修改过的图片,等等…
2、很多人对于APK文件 解压缩或压缩 都用“WinRAR”或“好压”,这里不推荐。
希望大家安装7-Zip这个压缩工具,对于zip格式的支持是最好的。而且很方便,
不需要重新关联apk 直接右键打开就行了。替换直接拖拉进去,就OK了一、回编译出错问题
(1.提示 strings.xml 最后一行错误,检查是否/string符号错误;
在汉化时,往往会不小心删掉一些符号,如 "" ""符号等等。
string name="app_name"File Manager/string
string name="app_name"文件管理器/string
string name="app_name"文件管理器/string
(2.提示 strings.xml 最顶部含中文代码首行错误,编码格式不对,转换成 UTF-8;
(3.提示 public.xml 出错,检查改动过的 arrays.xml 是否代码有错误的地方;
二、一切能正常但无法回编译
还有一种情况,apktool最新版本能正常反编译一个apk文件,在未做任何修改的情况下,无法回编译。
这是就要注意了,可以尝试一下用低版本的apktool进行【反编译】,然后在用高版本的apktoo工具【回编译】。
这里向大家推荐用 【APKDB】 这个工具,很方便,反编译时可以选择apktool的版本。
200分c/c++/java/c#读取png图片
没必要那么麻烦.只要使用GDI+库里面的Bitmap对象和Graphics对象就可以了。WindowsXP以上的OS都提供GDI+图形接口了,他的功能比GDI接口更强大,使用更方便。建议你可以查查GDI+的用法。这里给你个最简单的C#的例子:
System.Drawing.Bitmap bmp = new Bitmap("1.png");//创建Bitmap对象
System.Drawing.Color c = bmp.GetPixel(0, 0);//获得图像上(0,0)点的像素值
int a = c.A;//该像素的Alpha通道值
int r = c.R;//该像素的红色通道值
int g = c.G;//该像素的绿色通道值
int b = c.B;//该像素的蓝色通道
那建议你上网查一查PNG格式的标准,就知道PNG文件里的数据排列了。但PNG是压缩过的,所以你还得有解压算法才行。
png的存储格式:
关键数据块中有4个标准数据块:
文件头数据块IHDR(header chunk):包含有图像基本信息,作为第一个数据块出现并只出现一次。
调色板数据块PLTE(palette chunk):必须放在图像数据块之前。
图像数据块IDAT(image data chunk):存储实际图像数据。PNG数据允许包含多个连续的图像数据块。
图像结束数据IEND(image trailer chunk):放在文件尾部,表示PNG数据流结束。
在第二个数据块中包含了调色板数据块。可是,当我们去解析png24时,却未找到调色板、并且我们发现png24的存储模式是点阵颜色值加一位的阿尔法通道值构成的,这种存储模式根本不需要调色板的存在。基于这种存储模式,png24的位深最低是32位真彩,在我们看到的图像过渡中会很圆润,因为每个点都可以是不同的色彩以及不同的透明值。而这种模式也是我们最常使用、大家所理解中的png模式。至于"png"后面的“24”可见也和位深并无关系,至于为什么叫24,我也没有找到具体的答案。
png24源数据中无调色盘的存在,而在标准数据块的第二块中,却显示了调色板数据块。即然存在,肯定是有意义的,可见png有另外一种存储模式--带色盘的png8模式。png8有点类似于GIF,包含了一个调色板,并在调色板上有一个透明颜色值,这种模式在计算机的存储中,每个点阵存储的是色盘索引、并且无阿尔法半透明位。所以,png8在颜色位深上,可以低于32位;也可以使用更换色盘的技术来处理一些独特的效果;但是由于每个点阵没有阿尔法定义,边缘会像GIF一样存在锯齿现像。
好像讲的有点乱,总结一下区别吧:
png8和png24的根本区别,不是颜色位的区别,而是存储方式不同;
png8 色盘索引、调色板中一位透明值、不支持阿尔法通道的半透明,存储格式中每个像素无透明度的数据块定义;
png24 无调色板、支持阿尔法通道的半透明、每个点阵都有透明度的定义,最低32位真彩色;
特性
支持256色调色板技术以产生小体积文件
最高支持48位真彩色图像以及16位灰度图像。
支持阿尔法通道的半透明特性。
支持图像亮度的gamma校正信息。
支持存储附加文本信息,以保留图像名称、作者、版权、创作时间、注释等信息。
使用无损压缩
渐近显示和流式读写,适合在网络传输中快速显示预览效果后再展示全貌。
使用CRC循环冗余编码防止文件出错。
最新的PNG标准允许在一个文件内存储多幅图像。
看。有使用无损压缩和多幅图像。挺复杂的哦!
;oldid=88484
看下面W3C的网站介绍。你就知道有多复杂了。不用库函数,我觉得你的想法太不现实。对与BMP这样格式还可以,对于PNG,不行。
如何只生成 chrome.sln 工程文件以便编译 chromium
一,编译之前的准备。
1) 了解代码组织结构。
Chrome source非常庞大,并且在其主目录下还包含有工具和组件,任何一个工具和组件也附带有其源代码。首先得熟悉这些源代码的组织结构,在中包含如下子目录:releases,曾经发布过的chrome源代码的正式版本;trunk,当前最新的源代码。由于releases中的代码比较旧,这里就不做说明了,只说明trunk的结构。在trunk下面有3个重要的目录,deps包含了chrome编译和运行所需要的全部组件的代码。src里面包含的则是chrome的主程序的代码,tools包含的是下载和配置编译所需要的第三方工具的压缩包和源代码,其中就有svn和python这2个比较重要的工具,后面再详细介绍。暂时做这样一个简单的介绍,因为其组织结构比较负责,以后再作补充斧正。
2)如何下载和同步源代码。
首先谈谈下载:
1,最简单的方法是从chrome官网上直接下载源代码压缩包,地址是。
2,或者采用svn从这个地方heckout,这要求你先在本地建一个源代码的主目录。
3,另外一个办法则是采用google提供的一个部署工具depot_tools。虽然这几种办法都可下载完整的源代码,但目前的情况是:chrome基于Visual Stdio 2005 进行编译,如果顺利完成编译工作,自然少不了sln文件,较早的源代码中包含有现成的sln和vcproject文件,但后来做了修改,这些文件被抛弃掉,Google自己开发了一种脚本工具叫做GYP,这个工具采用python编写,GYP采用了自定义的一套规则,用于生成各种工程文件。而关键的python则包含于depot_tools中,因此不论采用什么方法下载的代码,都得下载depot_tools这个工具,以获得必须的工程文件。
depot_tools位于 下面,包括一个目录和一个zip格式的压缩包。
3)关于编译器
前面提到Chrome采用Visual Stdio 2005进行编译,根据的说明,需进行如下操作正常编译
a, 安装Visual Studio 2005.
b, 安装Visual Studio 2005 Service Packe 1.
c, 安装Visual Studio Hotfix 947315.
d, 如果是vista系统,还需安装Visual Studio 2005 Service Packe 1 Update for Windows Vista.
e, 安装Windows 2008 SDK,如果是Visual Studio 2008则不需要这一步。
f, 配置Windows 2008 SDK,使2008 SDK成为首选开发库,以获得一些新功能和特性。办法是在开始-程序-Microsoft Windows SDK v6.1 Visual Studio Registration Windows SDK Configuration Tool,选择make current按钮。也可以在VS里面手动配置include和libary路径,效果是一样的。
二,如何配置工程文件
1,如果是采用depot_tools,那么从代码下载到生成sln文件会自动完成。其步骤是
(1)下载depot_tools到本地存储,假设位于d:/depot_tools.
(2)将d:/depot_tools添加到系统环境变量中。
(3)创建一个源代码根目录,假设为 d:/chrome,目录不得包含空格。
(4)在命令行下切换当前目录到d:/chrome。
(5)执行命令 gclient config ,该命令会首先下载svn和python分别到d:/depot_tools/svn_bin和d:/depot_tools/python_bin。
(6)执行命令 gclient sync 这个命令会调用svn同步源代码。这个过程会比较漫长。全部完成之后全部源代码就保存在d:/chrome里面。未编译的代码大约有4个G左右,过程将十分漫长。这样获得的源代码已经包含所有的工程文件,可直接打开。
重点说明一下gclient,它实际上是一个批处理文件,它主要做了如下一些事情,首先设置环境变量,如代码根目录,工具根目录等。其次调用win_tools.bat从服务器下载svn和python。最后调用python.exe对Chrome.gyp进行解析生成所有工程文件。
另外需要说明的是,gclient sync的过程非常漫长,根据命令行的提示来看总共需要同步67个项目(不是工程),期间可能会因为一些原因导致错误而退出这个过程,需要继续调用sync。比如网络出现故障svn会多次进入sleep状态然后重试,如果多次失败就会报错退出,还有的情况是某些子目录的属性问题无法同步,可根据提示进行操作。还有个目前新出现的问题,下面2个目录“src/webkit/data/layout_tests/LayoutTests”和“src/third_party/WebKit/LayoutTests”的源代码是从src.webkit.org签出来的,但是这个网站目前存在问题无法签出代码, 需要屏蔽掉这2个目录,由于里面是测试代码,即使丢弃也不会影响整个工程的编译,方法是打开trunk下面的.gclient文件,向里面添加如下内容
"custom_deps" : {
"src/webkit/data/layout_tests/LayoutTests":None,
"src/third_party/WebKit/LayoutTests":None,
},
这样svn就能完成代码的同步了。最后gclient会调用depot_tools/python_bin/python.exe 对 src/build/gyp_
chromium进行处理,这样就得到了所有的sln和vcproject文件。
2,如果是下载的代码压缩包或者checkout的代码,代码目录里面没有sln文件,这个时候需要调用命令行进入源代码根目录,然后执行命令 gclient runhooks --force,命令执行后会直接对Chrome.gyp进行解析,生成sln文件。
在实际下载过程中,最开始的时候我用TortoiseSVN从 checkout源代码,但是得到的代码只有几百兆,执行gclient runhooks --force命令后也没有找到sln文件,具体原因未知,不建议使用此方式。而直接下载代码压缩包的方式没有尝试过,不知道是否可行。因此最稳妥的方法还是使用depot_tools来部署和处理源代码。
三 编译工程
启动Visual Studio 2005打开 src/chrome/browser/chrome.sln,或者打开src/build/all.sln,如果打开的是chrome.sln里面包含480个工程,而all.sln则包含507个工程,一些09年的编译说明提到有300左右的工程,可见chrome的代码变动比较大。对整个解决方案进行编译,打开需要2个小时才能完成编译,视硬件环境而定,内存越大越快,推荐4G以上内存,酷睿2核或者4核。编译完成以后据说会占用30G的空间。编译后的文件位于 d:/chorme/chrome/debug 目录或者 d:/chorme/chrome/release目录下。
四 chrome涉及的开源项目
Chrome 采用了很多开源项目,这里把它们列出来以备后用,目前Chrome涉及25个开源代码:
1、Google Breakpad
/src/breakpad
开源的跨开台程序崩溃报告系统。
2、Google URL
/src/googleurl
Google小巧的URL解析整理库。
3、Skia
/src/skia
矢量图引擎。
4、Google v8
/src/v8
Google开源的JavaScript引擎。V8实现了ECMA-262第三版的ECMAScript规范,可运行于Windows XP 和 Vista, Mac OS X 10.5 (Leopard), 及 Linux等基于IA-32 或 ARM 的系统之上。V8可单独运行也可嵌入到任何C++程序中。
5、Webkit
/src/webki
开源的浏览器引擎
6、Netscape Portable Runtime (NSPR)
/src/base/third_party/nspr
Netscape Portable Runtime (NSPR) 提供了系统级平台无关的API及类似libc的函数。
7、Network Security Services (NSS)
/src/base/third_party/nss
Network Security Services (NSS) 一套用于支持服务器端与客户端安全开发的跨平台函数库。程序通过NSS可支持SSL v2 and v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 认证及其它一些安全标准。
8、Hunspell
/src/chrome/third_party/hunspell
Spell checker and morphological analyzer library and program designed for languages with rich morphology and complex word compounding or character encoding.
9、Windows Template Library
/src/chrome/third_party/wtl
用于开发Windows程序与UI组件的C++ library。WTL扩展了ATL (Active Template Library) 并提供一套用于controls, dialogs, frame windows, GDI objects等开发的类。
10、Google C++ Testing Framework
/src/testing/gtest
Google用于编写C++测试的基于xUnit架构的框架,可用于多种平台上:Linux, Mac OS X, Windows, Windows CE, and Symbian。支持自动测试发现,有一套丰富的Assertions断言,用于可自定义断言,death tests, fatal and non-fatal failures, various options for running the tests, and XML test report generation.
11、bsdiff 与 bspatch
/src/third_party/bsdiff 及 /src/third_party/bspatch
bsdiff 与 bspatch 用于为二进制文件生成补丁。
12、bzip2
/src/third_party/bzip2
bzip2使用Burrows-Wheeler block sorting text compression 算法与Huffman编码压缩文件。
13、International Components for Unicode (ICU)
/src/third_party/icu38
ICU是一套成熟并被广泛使用的C/C++ 及 Java 库,可为软件提供Unicode与全球化支持。
14、libjpeg
/src/third_party/libjpeg
用于处理JPEG (JFIF)图像格式的库。
15、libpng
/src/third_party/libpng
PNG图像格式库。支持绝大部分的PNG特性,可扩展。已经被广泛地使用了13年以上了。
16、libxml
/src/third_party/libxml
C语言的XML解析库。
17、libxslt
/src/third_party/libxslt
C语言的XSLT库。
18、LZMA
/src/third_party/lzma_sdk
LZMA为7-Zip软件中7z格式压缩所使用的压缩算法,有很好的压缩效果。
19、stringencoders
/src/third_party/modp_b64
一系列高性能的c-string转换函数,比如:base 64 encoding/decoding。通常比其标准实现快两倍以上。
20、Netscape Plugin Application Programming Interface (NPAPI)
/src/third_party/npapi
多种浏览器使用的跨平台插件架构。
21、Pthreads-w32
/src/third_party/pthread
用于编写多线程程序的API
22、SCons - a software construction tool
/src/third_party/scons
开源的软件构建工具——下一代的编译工具。可以认为SCons是改进过的跨平台配上autoconf/automake与ccache的Make工具的子系统。
23、sqlite
/src/third_party/sqlite
大名鼎鼎的嵌入式数据库引擎。自管理、零配置、无需服务器、支持事务。
24、TLS Lite
/src/third_party/tlslite
SSL 3.0, TLS 1.0, and TLS 1.1的Python免费实现库。TLS Lite支持这些安全验证方式:SRP, shared keys, and cryptoIDs in addition to X.509 certificates。注:Chrome并不包涵Python。TLS Lite用于Chrome开发过程中的代码覆盖、依赖检查、网页加载时间测试及生成html结果比较等。
25、zlib
/src/third_party/zlib
zlib为一套用于任意平台与机器的无损数据压缩的库,它免费、自由、无任何法律专利问题。
关于javalibpng和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
发布于:2022-11-25,除非注明,否则均为
原创文章,转载请注明出处。