Mattias Gaertner wrote:
On Mon, 05 Feb 2007 09:52:50 -0300
Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:
Mattias Gaertner wrote:
- Should i implement GetCurrentObject?
IMO it would be better to improve TBitmap.
Currently TBitmap uses GetObject, so implementing it will also
benefit TBitmap. I'll take a look and keep you informed.
It uses it, but contrary to the VCL the LCL TBitmap leaves all
implementation details to the widgetset. It uses only parts of the
header information like width and height - the minimum set that works on
all platforms.
We have to extend the tagBitmap record, or replace the GetObject call
in TBitmap with a more platform independent one. IMO the latter would
be better.
I did some research in gtk side and found that is not viable to
implement GetObject for Bitmaps in a crossplatform way.
I found that gtk1 does not provides a direct pointer for a bitmap since
it fetches the data from the X server (not surprise due to its design).
I dont know if gtk2, qt does some buffering or whatever
Currently, GetRawImage does copy a image in a buffer. To minimize this i
think in introduce some functions (the names are dummy) to get the
direct pointer or the nearest possible:
TBitmapRecord: Info of the Bitmap necessary to process the image +
Bitmap Data Pointer + Pointer To Private Resource
function GetBitmapData(HBITMAP;var TBitMapRecord, Whatever);
function ReleaseBitmapData(TBitMapRecord);
Under Win32:
GetBitmapData: will get the Direct pointer through GetObject
ReleaseBitmapData: Does nothing
Under Gtk
GetBitmapData: will get the Data Pointer from a PGdKImage created
through gdk_image_get (No copy to buffer here). Stores the GdkImage in
Private Resource Field
ReleaseBitmapData: Releases the GdkImage
With this abstraction we avoid the current copy in gtk (the possible)
and get a direct pointer in win32 in a transparent way.
Is necessary to define what informations should be fetched (the minimal
necessary to process the image and also common between the interfaces),
the functions parameters, returnvalues, see the other interfaces, etc.
BTW: I found a way to simplify/optimize the code of GetRawImage* under
win32. I will do some testing and post a patch later.
Luiz
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives