SPGUI(Simple Powerfull Graphics User Interface)是使用簡單、功能強大的嵌入式圖形開發系統。主要為開發嵌入式LINUX圖形視窗應用提供工具集。她具有美觀友好的圖形控制項,面向對像的編程介面,多平台可移植性等特點SPGUI為設計運行於嵌入式裝置,個人電腦及工作站平台的圖形視窗應用程式,提供一個完整的開發平台。她的核心是為應用程式提供資產庫及編譯連結環境,開發人員使用SPGUI提供的資源及環境,來開發自己的應用程式。SPGUI為應用程式設計者提供的資源套件括:嵌入式圖形引擎,圖形控制項,資料庫引擎,底層驅動封裝,常用資料結構封裝及中文支援等
SPGUI是源碼級高度可移植的,
目前經過本人的努力已經移植到window xp 使用vc 2005開發(可稱作:模擬器),開發出來的程式只需要在嵌入式平台編譯就可運行.
同時也擴充了如下功能.
圖片支援 png ,gif, bmp,jpg
字型檔管理 freetype 向量字型檔 ,fnt字型檔
壓縮 zip
指令碼 xml expat
視窗架構 : ems ui( 下個文章更新 )
提供協助:124736442@qq.com
言歸正傳.
先看
之前
之後
高斯模糊演算法 c源碼.
顏色資訊是565 可修改到 rgb888 argb 以及灰階的處理.
//---------------------------------------------------------------------------------
// 124736442@qq.com
//
//
//圖象的平滑(去雜訊)、銳利化
//
//
//---------------------------------------------------------------------------------
#include <mach/effect.h>
#include <mach/datatype.h>
enum EFFECT_TYPE{
SMOOTH_BOX = 0,
SMOOTH_GAUSS,
SHARPEN_LL
};
//template array
SINT32 Smooth_Box[10]={1,1,1,1,1,1,1,1,1,3};
SINT32 Smooth_Gauss[10]={1,2,1,2,4,2,1,2,1,4};
SINT32 Sharpen_Laplacian[10]={-1,-1,-1,-1,9,-1,-1,-1,-1,1};
SINT32 Bitmap_SmoothDeal(spBitmap_t *p,spRect_t *rect,int type)
{
SINT32 *tEffect = NULL;
UINT8 *stpos;
UINT16 *pbg;
int r,g,b,Index,row,col;
int x;int y;
UINT8 r1,g1,b1;
UINT32 colorref;
UINT32 sumcol;
switch(type)
{
case SMOOTH_BOX:
tEffect = Smooth_Box;
break;
case SMOOTH_GAUSS:
tEffect = Smooth_Gauss;
break;
case SHARPEN_LL:
tEffect = Sharpen_Laplacian;
break;
default:
return SP_FAIL;
}
stpos = (UINT8 *)( p->pData + (rect->x*p->bpl/p->width + rect->y*p->bpl) );
for(y = 1 ; y<rect->height-1;y++)
for( x = 1;x <rect->width-1;x++)
{
r=0,g=0,b=0;
Index=0;
sumcol = 0 ;
for(col=-1;col<=1;col++)
{
pbg = (UINT16*)(stpos+(y+col)*p->bpl);
for(row=-1;row<=1;row++)
{
colorref=pbg[x+row];
RGB_FROM_RGB565(colorref,r1,g1,b1);
r+=r1*tEffect[Index];
g+=g1*tEffect[Index];
b+=b1*tEffect[Index];
Index++;
}
}
r>>=tEffect[Index];//調節亮度.
g>>=tEffect[Index];
b>>=tEffect[Index];
RGB565_FROM_RGB(colorref,r,g,b);
pbg[x] = (UINT16)colorref;
}
return SP_OK;
}
SINT32 effect_do(spBitmap_t *image,spRect_t *rect,SINT32 type)
{
spRect_t tRect;
if(image == NULL)
return SP_FAIL;
if(rect==NULL){
tRect.x = tRect.y = 0 ;
tRect.width = image->width;
tRect.height = image->height;
}
else
tRect = *rect;
//check rect
tRect.x = tRect.x <0 ?0:tRect.x;
tRect.y = tRect.y <0 ?0:tRect.y;
tRect.width = tRect.width >image->width ?image->width:tRect.width;
tRect.height = tRect.height >image->height?image->height:tRect.height;
//do effect
switch(type)
{
case SMOOTH_BOX:
case SMOOTH_GAUSS:
case SHARPEN_LL:
//return SP_OK;
Bitmap_SmoothDeal(image,&tRect,type);
break;
}
return SP_OK;
}