关于janFX的使用(200分)

  • 主题发起人 主题发起人 aq100
  • 开始时间 开始时间
A

aq100

Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位友人,有谁用过janFX.pas,最好能提供一些例子或相关说明。先谢谢大家。
 
没用过呢~
 
晕,你自已试试三,反正JanFx有源码,都是处理一些图像的特效用的
 
看楼上的兄弟一定是用过janFX,还希望能指点一二.里面的一些简单的功能我还是可以搞定的,只是还想深入一点,希望大家能多提意见和想法,多贡献一些使用经验和案例代码.
 
问题: 如何任意旋转图形?100分,在线等待,急!!! ( 积分: 100 )
分类: 图形图象

来自: majiade, 时间: 2004-08-22 23:50:00, ID: 2774004
如何任意旋转图形?

来自: cqbaobao, 时间: 2004-08-23 0:06:11, ID: 2774008
摘自 janFx.pas

procedure SmoothRotate(var Src, Dst: TBitmap; cx, cy: Integer;
Angle: Extended);
type
TFColor = record b, g, r: Byte end;
var
Top,
Bottom,
Left,
Right,
eww, nsw,
fx, fy,
wx, wy: Extended;
cAngle,
sAngle: Double;
xDiff,
yDiff,
ifx, ify,
px, py,
ix, iy,
x, y: Integer;
nw, ne,
sw, se: TFColor;
P1, P2, P3: Pbytearray;
begin
Angle := angle;
Angle := -Angle * Pi / 180;
sAngle := Sin(Angle);
cAngle := Cos(Angle);
xDiff := (Dst.Width - Src.Width) div 2;
yDiff := (Dst.Height - Src.Height) div 2;
for y := 0 to Dst.Height - 1 do
begin
P3 := Dst.scanline[y];
py := 2 * (y - cy) + 1;
for x := 0 to Dst.Width - 1 do
begin
px := 2 * (x - cx) + 1;
fx := (((px * cAngle - py * sAngle) - 1) / 2 + cx) - xDiff;
fy := (((px * sAngle + py * cAngle) - 1) / 2 + cy) - yDiff;
ifx := Round(fx);
ify := Round(fy);

if (ifx > -1) and (ifx < Src.Width) and (ify > -1) and (ify < Src.Height) then
begin
eww := fx - ifx;
nsw := fy - ify;
iy := TrimInt(ify + 1, 0, Src.Height - 1);
ix := TrimInt(ifx + 1, 0, Src.Width - 1);
P1 := Src.scanline[ify];
P2 := Src.scanline[iy];
nw.r := P1[ifx * 3];
nw.g := P1[ifx * 3 + 1];
nw.b := P1[ifx * 3 + 2];
ne.r := P1[ix * 3];
ne.g := P1[ix * 3 + 1];
ne.b := P1[ix * 3 + 2];
sw.r := P2[ifx * 3];
sw.g := P2[ifx * 3 + 1];
sw.b := P2[ifx * 3 + 2];
se.r := P2[ix * 3];
se.g := P2[ix * 3 + 1];
se.b := P2[ix * 3 + 2];

Top := nw.b + eww * (ne.b - nw.b);
Bottom := sw.b + eww * (se.b - sw.b);
P3[x * 3 + 2] := IntToByte(Round(Top + nsw * (Bottom - Top)));

Top := nw.g + eww * (ne.g - nw.g);
Bottom := sw.g + eww * (se.g - sw.g);
P3[x * 3 + 1] := IntToByte(Round(Top + nsw * (Bottom - Top)));

Top := nw.r + eww * (ne.r - nw.r);
Bottom := sw.r + eww * (se.r - sw.r);
P3[x * 3] := IntToByte(Round(Top + nsw * (Bottom - Top)));
end;
end;
end;
end;


来自: cqbaobao, 时间: 2004-08-23 0:20:17, ID: 2774011
补充:
function TrimInt(i, Min, Max: Integer): Integer;
begin
if i > Max then Result := Max
else if i < Min then Result := Min
else Result := i;
end;

function IntToByte(i: Integer): Byte;
begin
if i > 255 then Result := 255
else if i < 0 then Result := 0
else Result := i;
end;

注意:
只适用于 24 位色图

示例:
procedure TForm1.Button1Click(Sender: TObject);
var
bmp, bmpD: TBitmap;
begin
bmp := TBitmap.Create;
bmpD := TBitmap.Create;

bmp.LoadFromFile('C:/000000.bmp');
bmpD.PixelFormat := bmp.PixelFormat;
bmpD.Width := bmp.Width;
bmpD.Height := bmp.Height;
SmoothRotate(bmp, bmpD, 100, 100, 15); // 100, 100 为中心位置
Canvas.Draw(0, 0, bmpD);

bmp.Free;
bmpD.Free;
end;


来自: majiade, 时间: 2004-08-23 0:24:55, ID: 2774013
TrimInt()函数是什么?

来自: majiade, 时间: 2004-08-23 0:38:06, ID: 2774015
非常感谢!!

得分大富翁: cqbaobao
 
请问利用janFX如何对图片进行亮度,对比度,去色,灰度图,锐化,边缘,光滑度等进行操作.
其中的色彩等该怎样处理.分数不够可以另开贴子.
 
procedure Contrast(var clip:tbitmap;Amount: Integer); 对比度
procedure Lightness(var clip:tbitmap;Amount: Integer); 亮度
procedure Saturation(var clip:tbitmap;Amount: Integer);饱和度

JanFx里面的函数名大部份都是说明了用途的
你去下一个金山词霸三,查查
 
楼上的兄第这么清楚,那还请指点一下,类似photoshop中图像设置功能中那些,需要涉及到的janFX函授还有哪些,多谢多谢.

怎样利用janFX达到灰度图和去色功能
 
有谁知道在那里能下载janFX的使用例子,最好成是那种提供源码的案例.
 
顶,janFX里面的TLightBrush怎么应用啊?
 
aq100,请帮忙看一下我的问题,往internet写文件。你好像解决了,我的怎么试都不行。
感激
http://www.delphibbs.com/delphibbs/dispq.asp?lid=3538509
 
to:lanlyli
很久以前的代码,现在已经找不到了,记得当时是从vc6写的代码中翻译过来的.非常遗憾.
你在google上搜索一下,应该能找到,最好搜索英文资料.

图像处理功能全部都解决了,photoshop的滤镜功能也集成在一起,完整的一个图像处理软件,这些功能是一个项目中的一部分,也比较关键,感谢大家的帮助,发分.
 
后退
顶部