显示.tif文件的控件?
我做个东东,需要将SQL中的东西显示出来,其中有一列为image类型,保存的大多是.tif文件,我想用DBGrid将记录中别的列显示,双击就显示tif文件。请告诉我,应该使用那个控件把它显示出来。 问题点数:20、回复次数:20Top
1 楼dancemaple(枫之舞)回复于 2002-04-16 12:45:50 得分 0
Project|Import Type Library,选“Kodak 图像控制”Top
2 楼ln0206(似是故人来)回复于 2002-04-17 09:57:39 得分 0
dancemaple(枫之舞) ,你能详细地说说吗?我执行了你说的"Project|Import Type Library,选“Kodak 图像控制”"操作,但他好像没有出现新的控件(不像VB,一引用了新的库,控件立马就出现在工具栏上),这个挺急的,请答复。谢谢!!!Top
3 楼linzi(林子)回复于 2002-04-17 10:07:12 得分 0
应该出现在ActiveX页面上了Top
4 楼ln0206(似是故人来)回复于 2002-04-17 10:53:44 得分 0
ActiveX页面上出现了imgAdmin控件,显然它不是显示.tif文件的控件,我应该怎样做?请大虾指点!!!Top
5 楼dancemaple(枫之舞)回复于 2002-04-17 12:38:27 得分 0
你试试导入别的Kodak的ActiveX控件,我也不知具体是哪个Top
6 楼iBear(大熊 不要怀疑我的温柔)回复于 2002-04-17 12:39:29 得分 0
你导入kodak的图象管理后,应该生成几个控件的,有一个是iamgeview,就可以显示图象了Top
7 楼ln0206(似是故人来)回复于 2002-04-17 14:39:55 得分 0
我将所有Kodak打头的都导入了,ActiveX页上自始至终只出现了imgAdmin控件,大侠,为什么?救我!!!Top
8 楼BossHawk(BossHawk)回复于 2002-04-17 14:53:47 得分 0
多来一点分数,俺给你一个完美解决办法:)Top
9 楼ln0206(似是故人来)回复于 2002-04-17 16:15:24 得分 0
你想要多少分?你该不会发个自己做的控件给我吧?我要的是最简单最有效的方法!Top
10 楼doctor5(大夫)回复于 2002-04-17 16:26:59 得分 0
显示图象用ImgEdit就可以了Top
11 楼doctor5(大夫)回复于 2002-04-17 16:30:25 得分 0
只要是WIN98都有的,Kodak Image Edit Control (Version2.4)
包含TImgEdit,TImgAnnTool.
倒入后,TAB Active页会有的,
Top
12 楼ln0206(似是故人来)回复于 2002-04-18 09:36:37 得分 0
doctor5(大夫),我的Delphi导入的Kodak Image Edit Control 怎么是1.0的?补丁在哪下?谢谢!!!!Top
13 楼ln0206(似是故人来)回复于 2002-04-18 13:21:18 得分 0
大侠们,帮帮忙呀!Top
14 楼BossHawk(BossHawk)回复于 2002-04-21 19:12:42 得分 20
靠,油箱都不给出来,俺明天不上班,你又急着要!只好铁上来了,两个单元哦,别存到一起去了,文件名也别搞错了
单元一(GraphicCompression.pas)
unit GraphicCompression;
// Support unit for GraphicEx.pas
// GraphicCompression contains routines to compress and decompress data using various compression
// methods. Currently supported methods are:
// - LZW (Lempel-Ziff-Welch)
// + TIF
// + GIF
// - RLE (run length encoding)
// + TGA,
// + PCX,
// + TIFF packed bits
// + SGI
// + CUT
// + RLA
interface
uses
Classes, SysUtils;
const // LZW encoding and decoding support
NoLZWCode = 4096;
type
PByte = ^Byte;
TByteStream = array[0..MaxInt - 1] of Byte;
PByteStream = ^TByteStream;
// abstract decoder class to define the base functionality of an encoder/decoder
TDecoder = class
public
procedure Decode(var Source: Pointer; Dest: Pointer; PackedSize, UnpackedSize: Integer); virtual; abstract;
procedure Encode(Source, Dest: Pointer; var FByteCounts: Cardinal); virtual; abstract;
end;
// Lempel-Ziff-Welch encoder/decoder class
// TIFF LZW compression / decompression is a bit different to the common LZW code
TTIFFLZW = class(TDecoder)
private
FCodeSize: Cardinal;
FCodeMask: Cardinal;
FFreeCode: Cardinal;
FOldCode: Cardinal;
FPrefix: array[0..4095] of Cardinal; // LZW prefix
FSuffix, // LZW suffix
FStack: array [0..4095] of Byte; // stack
FStackPointer: PByte;
FTarget: PByte;
FFirstChar: Byte; // buffer for decoded byte
FClearCode,
FEOICode: Word;
function DecodeLZW(Code: Cardinal): Boolean;
public
procedure Decode(var Source: Pointer; Dest: Pointer; PackedSize, UnpackedSize: Integer); override;
procedure Encode(Source, Dest: Pointer; var FByteCounts: Cardinal); override;
end;
TPackbitsRLE = class(TDecoder)
public
procedure Decode(var Source: Pointer; Dest: Pointer; PackedSize, UnpackedSize: Integer); override;
procedure Encode(Source, Dest: Pointer; var FByteCounts: Cardinal); override;
end;
TPCXRLE = class(TDecoder)
public
procedure Decode(var Source: Pointer; Dest: Pointer; PackedSize, UnpackedSize: Integer); override;
procedure Encode(Source, Dest: Pointer; var FByteCounts: Cardinal); override;
end;
TSGIRLE = class(TDecoder)
public
SampleSize: Byte; // this value can be 1 (for 8 bits) or 2 (for 16 bits) and needs to be set before Decode is called
procedure Decode(var Source: Pointer; Dest: Pointer; PackedSize, UnpackedSize: Integer); override;
procedure Encode(Source, Dest: Pointer; var FByteCounts: Cardinal); override;
end;
TCUTRLE = class(TDecoder)
public
procedure Decode(var Source: Pointer; Dest: Pointer; PackedSize, UnpackedSize: Integer); override;
procedure Encode(Source, Dest: Pointer; var FByteCounts: Cardinal); override;
end;
// Note: We need a different LZW decoder class for GIF because the bit order is reversed compared to that
// of TIFF and the code size increment is handled slightly different.
TGIFLZW = class(TDecoder)
private
FCodeSize: Cardinal;
FCodeMask: Cardinal;
FFreeCode: Cardinal;
FOldCode: Cardinal;
FPrefix: array[0..4095] of Cardinal; // LZW prefix
FSuffix, // LZW suffix
FStack: array [0..4095] of Byte; // stack
FStackPointer: PByte;
FTarget: PByte;
FFirstChar: Byte; // buffer for decoded byte
FClearCode,
FEOICode: Word;
function DecodeLZW(Code: Cardinal): Boolean;
public
InitialCodeSize: Byte; // must be set before decoding is started!
procedure Decode(var Source: Pointer; Dest: Pointer; PackedSize, UnpackedSize: Integer); override;
procedure Encode(Source, Dest: Pointer; var FByteCounts: Cardinal); override;
end;
TRLADecoder = class(TDecoder)
public
procedure Decode(var Source: Pointer; Dest: Pointer; PackedSize, UnpackedSize: Integer); override;
procedure Encode(Source, Dest: Pointer; var FByteCounts: Cardinal); override;
end;
function DecodeRLE(const Source, Target: Pointer; Count, ColorDepth: Cardinal): Integer;
function EncodeRLE(const Source, Target: Pointer; Count, BPP: Integer): Integer;
//----------------------------------------------------------------------------------------------------------------------Top
15 楼BossHawk(BossHawk)回复于 2002-04-21 19:13:21 得分 0
implementation
//----------------- support routines -----------------------------------------------------------------------------------
function DecodeRLE(const Source, Target: Pointer; Count, ColorDepth: Cardinal): Integer;
// Decodes RLE compressed data from Source into Target. Count determines size of target buffer and ColorDepth
// the size of one data entry.
// Result is the amount of bytes decoded.
type
PCardinalArray = ^TCardinalArray;
TCardinalArray = array[0..MaxInt div 4 - 1] of Cardinal;
var
I: Integer;
SourcePtr,
TargetPtr: PByte;
RunLength: Cardinal;
Counter: Cardinal;
SourceCardinal: Cardinal;
begin
Result := 0;
Counter := 0;
TargetPtr := Target;
SourcePtr := Source;
// unrolled decoder loop to speed up process
case ColorDepth of
8:
while Counter < Count do
begin
RunLength := 1 + (SourcePtr^ and $7F);
if SourcePtr^ > $7F then
begin
Inc(SourcePtr);
FillChar(TargetPtr^, RunLength, SourcePtr^);
Inc(TargetPtr, RunLength);
Inc(SourcePtr);
Inc(Result, 2);
end
else
begin
Inc(SourcePtr);
Move(SourcePtr^, TargetPtr^, RunLength);
Inc(SourcePtr, RunLength);
Inc(TargetPtr, RunLength);
Inc(Result, RunLength + 1)
end;
Inc(Counter, RunLength);
end;
15,
16:
while Counter < Count do
begin
RunLength := 1 + (SourcePtr^ and $7F);
if SourcePtr^ > $7F then
begin
Inc(SourcePtr);
for I := 0 to RunLength - 1 do
begin
TargetPtr^ := SourcePtr^;
Inc(SourcePtr);
Inc(TargetPtr);
TargetPtr^ := SourcePtr^;
Dec(SourcePtr);
Inc(TargetPtr);
end;
Inc(SourcePtr, 2);
Inc(Result, 3);
end
else
begin
Inc(SourcePtr);
Move(SourcePtr^, TargetPtr^, 2 * RunLength);
Inc(SourcePtr, 2 * RunLength);
Inc(TargetPtr, 2 * RunLength);
Inc(Result, RunLength * 2 + 1);
end;
Inc(Counter, 2 * RunLength);
end;
24:
while Counter < Count do
begin
RunLength := 1 + (SourcePtr^ and $7F);
if SourcePtr^ > $7F then
begin
Inc(SourcePtr);
for I := 0 to RunLength - 1 do
begin
TargetPtr^ := SourcePtr^;
Inc(SourcePtr);
Inc(TargetPtr);
TargetPtr^ := SourcePtr^;
Inc(SourcePtr);
Inc(TargetPtr);
TargetPtr^ := SourcePtr^;
Dec(SourcePtr, 2);
Inc(TargetPtr);
end;
Inc(SourcePtr, 3);
Inc(Result, 4);
end
else
begin
Inc(SourcePtr);
Move(SourcePtr^, TargetPtr^, 3 * RunLength);
Inc(SourcePtr, 3 * RunLength);
Inc(TargetPtr, 3 * RunLength);
Inc(Result, RunLength * 3 + 1);
end;
Inc(Counter, 3 * RunLength);
end;
32:
while Counter < Count do
begin
RunLength := 1 + (SourcePtr^ and $7F);
if SourcePtr^ > $7F then
begin
Inc(SourcePtr);
SourceCardinal := PCardinalArray(SourcePtr)[0];
for I := 0 to RunLength - 1 do
PCardinalArray(TargetPtr)[I] := SourceCardinal;
Inc(TargetPtr, 4 * RunLength);
Inc(SourcePtr, 4);
Inc(Result, 5);
end
else
begin
Inc(SourcePtr);
Move(SourcePtr^, TargetPtr^, 4 * RunLength);
Inc(SourcePtr, 4 * RunLength);
Inc(TargetPtr, 4 * RunLength);
Inc(Result,RunLength * 4 + 1);
end;
Inc(Counter, 4 * RunLength);
end;
end;
end;
//----------------------------------------------------------------------------------------------------------------------Top
16 楼BossHawk(BossHawk)回复于 2002-04-21 19:14:01 得分 0
function GetPixel(P: PByte; BPP: Byte): Cardinal;
// Retrieves a pixel value from a buffer. The actual size and order of the bytes is not important
// since we are only using the value for comparisons with other pixels.
begin
Result := P^;
Inc(P);
Dec(BPP);
while BPP > 0 do
begin
Result := Result shl 8;
Result := Result or P^;
Inc(P);
Dec(BPP);
end;
end;
//----------------------------------------------------------------------------------------------------------------------
function CountDiffPixels(P: PByte; BPP: Byte; Count: Integer): Integer;
// counts pixels in buffer until two identical adjacent ones found
var
N: Integer;
Pixel,
NextPixel: Cardinal;
begin
N := 0;
NextPixel := 0; // shut up compiler
if Count = 1 then Result := Count
else
begin
Pixel := GetPixel(P, BPP);
while Count > 1 do
begin
Inc(P, BPP);
NextPixel := GetPixel(P, BPP);
if NextPixel = Pixel then Break;
Pixel := NextPixel;
Inc(N);
Dec(Count);
end;
if NextPixel = Pixel then Result := N
else Result := N + 1;
end;
end;
//----------------------------------------------------------------------------------------------------------------------
function CountSamePixels(P: PByte; BPP: Byte; Count: Integer): Integer;
var
Pixel,
NextPixel: Cardinal;
begin
Result := 1;
Pixel := GetPixel(P, BPP);
Dec(Count);
while Count > 0 do
begin
Inc(P, BPP);
NextPixel := GetPixel(P, BPP);
if NextPixel <> Pixel then Break;
Inc(Result);
Dec(Count);
end;
end;
//----------------------------------------------------------------------------------------------------------------------
function EncodeRLE(const Source, Target: Pointer; Count, BPP: Integer): Integer;
// Encodes "Count" bytes pointed to by Source into the buffer supplied with Target and returns the
// number of bytes stored in Target. BPP denotes bytes per pixel color depth.
// Note: The target buffer must provide enough space to hold the compressed data. Using a size of
// twice the size of the input buffer is sufficent.
var
DiffCount, // pixel count until two identical
SameCount: Integer; // number of identical adjacent pixels
SourcePtr,
TargetPtr: PByte;
begin
Result := 0;
SourcePtr := Source;
TargetPtr := Target;
while Count > 0 do
begin
DiffCount := CountDiffPixels(SourcePtr, BPP, Count);
SameCount := CountSamePixels(SourcePtr, BPP, Count);
if DiffCount > 128 then DiffCount := 128;
if SameCount > 128 then SameCount := 128;
if DiffCount > 0 then
begin
// create a raw packet
TargetPtr^ := DiffCount - 1; Inc(TargetPtr);
Dec(Count, DiffCount);
Inc(Result, (DiffCount * BPP) + 1);
while DiffCount > 0 do
begin
TargetPtr^ := SourcePtr^; Inc(SourcePtr); Inc(TargetPtr);
if BPP > 1 then begin TargetPtr^ := SourcePtr^; Inc(SourcePtr); Inc(TargetPtr); end;
if BPP > 2 then begin TargetPtr^ := SourcePtr^; Inc(SourcePtr); Inc(TargetPtr); end;
if BPP > 3 then begin TargetPtr^ := SourcePtr^; Inc(SourcePtr); Inc(TargetPtr); end;
Dec(DiffCount);
end;
end;
if SameCount > 1 then
begin
// create a RLE packet
TargetPtr^ := (SameCount - 1) or $80; Inc(TargetPtr);
Dec(Count, SameCount);
Inc(Result, BPP + 1);
Inc(SourcePtr, (SameCount - 1) * BPP);
TargetPtr^ := SourcePtr^; Inc(SourcePtr); Inc(TargetPtr);
if BPP > 1 then begin TargetPtr^ := SourcePtr^; Inc(SourcePtr); Inc(TargetPtr); end;
if BPP > 2 then begin TargetPtr^ := SourcePtr^; Inc(SourcePtr); Inc(TargetPtr); end;
if BPP > 3 then begin TargetPtr^ := SourcePtr^; Inc(SourcePtr); Inc(TargetPtr); end;
end;
end;
end;Top
17 楼ihawk1000000(临时用用)回复于 2002-04-21 19:28:48 得分 0
upTop
18 楼ihawk1000000(临时用用)回复于 2002-04-21 19:30:34 得分 0
太多了,发不了了,给一个油箱吧Top
19 楼BossHawk(BossHawk)回复于 2002-04-21 22:08:04 得分 0
到这里下一个吧,找了半天
http://vcl.vclxx.org/DELPHI/D32FREE/GRAPHICEX33.ZIPTop
20 楼ln0206(似是故人来)回复于 2002-04-22 09:34:28 得分 0
bosshawk:http://vcl.vclxx.org/DELPHI/D32FREE/GRAPHICEX33.ZIP
,下不下来,请你发个到我邮箱里(ln0206@21cn.com),谢谢,谢谢!!!!Top




