コード例 #1
0
ファイル: BImage.cpp プロジェクト: Jmos/bbclean-xzero450
//====================
void bevel(bool sunken, int pos, int exception)
{
    if (--pos < 0) return;
    int w = width, h = height;
    int nx = w - 2*pos - 1;
    int ny = h - 2*pos - 1;
    if (nx <= 0 || ny <= 0) return;

    int f1 = DELTA_BEVEL;
    int f2 = DELTA_BEVELCORNER;

    if (sunken) f1 = -f1, f2 = -f2;
    make_delta_table (f1);

    unsigned char *p; int d, e, n;

    p = pixels + (pos + w * pos) * 4;

    d = ny * w * 4; e = 4; n = nx;
    if (exception == BEVEL_EXCEPT_LEFT) darker(p);
    while (--n) {
        p += e;
        if (exception != BEVEL_EXCEPT_BOTTOM) darker(p);
        if (exception != BEVEL_EXCEPT_TOP)    lighter(p+d);
    }

    p += e;
    if (exception == BEVEL_EXCEPT_BOTTOM)
        darker(p);
    else if (exception == BEVEL_EXCEPT_RIGHT)
        darker(p), lighter(p+d);
    else modify(p,-f2);  // bottom-right corner pixel

    d = nx * 4; e = w * 4; n = ny;
    if (exception == BEVEL_EXCEPT_BOTTOM) lighter(p-d);
    while (--n) {
        p += e;
        if (exception != BEVEL_EXCEPT_RIGHT) darker(p);
        if (exception != BEVEL_EXCEPT_LEFT)  lighter(p-d);
    }

    p += e;
    if (exception == BEVEL_EXCEPT_TOP)
        darker(p), lighter(p-d);
    else if (exception == BEVEL_EXCEPT_LEFT)
        lighter(p-d);
    else
        modify(p-d, f2); // top-left corner pixel
}
コード例 #2
0
ファイル: BImage.cpp プロジェクト: BackupTheBerlios/boxcore
//====================
	void bevel(bool sunken, int pos)
	{
		if (--pos < 0) return;
		int w = width, h = height;
		int nx = w - 2*pos - 1;
		int ny = h - 2*pos - 1;
		if (nx <= 0 || ny <= 0) return;

		int f1 = DELTA_BEVEL;
		int f2 = DELTA_BEVELCORNER;

		if (sunken) f1 = -f1, f2 = -f2;
		make_delta_table (f1);

		unsigned char *p;
		int d, e, n;

		p = pixels + (pos + w * pos) * 4;

		d = ny * w * 4;
		e = 4;
		n = nx;
		while (--n)
		{
			p += e;
			darker(p);
			lighter(p+d);
		}
		p += e;
		modify(p,-f2);  // bottom-right corner pixel

		d = nx * 4;
		e = w * 4;
		n = ny;
		while (--n)
		{
			p += e;
			darker(p);
			lighter(p-d);
		}
		p += e;
		modify(p-d, f2); // top-left corner pixel
	}