Results 1 to 13 of 13

Thread: PngComponents en Delphi 11

  1. #1

    PngComponents en Delphi 11

    Na een tijdje gebruik gemaakt te hebben van de PngComponents set in delphi 7 wilde ik deze componenten ook graag gebruiken in Delphi 11.

    Helaas ondersteund de auteur geen nieuwere delphi versies.
    Hierdoor heb ik een tijdje moeten zoeken om de componentenset onder delphi 11 aan de gang te krijgen.
    Door enkele aanpassingen in de project en include bestanden kan deze set zonder problemen geinstalleerd worden in delphi 11.
    En wil ik de aangepaste bestanden met jullie delen:

    Wijzigingen:
    -Nieuwe D11 project bestanden
    -Gewijzigde Thany.inc (Toegevoegd):
    Code:
    CODE
    {$IFDEF VER180}
     {$DEFINE THANY_COMPILER_6_UP}
    {$ENDIF}
    Installeren:
    1. Download PngComponents
    2. Download de bijlage en volg de instructies in de install.txt

    Hoop dat jullie net zoveel plezier van deze componenten set hebben als ik
    Groeten Etznab.

    Omschrijving PngComponents (PngComponents.html aanwezig in doc dir na installatie):
    What is PngComponents?

    PngComponents is a set of components that allows you to include in your application real PNG files. PNG files on their own do not generate an enourmous advantage, but their support for an alpha-channel does indeed have quite a charm to it. The PngComponents library supports alpha-channels to their full extend, using a modified version of the excellent pngdelphi library.
    Windows XP computer icon Windows XP remote computer icon Windows XP closed folder icon Windows XP open folder icon
    Examples of PNG images with alpha-channels.
    Note that these don't work correctly in Internet Explorer (all versions up to 6).

    PngComponents' main and most important component is the PngImageList. This is a descendant of the normal TImageList, with in addition full support for PNGs with an alpha-channel. This will enable you to keep using most components that take advantage of imagelists, while actually feeding them icons with alphablending capabilities. Two other very nice components are the PngSpeedButton and the PngBitBtn. These two buttons do not have a Glyph anymore, but in stead, they accept a PNG file to be assigned directly to the button, without the need for an imagelist (just like the normal SpeedButton and BitBtn). And since the PNG glyphs are drawn in realtime, there's no more hassling with WM_DISPLAYCHANGE when the user changes the clBtnFace color in his display settings...

    Two other components included in the library are the PngImageCollection, which is simply a collection of PNG images. Nothing more, nothing less. The last one is the PngCheckListBox. This one accepts PNG glyphs for the check states. Beside that, it's a completely normal CheckListBox.

    I've also added a "fix" for Alex Desinov's awesome addon for Jordan Russell's Toolbar2000, called TBX. This fix is a replacement for the OfficeXP theme. Just replace TBXOfficeXPTheme in your uses clause with PngTBXOfficeXPTheme and that's it! Beautiful alphablended icons become possible in the OfficeXP theme as well.
    Why should I use PngComponents?

    The PngComponents library offers a major leap forward in creating nice GUI's in designtime. Not only does it speed up the implementation of alphablended icons in your application, it eases the way you can use them throughout your software. No longer do you need to put them in a resource file manually and then manually drawing them on a temporary bitmap and assigning that to somewhere. Adding beautiful alphablended icons to your interface is but a few clicks away.
    Usage
    Common

    The PngBitBtn and PngSpeedButton both have two extra properties, PngImage and PngOptions. PngImage substitutes the Glyph property with a PNG image, so only PNG files can be loaded into it. PngOptions determines what a disabled glyph looks like. You can choose from a combination of having it blended and having it grayscaled.

    The PngImageList and PngImageCollection share the same editor. This editor can be used to load PNG files into the respective component. When editing a PngImageList, the editor will only allow PNG files that have the correct dimensions. When editing a PngImageCollection, any PNG can be added. Note that in either case, it doesn't matter if you mix color depths or other properties.

    Note: the beta versions of PngComponents required that you use a PngImageCollection and assign it to the PngImageList.PngImages property. That is no longer the case, i.o.w. the components have been separated completely.
    The editor

    As said before, the PngImageList and PngImageCollection share an editor that allows to modify the contents of the respective component:

    * The Add button will ask for a PNG image. After that, you may set its name and background color. Note that you can select multiple files and add them all at once.
    * The Delete button deletes the currently selected image(s), after having asked for confirmation.
    * The Replace button only works when a single image is selected. It will ask for a PNG file and will replace the actual image.
    * The Clear button empties the list, after having asked for confirmation.
    * The Up button moves the currently selected images one position up, if possible.
    * The Down button moves the currently selected images one position down, if possible.
    * You can also drag images in the listbox. They'll be moved as you drag them, in realtime.
    * Remember that you can select multiple images, for your convenience.

    The editor will show up when you doubleclick the PngImageList or PngImageCollection component. You may also select Edit images... from its context menu, or doubleclick the PngImageList.PngImages or PngImageCollection.Items property.
    The ImageList

    The ImageList has some features and issues you should probably know about:

    * The images you add to the list are internally pumped into the "real" imagelist, so that native "API" windows controls, like listviews and treeviews, can take advantage of it. Even though PngImageList tries to make the best out of it, Windows 2000 and earlier simply do not support an alpha channel in an icon and may therefor display it incorrectly. This also applies on Windows XP and later, if you forget to add a manifest to your application. Note that themes support is not required for this to work, just a manifest is enough (themes may even be unavailable).
    * The editor will not crop or resize images that do not conform the dimensions of the imagelist. Unfortunately, this is extremely hard when working with PNG images, due to limitations in the pngdelphi library.
    * Components that do not natively support the PngImageList will not draw disabled images correctly. Those components usually have their own algorithm to generate disabled images, which will not work with the modern-style flashy colorful alpha-blended PNG images. You may want to include another imagelist with the same images, but with the EnabledImages property set to False.

    The OfficeXP fix

    A small introduction: Jordan Russell's Toolbar2000 is a set of components for creating Office 2000-style toolbars and such. Alex Desinov's TBX is an add-on package that adds even more functionality as well as theming. This allows for themes like "OfficeXP", "Office2003" and more.

    The OfficeXP theme comes standard with TBX and it's the one getting in major trouble when using in combination with PngComponents. The alpha-blended area's look ugly, images may show dark borders, and other kinds of artefacts may show up.

    The fix I've included is as simple as it is effective; it's a unit called PngTBXOfficeXPTheme. If you replace TBXOfficeXPTheme in your uses clauses with PngTBXOfficeXPTheme, you should be all set! You will not have the fancy looks in designtime, but in runtime your application will look better than ever.

    Warning! If you still need TBXOfficeXPTheme included in your uses clause, then make sure PngTBXOfficeXPTheme gets initialized after TBXOfficeXPTheme, or it will not work as expected.
    ps: FamFamFam heeft een zeer uitgebeide set PNG iconen uitgebracht onder de Creative Commons Attribution 2.5 License.
    Attached Files Attached Files
    Last edited by Etznab; 15-Mar-08 at 13:52. Reason: PngComponents.html text toegevoegd op verzoek.

  2. #2
    Senior Member arnold's Avatar
    Join Date
    Aug 2002
    Location
    Almelo
    Posts
    807
    Mischien kan je in het kort omschrijven wat deze componenten set doet. Het lijkt me iets te doen met png bestanden maar wat.

    Wil wel gragen weten wat ik ga installeren voordat ik het installeer.
    Computers make very fast, very accurate mistakes.

  3. #3
    Ter info: de DevExpress componenten ondersteunen ook PNG afbeeldingen. Ik gebruik sinds een paar weken de famfam icons en dat tesamen fleurt de user interface erg op. Kan het aanraden om daar naar te kijken.
    Groeten,

    Bart Roozendaal, Sevensteps

  4. #4
    Quote Originally Posted by arnold View Post
    Mischien kan je in het kort omschrijven wat deze componenten set doet. Het lijkt me iets te doen met png bestanden maar wat.
    Wil wel gragen weten wat ik ga installeren voordat ik het installeer.
    Dit staat eigenlijk al wel beschreven in de (engelse) beschrijving van de library.

    In een notendop: Deze png library (als het tenminste dezelfde is als die ik gebruik) heeft een TGraphic afgeleide waarmee je png afbeeldingen kunt laden. Het voordeel van png afbeeldingen is dat deze alpha blending ondersteunen. Hierdoor is het mogelijk om iconen te maken met een veel gladdere rand dan op de standaard manier. Normaal gesproken is een pixel namelijk helemaal transparant, of helemaal niet. Png afbeeldingen kunnen een mooie, gladde rand hebben, ongeacht de achtergrondkleur.

    Om daar goed gebruik van te kunnen maken, zonder veel extra werk te hoeven verzetten (zoals het aanpassen van componenten) is er een speciale PngImageList gemaakt, dia afgeleid is van TImageList en daardoor gekoppeld kan worden aan toolbars en menu's.
    Je kan daardoor automatisch png afbeeldingen toepassen op veel standaard componenten, zoals TSpeedButton, waardoor je applicatie een glad uiterlijk krijgt.

    Overigens gebruik ik hierbij de Incors Icon Experience collectie (tegenwoordig heet dit de 'X-Collection'. Dit is een heel complete icon set die helemaal pas in de Windows XP stijl. Recentelijk hebben ze al hun componenten helemaal opnieuw getekend, zodat dezelfde icons er nu ook zijn in de Vista stijl (de V-Collection).
    Deze icons lijken aardig aan de prijs, maar je hebt hiermee wel een enorme collectie icons die niet alleen nuttig zijn in zo'n beetje elke desktop applicatie, maar ook nog eens prima bij elkaar, en in je Windows omgeving passen. De aanschafprijs laat zich snel terugbetalen, aangezien je heel wat uren googlen naar het geschikte icon bespaart.
    1+1=b

  5. #5
    Senior Member Thaddy's Avatar
    Join Date
    Dec 2004
    Location
    Amsterdam
    Posts
    2,211
    kansloze warrelpraat. gebruik gewoon gdiplus, dat hoort bij het OS. Tenzij er behoefte is om win98 te ondersteunen (gdiplus.dll is beschikbaar vanaf winme). gdiplus heeft volledige png ondersteuning en is NIET langzaam itt wat hier wel eens is beweerd(dat lag aan video drivers, niet aan de ms code)
    Werken aan Ansi support voor Windows is verspilde tijd, behalve voor historici.

  6. #6
    mov rax,marcov; push rax marcov's Avatar
    Join Date
    Apr 2004
    Location
    Ehv, Nl
    Posts
    10,357
    Quote Originally Posted by Thaddy View Post
    kansloze warrelpraat. gebruik gewoon gdiplus, dat hoort bij het OS. Tenzij er behoefte is om win98 te ondersteunen (gdiplus.dll is beschikbaar vanaf winme). gdiplus heeft volledige png ondersteuning en is NIET langzaam itt wat hier wel eens is beweerd(dat lag aan video drivers, niet aan de ms code)
    gdiplus is altijd tergend, tergend traag geweest in mijn tests. En ja, ik heb dat de laatste 4 jaar niet overgedaan. Op b.v. stackoverflow wordt het nog steeds afgeraden, dus het is interessant te weten waar je dit inzicht vandaan hebt (*)

    Maar gdiplus was soms trager dan .pnm gebaseerde cygwin tooltjes, tooltjes die een image eerst naar een text representatie vertalen en dan terug. Dat is echt triest.

    (*) al is het maar dat ik dan eens de gdiplus header voor FPC vertaal. Iets waar ik tot nu toe niet echt gemotiveerd toe was.

  7. #7
    Senior Member Thaddy's Avatar
    Join Date
    Dec 2004
    Location
    Amsterdam
    Posts
    2,211
    gdiplus ++ radeon of Nvidea drivers van vandaag (dis wel een erg late reactie, Marco) zullen je van het tegendeel overtuigen. Btw: anders zou .net graphics helemaal geen kans van slagen hebben, directX gaat ook door de gdiplus layer heen(not so direct, dus) voor sommige 2D gevallen. gdiplus probeert direct hardware aan te sturen en valt anders terug. Resultaten waren inderdaad erg wisselend, achteraf.
    Werken aan Ansi support voor Windows is verspilde tijd, behalve voor historici.

  8. #8
    heeft iemand het pack nog want het volgende link werkt niet:
    http://www.thany.org/article/18/Delphi_components

  9. #9
    Hier staat een versie voor Delphi 2009/2010: http://cc.embarcadero.com/item/26127
    Marcel

  10. #10
    Quote Originally Posted by Marcel View Post
    Hier staat een versie voor Delphi 2009/2010: http://cc.embarcadero.com/item/26127
    ik heb het kunnen instellen met delphi 2007 alleen het TntImage mist het volgende:
    [Pascal Fatal Error] Unit1.pas(7): F1026 File not found: 'PngImage.dcu'

    het blijkt dat delphi net zo erg is als vb6 !

  11. #11
    mov rax,marcov; push rax marcov's Avatar
    Join Date
    Apr 2004
    Location
    Ehv, Nl
    Posts
    10,357
    Quote Originally Posted by Akama View Post
    het blijkt dat delphi net zo erg is als vb6 !
    Niet vloeken aub.

  12. #12
    Is dat deze? PngImage.pas
    Marcel

  13. #13
    Quote Originally Posted by Marcel View Post
    Is dat deze? PngImage.pas
    heel erg bedankt
    Last edited by Akama; 28-Jan-11 at 01:20.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •