[lazarus] New components needed

Robert Scott Horning roberth at ise-tlx.com
Fri Feb 9 11:51:02 EST 2001


Michael.VanCanneyt at Wisa.be wrote:

> On Fri, 9 Feb 2001, Shane Miller wrote:
>
> > TImage would be fairly easy.  Components like TButton, TEdit are REAL easy
> > because there is a coresponding component in GTK.  All you do is create a
> > constant (like csbutton or csedit) that tells the widget seet what to
> > create, then in gtkobject's CreateComponent you add an entry to the case
> > statement
> >
> > csEdit : p := gtk_edit_new;
> >
> > Whith TImage I don't think thee's a coresponding component so it's a little
> > more difficult but not much.   You just ahve to decide waht a TImage is.
> > Really it's just a canvas you can draw on with functions to load images.
>
> There is a TGtkImage widget in GTK, so TImage should be really easy as well;
> Only you would still have to provide conversion routines for various formats
> as GTK works with xpm mostly.
>
> Michael

> > Shane
> >
> >
> > >As far as I see, some everyday components (such as TImage) are not availabe
> > >yet.
> > >Let's make it! I don't think this to be too difficult.
> > >

Before you get all in a hurry to reimplement the TImage component, please take a
look at the TGraphic object first.  The really nice thing about this object class
hierarchy is that it addresses a common interface for all graphical image formats
(for example, a TPNG and TGIF library is already available, and Borland included a
TJPG library that wouldn't be TOO difficult to reimplement).  Remember, these are
native libraries, as opposed to grabbing an image from the OS, such as using
bonabo or DirectDraw.  Wrappers can be written to even accommodate such instances,
and it all is encompassed by the TGraphic class, which TImage uses to do all of
its processing.  All of the TGraphic libraries are self-registering as well (that
I've used) so all you need to do is include the unit with your source code (in the
uses declaration or in the project file) and then your software now has support
for that file format.

This is particularly powerful when you are writing graphical editing software (as
I've done a bit in the past) and then you extend the capabilities without having
to re-code everything.  Delphi also has the TOpenPictureDialog and
TSavePictureDialog classes using the TGraphic information for the supported file
types and for the image preview, as well as being able to use the clipboard in a
considerably easier fashion, together with stream and general file I/O support.

What I'm getting at is that this is not a tiny project, but it can also be broken
up into smaller pieces for getting it to work properly.  To start with, working
with uncompressed bitmaps would be strongly recommended (not necessarily Windows
Bitmap format... although that may also be a possibility) and then gradually add
additional support.  The TGIF stuff is a part of the JEDI project now (I'm not
sure about the license, but he is giving away the source code), and I believe that
TPNG has been GPL'd, so we might be able to add that directly into Lazarus anyway.

Doing stuff like this on the Windows side is also pretty easy to do natively (on
the API side), and it would be worthwhile to see what kinds of stuff we'd like to
do with it.  In addition, the TCanvas object is closely related to a TGraphic
object as well, which should make designing custom components quite a bit easier
to do as well, from a component designer's viewpoint.
--
Robert Scott Horning
Trans-Lux West
1651 North 1000 West
Logan, Utah  84321
Phone: (435) 716-8696
FAX: (435) 752-8513
E-mail:  roberth at ise-tlx.com







More information about the Lazarus mailing list