易截截图软件、单文件、免安装、纯绿色、仅160KB

在linux下使用gtk的gdk

aishen944-163.com
转贴请注明出处,谢谢!!
其实透明贴图的原理就是进行xor运算,
基本公式:A  xor A = 0    A xor 0 = A   A xor A xor B  = B
假如现在有两张图片,一张是我们要对其进行贴图的图片A, 另外一张是要被贴图的图片B
1, 复制图片B的一份拷贝为C
2, 将C中指定的背景色变为全白(0xffffff),其他颜色变为全黑(0x00)
3,     依次执行如下运算:
        A  xor B
        A  and C
        A  xor B
        对于C中的白色执行运算后的结果如下:
        ((A xor B) and 0xfffffff) xor B =  A xor B xor B =  A
        对于C中的黑色执行运算后的结果如下:
        ((A xor B) and 0x0000) xor B =  0 xor B = B
以下是代码实例,例子中用到的两张图片在这里:
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
static GdkPixbuf *bkpixbuf;
static GdkPixbuf *footballpixbuf;
static gboolean
on_expose_event (GtkWidget * widget,
GdkEventExpose * event, gpointer data)
{
cairo_t *cr;
cr = gdk_cairo_create (widget->window);
gdk_cairo_set_source_pixbuf(cr, bkpixbuf, 0, 0);
cairo_paint(cr);

cairo_destroy (cr);
return FALSE;
}
gboolean blttransparent(GdkPixbuf *dest, const GdkPixbuf *src, gint destx, gint desty, guint transcolor) {
GdkPixbuf *maskpixbuf = NULL; /* 蒙板 */
guchar *p = NULL, *dp = NULL, *sp = NULL;
gint x = 0, y = 0, i = 0;
/* 检查目的区域 */
if(destx + gdk_pixbuf_get_width(src) >= gdk_pixbuf_get_width(dest) ||
desty + gdk_pixbuf_get_height(src) >= gdk_pixbuf_get_height(dest)) { /* 超出目的大小, 什么也不做 */
return TRUE;
}
/* 检查颜色采样数 */
if(gdk_pixbuf_get_bits_per_sample(dest) != 8 ||
gdk_pixbuf_get_bits_per_sample(src) != 8) { // 只


相关文档:

linux pppoe

手头有个ep9315的板,今天突然想起跑一下adsl上网。晚上回来就开始搞。
从10点到现在,终于能够跑起来。
给大家借鉴一下。
1.编译内核,把ppp的那些选项选上。 (我用2.6.8.1的kernel,cirrus 的patch)
2.libpcap-0.9.1 这个包是pppd需要的。
./configure CC=arm-linux-gcc CFLAGS=-msoft-float --target=arm-linu ......

Linux core文件设置

在一个程序崩溃时,默认情况下是不产生core文件。
下面的命令可以检查生成core文件的选项是否打开:
$ulimit -a该命令将显示所有的用户定制,其中选项-a代表“all”。
$ulimit -c unlimited来让特定的用户可以产生core文件
core文件仅仅是一个内存映象(同时加上调试信息),主要是用来调试的。如果您根本就不想 ......

Linux执行以及虚拟内存之用

Linux Execution and Virtual Memory Utilization 
Linux执行以及虚拟内存之用
When Linux boots, it starts with the MMU disabled, so initially it deals only with physical 
memory. The kernel image is copied to physical address 0x8000 in DRAM and executed. First a master page table is created ......

Linux下用Busy Box制作Ramdisk全过程

  -------------------------------------------------------------------------------------------------------
//By:yuyongbao
//QQ:673360056
Linux下用Busy Box制作Ramdisk全过程
1 建立根文件系统结构
#mkdir rootfs
#cd rootfs
#mkdir bin dev etc lib proc sbin tmp usr var
#chmod 1777 tmp
#mk ......

Linux定时器 详解[转]


[转]Linux定时器

核主要需要两种类型的时间:


1.

在内核运行期间持续记录当前的时间与日期,以便内核对某些对象和事件作时间标记(

timestamp

,也称为



时间戳



),或供用



户通过时间

syscall ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号