Re: [Lazarus] Read image from resources with TLazIntfImage
Valdas Jankūnas wrote: Hello, how i can read PNG image from Lazarus resources using TLazIntfImage? I tried TPortableNetworkGraphic to read transparent PNG from resource or file, but in transparent areas of saved PNG image i get random garbage.Code: img:=TPortableNetworkGraphic.Create; img.LoadFromFile(FAILAS_OUT); img.SaveToFile(FAILAS_IN); img.Free; This code is correct? If so i report bug to bugtracker. When you only loading, the stream loaded from is internally stored, so when you only save this stream is saved. It should result in an exact copy of your source. However if you modify something, then it depends on the widgetset (since it gets converted to a bitmaphandle first). On Gtk1 or Gtk2 this will replace your 8bit alpha channel with a 1 bit channel. If i doing same test (with file) using TLazIntfImage with TFPCustomImageReader and TFPCustomImageWriter, then i get correct results, but i not know how using TLazIntfImage load image from resource. See TCustomBitmap loadfromlazarusresource code. I think somehow after the image is loaded, TPortableNetworkGraphic thinks something is changed and the original stream isn't saved. Marc ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Read image from resources with TLazIntfImage
Marc Weustink rašė: Valdas Jankūnas wrote: Hello, how i can read PNG image from Lazarus resources using TLazIntfImage? I tried TPortableNetworkGraphic to read transparent PNG from resource or file, but in transparent areas of saved PNG image i get random garbage.Code: img:=TPortableNetworkGraphic.Create; img.LoadFromFile(FAILAS_OUT); img.SaveToFile(FAILAS_IN); img.Free; This code is correct? If so i report bug to bugtracker. When you only loading, the stream loaded from is internally stored, so when you only save this stream is saved. It should result in an exact copy of your source. However if you modify something, then it depends on the widgetset (since it gets converted to a bitmaphandle first). On Gtk1 or Gtk2 this will replace your 8bit alpha channel with a 1 bit channel. If i doing same test (with file) using TLazIntfImage with TFPCustomImageReader and TFPCustomImageWriter, then i get correct results, but i not know how using TLazIntfImage load image from resource. See TCustomBitmap loadfromlazarusresource code. I think somehow after the image is loaded, TPortableNetworkGraphic thinks something is changed and the original stream isn't saved. Thanks for info. -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] FPC error without line number
Some days ago I talk asked here about the use of a hex addr when a FPC error didn't shows the line number. Someone told me to use: FPC source-program -gl -B Today I have an real problem to report and I'll be waiting for explanations. Show the snapshot below, please: == [EMAIL PROTECTED] tools]$ fpc ConversorPliCob -gl -B Free Pascal Compiler version 2.2.0 [2007/08/31] for i386 Copyright (c) 1993-2007 by Florian Klaempfl Target OS: Linux for i386 Compiling ConversorPliCob.pas Compiling un_util_conversao.pas Compiling un_converte_declares.pas Linking ConversorPliCob 3138 lines compiled, 1.6 sec [EMAIL PROTECTED] tools]$ ./ConversorPliCob k5f5.pl1 An unhandled exception occurred at $0807C5C0 : EStringListError : List index (-1) out of bounds $0807C5C0 [EMAIL PROTECTED] tools]$ (This snapshot shows the screen of Fedora 8 running under VMWare in a windows XP machine) == As you can see I followed your recommendation, e.g., compile with -gl and -B directives and, as you can see above, the line number wasn't showed... Well, let me ask again: Is the hexadecimal address useful for debugging? Should I discover the line number where the error occurs? (I already discover(step by step with Lazarus debugging) the line of the error and it's located in a procedure inside the unit un_converte_declares.pas...) Greetings from Sao Paulo - Brazil Ricardo ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] TDirectoryTreeview Component
I have posted the following on the forum, but just in case someone does not visit the forum and has an answer : The last few days I've been trying to create a TDirectoryTreeview component. (I don't really know if what I have made has the intended functionality f a TDirectoryTreeview + it depends on the findFirst / Next functions that fail to identify symlinks and hidden files under linux/*nix so I've used $IFDEFs.) Here is a screenshot of a test application using TDirectoryTreeview under Ubuntu 8.04 : http://img108.imageshack.us/my.php?image=screenshot2mi8.png I have tried (without success) to make it work at design time (although I can set the properties values, the component does not get updated) but it works fine at runtime. If someone has a clue on how to fix this, please send me an e-mail at [EMAIL PROTECTED] or send it on this mailing list or this thread :http://www.lazarus.freepascal.org/index.php?name=PNphpBB2file=viewtopict=5281, so that I can create an .lpk package. To use it create a TDirectoryTreeview, assign an imagelist to the Images property, set the folder, selected folder, open folder and selected open folder image index to their according image indexes. Finally, create a TStringList and add to it entries in the following form : Node name Node directory Node Image Index, Node Selected Image Index e.g. Under Linux: My Home Folder /home/cyberpython 2,2 My computer Media /media 3,3 Under Windows XP : --- Desktop c:\Documents and Settings\User\Desktop 4,4 C:\ c: 2,2 D:\ d: 3,3 - and assign it to the RootDirectories property (RootDirectories := TStringlistNameWink Here is the code for the component : { / TDirectoryTreeview.pas -- Component For Displaying A Tree Of Directories In A FileSystem -- created by George cyber_python Migdos ***/ * * * * * See the Lazarus Distribution COPYING.modifiedLGPL, * * for details about the copyright. * * * * This code is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * * * } unit DirectoryTreeview; {$mode objfpc}{$H+} interface uses Classes, SysUtils, ComCtrls, Dialogs; type { TDirectoryTreeview } TDirectoryTreeview = class(TTreeview) private { Private declarations } FRootDirs: TStrings; FShowHidden : Boolean; FShowSelf : Boolean; FShowParent : Boolean; FFolderImageIndex : Integer; FFolderOpenImageIndex : Integer; FFolderSelectedImageIndex : Integer; FFolderOpenSelectedImageIndex : Integer; FRootDirectories : TStrings; procedure SetRootDirs(Value : TStrings); procedure SetFolderImageIndex(const NewIndex: Integer); procedure SetFolderOpenImageIndex(const NewIndex: Integer); procedure SetFolderSelectedImageIndex(const NewIndex: Integer); procedure SetFolderOpenSelectedImageIndex(const NewIndex: Integer);
Re: [Lazarus] FPC error without line number
Is the hexadecimal address useful for debugging? Should I discover the line number where the error occurs? FWIW when using Delphi you can use it to look up the symbol in a .map file, or using dcc32 -F (although I can't seem to make the latter work right now). -Flávio ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TDirectoryTreeview Component
cyberpython пишет: Here is the code for the component : Sorry, can you post the same but with attachment? Best regards, Paul Ishenin. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus IDE (GTK2) - flicker and slow redraws
C Western wrote: Luiz Americo Pereira Camara wrote: Mattias Gaertner wrote: But it is true, that the ExtTextOut function, which is used by SynEdit, under gtk2 is at least 5 times slower than under gtk1. It uses pango functions, which are great for full unicode support, but snail slow. Probably the font system must be changed to cairo. About slowness of synedit/gtk2: i noticed, in svn logs, you are trying to optimize synedit paint by using canvas.cliprect. This won't help much under gtk2 because cliprect is always = clientrect. Take a look into bug report 8871. I posted a patch and some notes. Luiz Is PaintRect/ClipRect providing any useful information under gtk2? No. I am using a custom control, and it seems to always repaint the entire screen, even if only a small part is needed (such as a disappearing hint window). This is the current behavior. I provided a patch in bug report 8871 that you can try and see if your component works OK. For my side, VirtualTreeView is OK. Luiz ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus