broncho Linux手机平台网站上线(http://www.broncho.cn)

bronchoLinux手机平台是一款基于Linux 2.6内核,采用GTK+/DirectFB作为GUI的移动操作系统。它具备经典架构设计,易于国际化,并且具有高度可扩展性和标准化的特点。平台实现了强大的功能,包括浏览器、即时通信、多媒体处理等。

broncho Linux手机平台网站上线(http://www.broncho.cn

转载时请注明出处和作者联系方式
作者联系方式:李先静 <xianjimli at hotmail dot com>

broncho Linux手机平台是构建在linux 2.6 之上,采用GTK+/DirectFB作为GUI的手机平台。经过两年多时间的努力,已经实现基本功能,进入产品化阶段,目前正进行硬件联调,整合第三方 软件等工作。broncho Linux手机平台主要特性如下:

 

经典的架构设计

1. C/S模型
2.MVC模型
3.插件式设计
4.Reactor模式

    易于国际化

    1.采用SCIM作为输入法,能支持多国语言输入
    2.采用Pango完成文字排版,能支持各种文字的排版方式
    3.采用freetype实现字体渲染,能支持各种语言的不同字体
    4.采用UTF-8作为内部编码,能表示各种主流语言中的文字
    5.采用gettext方法,界面国际化只要加入相应的PO文件即可,不用重新编译

      可扩展性

      1.运行修改配置文件,即可创建不同风格的主题
      2.用户界面用XML描述,改变应用程序的外观布局仅需修改XML文件
      3.提供定义良好的插件接口,方便第三方软件以插件形式扩展现有功能
      4.公开全部后台服务提供的接口,方便第三方软件开发具有个性化的功能
      5.高度模块化的设计,对现在功能进行适当组合,即可以建立完整的产品线

        标准化

        1.桌面遵循freedesktop.org相关标准
        2.与GSM模组采用标准AT命令和多路协议通信,不依赖特定的GSM模组
        3.与kernel交互采用ALSA/V4L/FB等标准接口,方便移植到不同CPU的BSP上

          紧跟主流技术

          1. 采用GTK+作为GUI
          2.采用SQLite实现数据储存
          3.采用DBUS作为进程间通信机制
          4.采用GConf实现配置数据的管理
          5.采用GStreamer实现多媒体的播放和处理

            功能强大

            1. 强大的搜索功能,方便用户查找手机中数据
            2.以firefox作为浏览器引擎,实现功能强大的浏览器
            3.以GStreamer实现多媒体的播放和处理,支持主流多媒体格式
            4.以pidgin作为即时通信功能,支持MSN、QQ、GTalk、ICQ等主流IM工具
            5.引入磁盘加密,文件/文件夹加密,应用程序密码保护,多机制保护用户数据
            6.实现名片、电话、日程、SMS、MMS、EMAIL、计算器、词典等基本应用程序
            7.实现防盗和远程控制诸多特色应用程序
            8.和第三方联合开发Office阅读器,JAVA虚拟机,TTS、语音输入、手写输入和一些休闲类游戏

              欢迎大家到http://www.broncho.cn上交流,网站还在建设之中,近期我们会陆续把整理好的文档和代码更新到上去。

               

              /* * File: gsnap.c * Author: Li XianJing <xianjimli@hotmail.com> * Brief: snap the linux mobile device screen. * * Copyright (c) 2009 Li XianJing <xianjimli@hotmail.com> * * Licensed under the Academic Free License version 2.1 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * History: * ================================================================ * 2009-08-20 Li XianJing <xianjimli@hotmail.com> created * 2011-02-28 Li XianJing <xianjimli@hotmail.com> suppport RGB888 framebuffer. * 2011-04-09 Li XianJing <xianjimli@hotmail.com> merge figofuture's png output. * ref: http://blog.chinaunix.net/space.php?uid=15059847&do=blog&cuid=2040565 * */ #include <png.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <jpeglib.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <linux/fb.h> #include <linux/kd.h> struct _FBInfo; typedef struct _FBInfo FBInfo; typedef int (*UnpackPixel)(FBInfo* fb, unsigned char* pixel, unsigned char* r, unsigned char* g, unsigned char* b); struct _FBInfo { int fd; UnpackPixel unpack; unsigned char *bits; struct fb_fix_screeninfo fi; struct fb_var_screeninfo vi; }; #define fb_width(fb) ((fb)->vi.xres) #define fb_height(fb) ((fb)->vi.yres) #define fb_bpp(fb) ((fb)->vi.bits_per_pixel>>3) #define fb_size(fb) ((fb)->vi.xres * (fb)->vi.yres * fb_bpp(fb)) static int fb_unpack_rgb565(FBInfo* fb, unsigned char* pixel, unsigned char* r, unsigned char* g, unsigned char* b) { unsigned short color = *(unsigned short*)pixel; *r = ((color >> 11) & 0xff) << 3; *g = ((color >> 5) & 0xff) << 2; *b = (color & 0xff )<< 3; return 0; } static int fb_unpack_rgb24(FBInfo* fb, unsigned char* pixel, unsigned char* r, unsigned char* g, unsigned char* b) { *r = pixel[fb->vi.red.offset>>3]; *g = pixel[fb->vi.green.offset>>3]; *b = pixel[fb->vi.blue.offset>>3]; return 0; } static int fb_unpack_argb32(FBInfo* fb, unsigned char* pixel, unsigned char* r, unsigned char* g, unsigned char* b) { *r = pixel[fb->vi.red.offset>>3]; *g = pixel[fb->vi.green.offset>>3]; *b = pixel[fb->vi.blue.offset>>3]; return 0; } static int fb_unpack_none(FBInfo* fb, unsigned char* pixel, unsigned char* r, unsigned char* g, unsigned char* b) { *r = *g = *b = 0; return 0; } static void set_pixel_unpacker(FBInfo* fb) { if(fb_bpp(fb) == 2) { fb->unpack = fb_unpack_rgb565; } else if(fb_bpp(fb) == 3) { fb->unpack = fb_unpack_rgb24; } else if(fb_bpp(fb) == 4) { fb->unpack = fb_unpack_argb32; } else { fb->unpack = fb_unpack_none; printf("%s: not supported format.\n", __func__); } return; } static int fb_open(FBInfo* fb, const char* fbfilename) { fb->fd = open(fbfilename, O_RDWR); if (fb->fd < 0) { fprintf(stderr, "can't open %s\n", fbfilename); return -1; } if (ioctl(fb->fd, FBIOGET_FSCREENINFO, &fb->fi) < 0) goto fail; if (ioctl(fb->fd, FBIOGET_VSCREENINFO, &fb->vi) < 0) goto fail; fb->bits = mmap(0, fb_size(fb), PROT_READ | PROT_WRITE, MAP_SHARED, fb->fd, 0); if (fb->bits == MAP_FAILED) goto fail; printf("---------------framebuffer---------------\n"); printf("%s: \n width : %8d\n height: %8d\n bpp : %8d\n r(%2d, %2d)\n g(%2d, %2d)\n b(%2d, %2d)\n", fbfilename, fb_width(fb), fb_height(fb), fb_bpp(fb), fb->vi.red.offset, fb->vi.red.length, fb->vi.green.offset, fb->vi.green.length, fb->vi.blue.offset, fb->vi.blue.length); printf("-----------------------------------------\n"); set_pixel_unpacker(fb); return 0; fail: printf("%s is not a framebuffer.\n", fbfilename); close(fb->fd); return -1; } static void fb_close(FBInfo* fb) { munmap(fb->bits, fb_size(fb)); close(fb->fd); return; } static int snap2jpg(const char * filename, int quality, FBInfo* fb) { int row_stride = 0; FILE * outfile = NULL; JSAMPROW row_pointer[1] = {0}; struct jpeg_error_mgr jerr; struct jpeg_compress_struct cinfo; memset(&jerr, 0x00, sizeof(jerr)); memset(&cinfo, 0x00, sizeof(cinfo)); cinfo.err = jpeg_std_error(&jerr); jpeg_create_compress(&cinfo); if ((outfile = fopen(filename, "wb+")) == NULL) { fprintf(stderr, "can't open %s\n", filename); return -1; } jpeg_stdio_dest(&cinfo, outfile); cinfo.image_width = fb_width(fb); cinfo.image_height = fb_height(fb); cinfo.input_components = 3; cinfo.in_color_space = JCS_RGB; jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo, quality, TRUE); jpeg_start_compress(&cinfo, TRUE); row_stride = fb_width(fb) * 2; JSAMPLE* image_buffer = malloc(3 * fb_width(fb)); while (cinfo.next_scanline < cinfo.image_height) { int i = 0; int offset = 0; unsigned char* line = fb->bits + cinfo.next_scanline * fb_width(fb) * fb_bpp(fb); for(i = 0; i < fb_width(fb); i++, offset += 3, line += fb_bpp(fb)) { fb->unpack(fb, line, image_buffer+offset, image_buffer + offset + 1, image_buffer + offset + 2); } row_pointer[0] = image_buffer; (void) jpeg_write_scanlines(&cinfo, row_pointer, 1); } jpeg_finish_compress(&cinfo); fclose(outfile); jpeg_destroy_compress(&cinfo); return 0; } //Ref: http://blog.chinaunix.net/space.php?uid=15059847&do=blog&cuid=2040565 static int snap2png(const char * filename, int quality, FBInfo* fb) { FILE *outfile; if ((outfile = fopen(filename, "wb+")) == NULL) { fprintf(stderr, "can't open %s\n", filename); return -1; } /* prepare the standard PNG structures */ png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,0,0,0); png_infop info_ptr = png_create_info_struct(png_ptr); /* setjmp() must be called in every function that calls a PNG-reading libpng function */ if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, &info_ptr); fclose(outfile); return -1; } /* initialize the png structure */ png_init_io(png_ptr, outfile); // int width = 0; int height = 0; int bit_depth = 8; int color_type = PNG_COLOR_TYPE_RGB; int interlace = 0; width = fb_width(fb); height = fb_height(fb); png_set_IHDR (png_ptr, info_ptr, width, height, bit_depth, color_type, (!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); /* write the file header information */ png_write_info(png_ptr, info_ptr); png_bytep row_pointers[height]; png_byte* image_buffer = malloc(3 * width); int i = 0; int j = 0; unsigned char* line = NULL; for( ; i < height; i++ ) { line = (char*)fb->bits + i * width * fb_bpp(fb); for(j = 0; j < width; j++, line += fb_bpp(fb)) { int offset = j * 3; fb->unpack(fb, line, image_buffer+offset, image_buffer+offset+1, image_buffer+offset+2); } row_pointers[i] = image_buffer; png_write_rows(png_ptr, &row_pointers[i], 1); } png_destroy_write_struct(&png_ptr, &info_ptr); fclose(outfile); return 0; } int main(int argc, char* argv[]) { FBInfo fb; const char* filename = NULL; const char* fbfilename = NULL; if(argc != 3) { printf("\nUsage: %s [jpeg|png file] [framebuffer dev]\n", argv[0]); printf("Example: %s fb.jpg /dev/fb0\n", argv[0]); printf("-----------------------------------------\n"); printf("Powered by broncho(www.broncho.cn)\n\n"); return 0; } filename = argv[1]; fbfilename = argv[2]; memset(&fb, 0x00, sizeof(fb)); if (fb_open(&fb, fbfilename) == 0) { if(strstr(filename, ".png") != NULL) { snap2png(filename, 100, &fb); } else { snap2jpg(filename, 100, &fb); } fb_close(&fb); } return 0; } 以上代码使用/dev/fb0实现截图功能,请重构,使用/dev/dri/card0实现截图功能。
              最新发布
              11-25
              评论 5
              成就一亿技术人!
              拼手气红包6.0元
              还能输入1000个字符
               
              红包 添加红包
              表情包 插入表情
               条评论被折叠 查看
              添加红包

              请填写红包祝福语或标题

              红包个数最小为10个

              红包金额最低5元

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

              抵扣说明:

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

              余额充值