ubuntu 10.10 移植SKIA

桌面环境:vmware虚拟机ubuntu10.10

root@ubuntu10:/work# uname -a
Linux ubuntu10 2.6.35-27-generic #48-Ubuntu SMP Tue Feb 22 20:25:29 UTC 2011 i686 GNU/Linux

root@ubuntu10:/work# date
2011年 04月 09日 星期六 20:36:32 CST
下载SKIA源码:
root@ubuntu10:/work/skia-read-only# svn info 
路径: .
URL: http://skia.googlecode.com/svn/trunk
版本库根: http://skia.googlecode.com/svn
版本库 UUID: 2bbb7eff-a529-9590-31e7-b0007b416f81
版本: 1083
节点种类: 目录
调度: 正常
最后修改的作者: mike@reedtribe.org
最后修改的版本: 1083
最后修改的时间: 2011-04-08 10:41:54 +0800 (五, 2011-04-08)

下载下来以后,编译不过,缺少头文件。依次安装jpeg,png,libz,freetype,gif库。安装时执行命令:.configure;make ;make install。
然后make.oK

写测试程序:
root@ubuntu10:/work/skia-read-only/wanghuan# cat main.cpp -n
     1
    15
    20
    21
    22 #include "SkBitmap.h"
    23 #include "SkDevice.h"
    24 #include "SkPaint.h"
    25 #include "SkRect.h"
    26 #include "SkImageEncoder.h"
    27 int main()
    28 {
    29        // Declare a raster bitmap, which has an integer width and height,
    30        // and a format (config), and a pointer to the actual pixels.
    31        // Bitmaps can be drawn into a SkCanvas, but they are also used to
    32        // specify the target of a SkCanvas' drawing operations.
    33        SkBitmap bitmap;
    34        bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200);
    35        bitmap.allocPixels();
    36 bitmap.eraseColor(0);
    37
    38        // A Canvas encapsulates all of the state about drawing into a
    39        // device (bitmap).  This includes a reference to the device itself,
    40        // and a stack of matrix/clip values. For any given draw call (e.g.
    41        // drawRect), the geometry of the object being drawn is transformed
    42        // by the concatenation of all the matrices in the stack. The
    43        // transformed geometry is clipped by the intersection of all of the
    44 // clips in the stack.
    45 SkCanvas canvas(bitmap);
    46
    47        // SkPaint class holds the style and color information about how to
    48        // draw geometries, text and bitmaps.
    49        SkPaint paint;
    50        // SkIRect holds four 32 bit integer coordinates for a rectangle.
    51        SkRect r;
    52        paint.setARGB(255, 255, 0, 0);
    53        r.set(25, 25, 145, 145);
    54        canvas.drawRect(r, paint);
    58        paint.setARGB(255, 0, 255, 0);
    59        r.offset(20, 20);
    60        canvas.drawRect(r, paint);
    61        paint.setARGB(255, 0, 0, 255);
    62        r.offset(20, 20);
    63        canvas.drawRect(r, paint);
    64        // SkImageEncoder is the base class for encoding compressed images
    65        // from a specific SkBitmap.
    66        SkImageEncoder::EncodeFile("snapshot.png", bitmap,
    67                SkImageEncoder::kPNG_Type,
    68                 100);
    69        return 0;
    70 }
这里使用了unix-test-app目录的Makefile修改:
root@ubuntu10:/work/skia-read-only/wanghuan# cat Makefile  -n
     1 # Build the unix test app
     2 C_INCLUDES := -I../include/core \
     3              -I../include/config \
     4              -I../include/effects \
     5              -I../include/images \
     6              -I../include/utils \
     7              -I../include/views \
     8              -I../include/xml \
     9              -I../include/gpu \
    10              -I../gpu/include \
    11              -I../include/utils/unix \
    12              -I../samplecode
    13
    14 VPATH = libs:../src/ports:../samplecode:../src/core:../src/utils/unix
    15
    16 #generate debugging info
    17 CFLAGS = -g
    18
    19 SRC_LIST := main.cpp 
    20
    21 test-skia: $(SRC_LIST) ../out/libskia.a -lpthread -lz -lfreetype  -lpng
    22 g++ $(C_INCLUDES) $(CFLAGS) $^ -o $@
    23
    24 clean:
    25 #rm -rf ../out # Copied from ../Makefile
    26 #rm -rf out
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(678) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值