dibs
所属分类:Pascal/Delphi编程
开发工具:Delphi
文件大小:44KB
下载次数:3
上传日期:2007-12-03 19:06:22
上 传 者:
selami
说明: Delphi Dib usage component... D3-4-5 but there is CBuilder OBJ files. u can use them. :>)
文件列表:
BlobDib.int (675, 1997-11-19)
CBuilder.zip (11129, 1997-11-19)
CDIBs.int (5718, 1997-11-19)
Delphi1.zip (7980, 1997-10-26)
Delphi2.zip (9901, 1997-11-19)
Delphi3.zip (10309, 1997-11-19)
********* CDIBs unit for Delphi 3, 2.0 and Delphi 1.0, and C++ Builder
- Author: Lubomir Antonov - Ver 1.3
--------------- DESCRIPTION
The CDIBs unit exports a class TDIB. The class provides easy access to device-
independant bitmaps. TDIB parallels TBitmap in its interface and functionality, but
TBitmap works with DDBs (device-dependant bitmaps). Therefore, if a DIB is ever assigned to
a TBitmap object, it will be converted to the current screen resolution and assigned the
currently realized palette (if it does not have one of its own).
TDIB will allow you to manipulate DIBs (copying to and from the clipboard, files,
the resource file and yes, even a TBitmap object).
**** IMPORTANT for Windows NT (I think it also aplies to Windows 3.x):
The TDIB class also solves a problem (a bug I would say) in the TBitmap class -
under Windows 95, if you have a CF_DIB format on the Clipboard and you assign the Clipboard
to a TBitmap object, Windows 95 will automatically provide a CF_BITMAP and CF_PALETTE
formats. But under Windows NT this conversion is not performed and the assignment will fail.
(If you don't beleive me, have a look at the source code for the TBitmap class). By using
a TDIB class, you can read the CF_DIB data and then assign the TDIB object to a TBitmap
object.
--------------- FILES
The .ZIP file contains the following files:
Readme.txt - this file
CDIBs.int - the interface of the CDIBs unit for reference
BlobDib.int - the interface of the BlobDib unit for reference
Delphi3.zip - the compiled units for Delphi 3
Delphi2.zip - the compiled units for Delphi 2
Delphi1.zip - the compiled units for Delphi 1
CBuilder.zip - the compiled units for C++ Builder
Extract the appropriate version of the compiled units into your Lib directory or into
another directory that is listed in the Library path in your Delphi options.
For Delphi, add CDIBs to the uses clause of the file that will work with TDIB objects:
uses CDIBs;
DO NOT USE THE ADD COMPONENT COMMAND, since TDIB is not a component and cannot be
registered on the palette.
For C++ Builder, #include the .hpp files in your code and use the Add to Project dialog
to add and link the .OBJ files to your project.
--------------- REVISIONS
Ver 1.2
- included support for assigning to and from a TBlobField
Ver 1.21
- ported the unit to 16-bit. Although I have tested the basic functionality, I can't
give any guarantees as to how well it will work for you. Please notify me of any
problems that you encounter. Do not use the CopySection function and do not change
the Width and Height property, as this will result in a GPF.
The compiled 16-bit version is in the file CDIBS16.zip.
Ver 1.22
- fixed a bug with copying sections of an DIB that has a color table.
- included a new method CreateFromSection for easy bitmap section extraction.
Ver 1.23
- Fixed a bug with assigning 256-color DIBs to a TBitmap
Ver 1.3
- Ported the class to Delphi 3 (Delphi 2 compatibility remains)
- Removed dependance on undocumented string constants for error messages
- Implemented direct drawing of the DIB on a canvas:
now TDIB objects can be used everywhere a TGraphic can, including
the Draw method of a canvas, and assigning to a TPicture as in:
Picture.Graphic := ADib
- Removed TBlobField support from the TDIB class to remove dependancy
on BDE. Moved the support to a separate class TBlobDIB in unit BlobDib
- Ported the class to C++ Builder
--------------- DISCLAIMER
The CDIBs unit is provided as is and without warranties or guaranties of any kind.
Any loss or damage resulting from the use of the software is not the responsibility of the
author.
--------------- DETAILS
Initializing a TDIB:
- Use the Assign method to assign the Clipboard, another TDIB or a TBitmap
to the TDIB object.
- To load the DIB from a file or a resource call the methods LoadFromFile,
LoadFromResourceName and LoadFromResourceID.
Others:
For most of the functionality of TDIB you can look at the decoumentation
for TBitmap - all of the TBitmap methods that make sence for DIBs are
implemented in TDIB. In addition there are some simple image processing
methods.
- CopySection extracts a rectangular portion of the current DIB and assigns
it to the object.
- You can use the CanConvert16to24 and Convert16to24 to convert
16-bit to 24-bit bitmaps (I found the hard way that most image processing
applications cannot read 16-bit bitmaps!).
- And finally, the DIBtoBitmap method creates a DDB and palette from the DIB.
- TDIB objects can be assigned to the Clipboard, another TDIB or a TBitmap.
I suggest that if you need to preserve the DIB format, handle it using
a TDIB and use TBitmap.Assign( TDIB ) in order to display.
Ver 1.1: The following properies were added to allow more direct access to the DIB:
Header - a pointer to the TBitmapInfoHeader of the DIB
Bits - a pointer to the beginning of the bits of the DIB
ColorTable - a pointer to the palette of the DIB
ColorTableSize - number of colors in the palette
Colors - an array of the colors of the palette
BitDepth - bit depth, or bits-per-pixel of the DIB
Ver 1.3: This version provides the biggest changes in functionality since Ver 1.1:
The TDIB class compiles with both Delphi 2 and 3. In addition, it contains
some functional improvements over version 1.23. The main one is full
compatibility with TGraphic objects including drawing and palette
operations. A TDIB object can now be displayed directly on a canvas without
the need for an intermediate TBitmap. This can be accomplished through the
Draw and StretchDraw methods of TCanvas as follows:
ACanvas.Draw( 0, 0, ADib ) or
ACanvas.StrechDraw( rect, ADib )
A TDIB object can also be directly assigned to a TGraphic property such as
the Graphic property of TPicture. This makes it possible to initialize a
TImage component like this:
Image1.Picture.Graphic := ADib;
This will display the DIB in the TImage component.
I have also received several requests to remove TBlobField support from
TDIB since it requires the BDE. Version 1.3 of TDIB no longer supports
assigning to/from TBlobFields and consequently does not use any database
units. This support was moved to a derived class TBlobDIB, which is included
in a separate unit BlobDib. Therefore the functionality is still readily
available if you make use of it.
C++ Builder:
Follow the Delphi instructions, but use C++ syntax. To assign a bitmap from
or to the clipboard use the Clipboard() function as follows:
dib->Assign( Clipboard() ); and
Clipboard()->Assign( dib );
--------------- SOURCE CODE & USAGE
You can use the CDIBs unit without any restrictions with only one condition: send
me an e-mail (or snail mail - see address below) saying that you are using the software.
I would appreciate any comments you might have, too. No names necessary - I just want to
know how useful the TDIB class is.
My e-mail address is:
lantonov@concentric.net
You can use the CDIBs unit without any restrictions. However, you might need to
change some of the functionality of the TDIB class, or add to it. After all, I started TDIB
because I needed to change the functionality of TBitmap. Instead of reinventing the wheel,
as I had to do, because of the very limiting implementation of TBitmap, you can have the
source code for TDIB for $10.
If you want the source code for the CDIBs unit, send a cheque or money order
(cash is also accepted) for $10 to:
Lubomir Antonov
13401 Metric Blvd. #824
Austin, TX
78727
Please include a return e-mail address (for an e-mail attachment) or mailing address
(for a diskette). Or include a phone number to confirm an arrangement.
近期下载者:
相关文件:
收藏者: