请问谁有TJpegImage的源代码(100分)

  • 主题发起人 主题发起人 kofxdm
  • 开始时间 开始时间
K

kofxdm

Unregistered / Unconfirmed
GUEST, unregistred user!
小弟急需TJpegImage的源代码,delphi里好象没有。不知道那位大虾有?
 
SOS,SOS,SOS,没有人知道吗?[?][?][?][?][?][?][?]
 
控件就没有了,试试下面的函数吧!
// 存储 JPG 图片到数据库 , 同时显示在 FOOTIMAGE 控件上 FootImage:TImage
var
tempStream:TMemoryStream;
JpgPic:TJpegImage;

S:String;
begin
try
JpgPic:=TJpegImage.Create;
tempStream:=TMemoryStream.Create;
tempStream.Clear;
Table.Edit;
JpgPic.LoadFromFile(OpenDialog.FileName);
FootImage.Picture.bitmap.assign(JpgPic);
JpgPic.SaveToStream(tempStream);
TBlobField(Table.FieldByName('图象')).LoadFromStream(tempStream) ;
Table.Post;
finally
JpgPic.Free;
tempStream.Free;
end;
end;

// 显示数据库中的 JPG 图象 ,FootImage : TImage
var
MyJpeg:TJpegImage;
MyStm:TMemoryStream;
begin

if not Table.FieldByName('图象').IsNull then
begin
try
MyJpeg:=TJpegImage.Create;
MyStm:=TMemoryStream.Create;
MyStm.Clear;
TBlobField(Table.FieldByName('图象')).SaveToStream(MyStm);
MyStm.Position:=0;
MyJpeg.LoadFromStream(MyStm);
FootImage.Picture.BitMap.Assign(MyJpeg);
finally
MyJpeg.Free;
MyStm.Free;
end;

end;
 
对于TJpegImage的操作我是清楚的。因为有特殊的需要,现在想要的是TJpegImage的源码。

help me~~~~~~~~~~~~~~~~~~~~~~~~~~
 
拿钱来!!!!!!!


unit TJpgImg;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, jpeg;

type

TFEJpeg = class;
TJPEGChangeEvent= procedure (Val : Byte) of object;

TJPEGProperties = Class(TPersistent)
private
FGrayScale : Boolean;
FPixelFormat : TJPEGPixelFormat;
FProgressiveDisplay : Boolean;
FPerformance : TJPEGPerformance;
FScale : TJPEGScale;
FSmoothing : Boolean;
FOnChange: TJPEGChangeEvent;
protected
procedure SetGrayScale(Value : Boolean);
procedure SetPixelFormat(Value : TJPEGPixelFormat);
procedure SetProgressiveDisplay(Value : Boolean);
procedure SetPerformance(Value : TJPEGPerformance );
procedure SetScale(Value : TJPEGScale);
procedure SetSmoothing(Value : Boolean);
public
constructor Create;
procedure Change(Val : Byte);
published
property GrayScale : Boolean REad FGrayScale write SetGrayScale;
property PixelFormat : TJPEGPixelFormat read FPixelFormat write SetPixelFormat;
property ProgressiveDisplay : Boolean read FProgressiveDisplay write SetProgressiveDisplay;
property Performance : TJPEGPerformance read FPerformance write SetPerformance;
property Scale : TJPEGScale read FScale write SetScale;
property Smoothing : Boolean Read FSmoothing write SetSmoothing;
property OnChange : TJPEGChangeEvent read FOnChange write FOnChange;
end;

TFEJpeg = class(TImage)
private
FExit : Boolean;
FDrawing : boolean;
FJPEGProperties : TJpegProperties;
FOldChanged : TNotifyEvent;

FOnMouseIn:TNotifyEvent;
FOnMouseOut:TNotifyEvent;

procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;

procedure PictureChanged(Sender : TObject);
procedure UpdateJPEG(Flag : Byte);
public
procedure Paint;override;
constructor create(AOwner : TComponent);override;
destructor Destroy;override;
procedure UpdateImage;
published
property JPEGProperties : TJPEGProperties read FJPEGProperties write FJPEGProperties;
property OnMouseIn: TNotifyEvent read FOnMouseIn write FOnMouseIn;
property OnMouseOut: TNotifyEvent read FOnMouseOut write FOnMouseOut;

end;

procedure Register;

implementation

constructor TJPEGProperties.Create;
begin
inherited Create;
FGrayScale := false;
FPixelFormat := jf24Bit;
FProgressiveDisplay := false;
FPerformance := jpBestQuality;
FScale := jsFullSize;
FSmoothing := true;
end;

procedure TJPEGProperties.Change(Val : Byte);
begin
if Assigned(OnChange) then OnChange(val);
end;

procedure TJPEGProperties.SetGrayScale(Value : Boolean);
begin
if Value <> FGrayScale then
begin
FGrayScale := Value;
Change(1);
end;
end;
procedure TJPEGProperties.SetPixelFormat(Value : TJPEGPixelFormat);
begin
if Value <> FPixelFormat then
begin
FPixelFormat := Value;
Change(2);
end;
end;
procedure TJPEGProperties.SetProgressiveDisplay(Value : Boolean);
begin
if Value <> FProgressiveDisplay then
begin
FProgressiveDisplay := Value;
Change(3);
end;
end;
procedure TJPEGProperties.SetPerformance(Value : TJPEGPerformance );
begin
if Value <> FPerformance then
begin
FPerformance := Value;
Change(4);
end;
end;
procedure TJPEGProperties.SetScale(Value : TJPEGScale);
begin
if Value <> FScale then
begin
FScale := Value;
Change(5);
end;
end;
procedure TJPEGProperties.SetSmoothing(Value : Boolean);
begin
if Value <> FSmoothing then
begin
FSmoothing := Value;
Change(6);
end;
end;


// TJpeg

procedure TFEJpeg.CMMouseEnter(var Message: TMessage);
begin
inherited;
if Assigned(FOnMouseIn) then FOnMouseIn(Self);
end;


procedure TFEJpeg.CMMouseLeave(var Message: TMessage);
begin
inherited;
if Assigned(FOnMouseIn) then FOnMouseOut(Self);
end;

procedure TFEJpeg.Paint;
begin
FDrawing := true;
inherited Paint;
FDrawing := false;
end;
constructor TFEJpeg.create(AOwner : TComponent);
begin
inherited create(AOwner);
FJPEGProperties := TJPEGProperties.Create;
FJPEGProperties.OnChange := UpdateJPEG;
FExit := false;
FDrawing := false;
FOldChanged := Picture.OnChange;
Picture.OnChange := PictureChanged;
end;
destructor TFEJpeg.Destroy;
begin
Picture.OnChange := nil;
FOldChanged := nil;
FJPEGProperties.Free;
inherited Destroy;
end;
procedure TFEJpeg.PictureChanged(Sender : TObject);
begin
if FExit then EXIT;
if Picture.Graphic is TJPEGImage then with TJPEGImage(Picture.Graphic) do
begin
FEXit := true;
PixelFormat := FJPEGProperties.PixelFormat;
Scale := FJPEGProperties.Scale;
Grayscale := FJPEGProperties.GrayScale;
Performance := FJPEGProperties.Performance;
ProgressiveDisplay := FJPEGProperties.ProgressiveDisplay;
Smoothing := FJPEGProperties.Smoothing;
FEXit := false;
end;
if Assigned(FOldChanged) then FOldChanged(Sender);
end;

procedure TFEJpeg.UpdateJPEG(Flag : Byte);
begin
if Picture.Graphic is TJPEGImage then with TJPEGImage(Picture.Graphic) do
begin
case Flag of
1 : Grayscale := FJPEGProperties.GrayScale;
2 : PixelFormat := FJPEGProperties.PixelFormat;
3 : ProgressiveDisplay := FJPEGProperties.ProgressiveDisplay;
4 : Performance := FJPEGProperties.Performance;
5 : Scale := FJPEGProperties.Scale;
6 : Smoothing := FJPEGProperties.Smoothing;
end;
if Flag <> 3 then if Assigned(FOldChanged) then FOldChanged(Picture);
end;
end;

procedure TFEJpeg.UpdateImage;
begin
if Picture.Graphic is TJPEGImage then with TJPEGImage(Picture.Graphic) do
begin
Grayscale := FJPEGProperties.GrayScale;
PixelFormat := FJPEGProperties.PixelFormat;
ProgressiveDisplay := FJPEGProperties.ProgressiveDisplay;
Performance := FJPEGProperties.Performance;
Scale := FJPEGProperties.Scale;
Smoothing := FJPEGProperties.Smoothing;
end;
end;

procedure Register;
begin
RegisterComponents('JpgImg', [TFEJpeg]);
end;

end.
 
分先给了,源码我慢慢看。呵呵,真不盖的。。。
 
后退
顶部