我的《图像专家》终于出炉了, 欢迎大家试用!!!!!!!(0分)

  • 主题发起人 主题发起人 wyb_star
  • 开始时间 开始时间
如果愿意给的话我也要

yobdrow@163.com
 
老兄,你有字体特效的一些算法么?我正在搞这个。可以不是源码,文章或者资料都行。

谢谢
 
我要辕马,谢谢
lazycat521@263.net
 
给我一份
ddn-star@sohu.com
 
怎么有那么多人一看到别人写出了个好东东就想要源码?说实话,就算给了你源码,我估计
你也不会仔细看!
 
同意教父,人家辛辛苦苦做的东西,一下子就把源码给你,好象太不重视人家的劳动了。
如果,你对这方面的知识,想了解的话,跟作者探讨,人家说不定比较乐意!
是吧!

to:教父,上次说的事,你可以试试我的新浪邮箱cbychen@sina.com 谢谢
to:wyb_star,不行啊,下不了,发给我吧
cbychen@263.net
 
guotong@eyou.com
 
down不下来
 
sendtode@21cn.com
谢!
 
同意教父所说,不过我建议要源程序的人向作者附钱!
另外我还建议《大富翁论坛》考虑加建一个收费的《大富翁论坛》版本,方法是提问者向答复者付款,
结算由《大富翁论坛》完成,《大富翁论坛》按10%-20%比划提成,这个有至少有三个好处:
一、提高提问的质量,减少无谓贴。
二、也为积极回复问题专家所做的劳动成果有一些补尝。
三、也为《大富翁论坛》的运作带来一些经济收入。
 
哇,这个问题已经很老了呀!!
想问羽化效果,不知道是否已经实现?
 
关于“图像旋转”,有专家如下说法:
*************************************
如果有人试着通先选择新的中心点再旋转图片这个方法来得到新的图片的话,会发觉图片
上有许多“洞”,这是因为不连续的空间和整数的数学运算造成的。为了解决这个问题,
我们可以使用一个“相反”的方法。仔细考虑新图像中的每个像素,查找它在原图像中的
位置。这样的技术就会解决任何在图像中的“洞”。
*************************************
我个人观点:
通用的算法原理都一样,及选择旋转后的图像的点,通过算法查找气再原图中对应的香素点!
我觉得旋转后的图像有效区域的象素点数和原图片的象素点数一样多,怎么会出现“洞”呢?
我不理解上面这段话的含义,哪位仁兄理解了帮忙解释一下
 
请注意图像最终是在计算机上显示,(比如显示器上),而计算机上显示时由于是离散的,
所以当在旋转时(是通过矩阵)计算出来的点有可能是一个在计算机上不存在的点,(比如
坐标是(20.1,11.8))为了显示出该点,必须在计算机上找到与此点最接近的点。(即旋转
前后在计算机上不是一一映射的),照此下去总有一些点是没有被映射到(即是“空洞”)
这时要进行插值处理。
总之出现空洞的原因是因为计算机上的点是离散的缘故不知说明白了没有?
 
Nizvoo@etang.com
 
找个空间放起来,通过信箱不安全
 
hbezwwl@163.com
 
现在已经无法下载了!
 
这是部分源码献给大家吧!
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include "MyPicture.h"
#include "jpeg.hpp"
#include <math.h>
#define MIN(A,B) (A<B)?A:B
#define MAX(A,B) (A>B)?A:B
#include "mainunit.h"
//---------------------------------------------------------------------------

#pragma package(smart_init)

void S_RevColor(Graphics::TBitmap *Bmp)//图片反色
{
BYTE *ptr;
for (int y = 0; y < Bmp->Height; y++)
{
ptr =(BYTE *) Bmp->ScanLine[y];
for (int x = 0; x < Bmp->Width*3; x+=3){
ptr[x]=BYTE(255-ptr[x]);
ptr[x+1]=BYTE(255-ptr[x+1]);
ptr[x+2]=BYTE(255-ptr[x+2]);
}
}
}


void S_Gray(Graphics::TBitmap *Bmp)//灰阶效果
{
long Gray;
BYTE *ptr;
for (int y = 0; y < Bmp->Height; y++)
{
ptr =(BYTE *) Bmp->ScanLine[y];
for (int x = 0; x < Bmp->Width*3; x+=3){
Gray=299*ptr[x+2]+587*ptr[x+1]
+114*ptr[x];
ptr[x]=BYTE(Gray/1000);
ptr[x+1]=BYTE(Gray/1000);
ptr[x+2]=BYTE(Gray/1000);
}
}
}

void S_ChgLight(Graphics::TBitmap *Bmp,int s)//改变亮度
{
s=s+100;
int XX;
BYTE *ptr;
for (int y = 0; y < Bmp->Height; y++)
{
ptr =(BYTE *) Bmp->ScanLine[y];
for (int x = 0; x < Bmp->Width*3; x+=3){
XX=((ptr[x+2]-128)*s+12800)/100;
XX=MAX(XX,0);XX=MIN(XX,255);ptr[x+2]=XX;
XX=((ptr[x+1]-128)*s+12800)/100;
XX=MAX(XX,0);XX=MIN(XX,255);ptr[x+1]=XX;
XX=((ptr[x]-128)*s+12800)/100;
XX=MAX(XX,0);XX=MIN(XX,255);ptr[x+0]=XX;
}
}
}

void S_ChgContrast(Graphics::TBitmap *Bmp,int b)//改变对比度
{
int XX;
BYTE *ptr;
for (int y = 0; y < Bmp->Height; y++)
{
ptr =(BYTE *) Bmp->ScanLine[y];
for (int x = 0; x < Bmp->Width*3; x+=3){
XX=ptr[x+2]+b;
XX=MAX(XX,0);XX=MIN(XX,255);ptr[x+2]=XX;
XX=ptr[x+1]+b;
XX=MAX(XX,0);XX=MIN(XX,255);ptr[x+1]=XX;
XX=ptr[x]+b;
XX=MAX(XX,0);XX=MIN(XX,255);ptr[x+0]=XX;
}
}
}

void S_Filter(Graphics::TBitmap *Source,Graphics::TBitmap *NewPic,int Div,int xg)//图片效果
{
//0:模糊1:锐化3:雕刻
int flt[9];
switch (xg)
{
case 0:{
flt[0]=5;flt[1]=5;flt[2]=5;
flt[3]=5;flt[4]=60;flt[5]=5;
flt[6]=5;flt[7]=5;flt[8]=5;
} ;
break;
case 1:{
flt[0]=0;flt[1]=-5;flt[2]=0;
flt[3]=-5;flt[4]=30;flt[5]=-5;
flt[6]=0;flt[7]=-5;flt[8]=0;
} ;
break;
default:{
flt[0]=-15;flt[1]=-15;flt[2]=0;
flt[3]=-15;flt[4]=15;flt[5]=15;
flt[6]=0;flt[7]=15;flt[8]=0;
} ;
}

int XX[3];
BYTE *ptr,*ptru,*ptrd,*ptr1;

NewPic->Assign(Source);
for (int y = 1; y < NewPic->Height-1; y++)
{
ptr=(BYTE *)NewPic->ScanLine[y];
ptr1=(BYTE *)Source->ScanLine[y];
ptru=(BYTE *)Source->ScanLine[y-1];
ptrd=(BYTE *)Source->ScanLine[y+1];
for (int x=3;x<(Source->Width-1)*3;x+=3){
XX[0]=0;XX[1]=0;XX[2]=0;
for (int i=-1;i<=1;i++)
for (int j=0;j<3;j++)
XX[j]+=ptr1[x+3*i+j]*flt[4+i];
for (int i=-1;i<=1;i++)
for (int j=0;j<3;j++)
XX[j]+=ptru[x+3*i+j]*flt[1+i];
for (int i=-1;i<=1;i++)
for (int j=0;j<3;j++)
XX[j]+=ptrd[x+3*i+j]*flt[7+i];
for (int i=0;i<3;i++){
XX=XX/Div;
XX=MAX(XX,0);
XX=MIN(XX,255);
ptr[x+i]=XX;
}
}
}
}

void S_ChgColor(Graphics::TBitmap *tmpBitmap,int X,int Y,int Z)//色彩平衡
{
for (int y = 0; y < tmpBitmap->Height; y++)
{
int XX;
BYTE *ptr;

ptr =(BYTE *) tmpBitmap->ScanLine[y];
for (int x = 0; x < tmpBitmap->Width*3; x+=3){
XX=ptr[x+2]+X;
XX=MAX(XX,0);XX=MIN(XX,255);ptr[x+2]=XX;
XX=ptr[x+1]+Y;
XX=MAX(XX,0);XX=MIN(XX,255);ptr[x+1]=XX;
XX=ptr[x]+Z;
XX=MAX(XX,0);XX=MIN(XX,255);ptr[x+0]=XX;
}
}
}

void S_ChgWH(Graphics::TBitmap *Source,Graphics::TBitmap *NewPic,int w,int h)//改变大小
{
NewPic->Width=w;
NewPic->Height=h;
NewPic->Canvas->StretchDraw(TRect(0,0,w,h),Source);
}

void S_PicXZ(Graphics::TBitmap *Source,Graphics::TBitmap *NewPic,int angle)//图片旋转
{
if(angle>180)angle=360-angle;
if(angle<-180)angle=360+angle;

float radians=3.1415/180.00*angle;
float cosine=(float)cos(radians);
float sine=(float)sin(radians);
if (cosine < 0)cosine = -cosine;
if (sine < 0)sine = -sine;


float Point1x=(-Source->Height*sine);
float Point1y=(Source->Height*cosine);
float Point2x=(Source->Width*cosine-Source->Height*sine);
float Point2y=(Source->Height*cosine+Source->Width*sine);
float Point3x=(Source->Width*cosine);
float Point3y=(Source->Width*sine);
float minx=min((float)0,min(Point1x,min(Point2x,Point3x)));
float miny=min((float)0,min(Point1y,min(Point2y,Point3y)));
float maxx=max(Point1x,max(Point2x,Point3x));
float maxy=max(Point1y,max(Point2y,Point3y));
int DestBitmapWidth,DestBitmapHeight;
if(angle>90&amp;&amp;angle<180)
DestBitmapWidth=(int)ceil(-minx);
else
DestBitmapWidth=(int)ceil(maxx-minx);

if(angle>-180&amp;&amp;angle<-90)
DestBitmapHeight=(int)ceil(-miny);
else
DestBitmapHeight=(int)ceil(maxy-miny);

NewPic->Height=DestBitmapHeight;
NewPic->Width=DestBitmapWidth;
for(int x=0;x<DestBitmapWidth;x++)
{
for(int y=0;y<DestBitmapHeight;y++){
int SrcBitmapx=(int)((x+minx)*cosine+(y+miny)*sine);
int SrcBitmapy=(int)((y+miny)*cosine-(x+minx)*sine);
if(SrcBitmapx>=0&amp;&amp;SrcBitmapx<Source->Width&amp;&amp;SrcBitmapy>=0&amp;&amp;
SrcBitmapy<Source->Height)
{
NewPic->Canvas->Pixels[x][y]=
Source->Canvas->Pixels[SrcBitmapx][SrcBitmapy];
}
}
}
}

void S_PicXZ1(Graphics::TBitmap *Source,Graphics::TBitmap *NewPic,int angle)
{
NewPic->Height=Source->Width;
int www=Source->Width;
NewPic->Width=Source->Height;
int g=Source->Height;
int k=Source->Width;
Byte *ptr;
Byte *newscanline;
NewPic->PixelFormat = Source->PixelFormat;
for (int y =0;y<k-1;y++)
{
newscanline =(Byte*)NewPic->ScanLine[y];
for (int x =0;x <g-1;x++){
ptr = (Byte*)Source->ScanLine[x];
int i,j;
i=x*3;
j=y*3;
if(angle==0)
{
newscanline = ptr[www*3-j];
newscanline[i-1] = ptr[www*3-j-1];
newscanline[i-2] = ptr[www*3-j-2];
// newscanline[i-3] = ptr[www*3-j-3];
}
if(angle==1)
{
newscanline[g*3-i] = ptr[j];
newscanline[g*3-i-1] = ptr[j-1];
newscanline[g*3-i-2] = ptr[j-2];
// newscanline[g*3-i-3] = ptr[j-3];
}
}
}
}


void S_SaveToJpg(Graphics::TBitmap *Source,AnsiString filename,int ys)//保存成JPG
{
TJPEGImage *jp = new TJPEGImage();
try
{
jp->Assign(Source);
jp->CompressionQuality=ys;
jp->Compress();
jp->SaveToFile(filename);
}
__finally
{
delete jp;
}
}

void S_Emboss(Graphics::TBitmap *Bmp)//雕刻
{
int x,y;
Byte * p1,*p2;
for(int y=0;y<Bmp->Height-1;y++)
{
p1=(Byte *)Bmp->ScanLine[y];
p2=(Byte *)Bmp->ScanLine[y+1];
for(int x=0;x<Bmp->Width-3;x++)
{
p1[x*3]=(p1[x*3]+(p2[(x+3)*3] ^ 0xFF))>> 1;
p1[x*3+1]=(p1[x*3+1]+(p2[(x+3)*3+1] ^ 0xFF))>>1;
p1[x*3+2]=(p1[x*3+2]+(p2[(x+3)*3+2] ^ 0xFF))>>1;
}
}
}

float ArcTan2(float xt,float yt)
{
float value;
if (xt ==0)
if(yt > 0)
value= 3.1416/2;
else
value= -(3.1416/2);
else{
value= atan(yt/xt);
if (xt < 0)
value=3.1416 + atan(yt/xt);
}
return value;
}

long Round(float value)
{
int a=(int)value;
if(value+0.5>a+1)a=a+1;
return a;
}

void Twist(Graphics::TBitmap *Bmp,Graphics::TBitmap *Dst,int Amount)
{
BYTE *sli,* slo ;
float fxmid, fymid, txmid, tymid ,fx,fy, tx2, ty2, r, theta,dx, dy,OFFSET;
int ifx, ify;
float weight_x[1], weight_y[1];
float weight;
int new_red, new_green, new_blue;
float total_red, total_green ;
float total_blue ;

OFFSET = -(Pi/2);
dx= Bmp->Width - 1;
dy = Bmp->Height - 1;
r = sqrt(dx * dx + dy * dy);
tx2 = r;
ty2 = r;
txmid = (Bmp->Width-1)/2; //Adjust these to move center of rotation
tymid = (Bmp->Height-1)/2; //Adjust these to move ->->->->->->
fxmid = (Bmp->Width-1)/2;
fymid = (Bmp->Height-1)/2;
if(tx2 >= Bmp->Width)tx2 = Bmp->Width-1;
if(ty2 >= Bmp->Height)ty2 = Bmp->Height-1;
for(int ty = 0;ty<Round(ty2);ty++)
{
for(int tx = 0;tx<Round(tx2);tx++)
{
dx = tx - txmid;
dy = ty - tymid;
r = sqrt(dx * dx + dy * dy);
if(r == 0)
{
fx = 0;
fy = 0;
}
else
{
theta = ArcTan2(dx,dy) - r/Amount - OFFSET;
fx = r * cos(theta);
fy = r * sin(theta);
}
fx = fx + fxmid;
fy = fy + fymid;

ify = (int)(fy);
ifx = (int)(fx);
if(fy >= 0)
{
weight_y[1] = fy - ify;
weight_y[0] = 1 - weight_y[1];
}
else
{
weight_y[0] = -(fy - ify);
weight_y[1] = 1 - weight_y[0];
}
if(fx >= 0)
{
weight_x[1] = fx - ifx;
weight_x[0] = 1 - weight_x[1];
}
else
{
weight_x[0] = -(fx - ifx);
weight_x[1] = 1 - weight_x[0];
}

if(ifx < 0)
ifx = Bmp->Width-1-(-ifx % Bmp->Width);
else
if(ifx > Bmp->Width-1)
ifx = ifx % Bmp->Width;
if(ify < 0)
ify = Bmp->Height-1-(-ify%Bmp->Height);
else
if(ify > Bmp->Height-1)
ify = ify % Bmp->Height;

total_red = 0.0;
total_green = 0.0;
total_blue = 0.0;
for(int ix = 0;ix<=1;ix++){
for(int iy = 0;iy<=1;iy++){
if(ify + iy < Bmp->Height)
sli =(BYTE *)Bmp->ScanLine[ify + iy];
else
sli =(BYTE *)Bmp->ScanLine[Bmp->Height - ify - iy];
if(ifx + ix < Bmp->Width){
new_red = sli[(ifx + ix)*3];
new_green = sli[(ifx + ix)*3+1];
new_blue = sli[(ifx + ix)*3+2];
}
else
{
new_red = sli[(Bmp->Width - ifx - ix)*3];
new_green = sli[(Bmp->Width - ifx - ix)*3+1];
new_blue = sli[(Bmp->Width - ifx - ix)*3+2];
}
weight = weight_x[ix] * weight_y[iy];
total_red = total_red + new_red * weight;
total_green = total_green + new_green * weight;
total_blue = total_blue + new_blue * weight;
}
}
slo =(BYTE *)Dst->ScanLine[ty];
slo[tx*3] = BYTE(Round(total_red));
slo[tx*3+1] = BYTE(Round(total_green));
slo[tx*3+2] = BYTE(Round(total_blue));
}
}

}

void ImageFlipV(Graphics::TBitmap *Source,Graphics::TBitmap *NewPic)
{
NewPic->Height=Source->Height;
NewPic->Width=Source->Width;
int g=Source->Height;
int k=Source->Width;
Byte *ptr;
Byte *newscanline;
NewPic->PixelFormat = Source->PixelFormat;
for (int y =1;y<g;y++)
{
newscanline =(Byte*)NewPic->ScanLine[y];
ptr = (Byte*)Source->ScanLine[y];
for (int x = 1;x <k;x++)
{
newscanline[x*3-1] = ptr[k*3-x*3-1];
newscanline[x*3-2] = ptr[k*3-x*3-2];
newscanline[x*3-3]=ptr[k*3-x*3-3];
}
}

}


void ImageFlipH(Graphics::TBitmap *Source,Graphics::TBitmap *NewPic)
{
NewPic->Height=Source->Height;
NewPic->Width=Source->Width;
int g=Source->Height;
int k=Source->Width;
Byte *ptr;
Byte *newscanline;
NewPic->PixelFormat = Source->PixelFormat;
for (int y =1;y<g;y++)
{
newscanline =(Byte*)NewPic->ScanLine[y];
ptr = (Byte*)Source->ScanLine[g-y];
for (int x = 1;x <k;x++)
{
newscanline[x*3-1] = ptr[x*3-1];
newscanline[x*3-2] = ptr[x*3-2];
newscanline[x*3-3] = ptr[x*3-3];
}
}

}

void ImageFlip90(Graphics::TBitmap *Source,Graphics::TBitmap *NewPic,int angle)
{
NewPic->Height=Source->Width;
int www=Source->Width;
NewPic->Width=Source->Height;
int g=Source->Height;
int k=Source->Width;
Byte *ptr;
Byte *newscanline;
NewPic->PixelFormat = Source->PixelFormat;
for (int y =0;y<k;y++)
{
newscanline = (Byte*)NewPic->ScanLine[y];
for (int x = 1;x < g;x++){
ptr = (Byte*)Source->ScanLine[g-x];
int i,j;
i=x*3;
j=y*3;
if(angle==0)
{
// newscanline = ptr[www*3-j];
newscanline[i-1] = ptr[www*3-j-1];
newscanline[i-2] = ptr[www*3-j-2];
newscanline[i-3] = ptr[www*3-j-3];
}
if(angle==1)
{
// newscanline[g*3-i] = ptr[j];
newscanline[g*3-i-1] = ptr[j-1];
newscanline[g*3-i-2] = ptr[j-2];
newscanline[g*3-i-3] = ptr[j-3];
}

}
}
}
//截屏
void copyscreen(Graphics::TBitmap *bmp1,int top,int left,int right,int bottom)
{
bmp1->Width=right-left;
bmp1->Height=bottom-top;
HDC ScreenDC;
ScreenDC=GetDC(0);
BitBlt(bmp1->Canvas->Handle, 0, 0, right-left,bottom-top, ScreenDC,left,top, SRCCOPY);
ReleaseDC(0, ScreenDC);
}

void getwindow(Graphics::TBitmap *bmp1)
{
TRect rect;
HWND AWnd;
AWnd = GetForegroundWindow();
GetWindowRect(AWnd,&amp;rect);
copyscreen(bmp1,rect.Top,rect.Left,rect.Right,rect.Bottom);
}


 
老大,根本下不了。
大富翁该有个文件交流的FTP
 
给我邮一个好吗? 谢谢!
chur@263.net
 
后退
顶部