How to apply an effect on TImage? - delphi

This tutorial says that in order to apply an effect to an image, you need to make the effect a child of the MultiResBitmap of that image:
I can't do that. The effect refuses to nest under MultiResBitmap. It remains stuck under Image1:
What am I doing wrong? This should be so simple....
Why does the MultiResBitmap contain the word 'bitmap'? Does it HAVE to contain a bitmap (BMP), or does it also work with JPG?
I am new to Delphi 10.2 Tokyo (and FMX) - I am trialing it for a possible purchase.

I just tested it following the steps in the tutorial, and it works perfectly fine for me. Drag and drop RippleEffect1 onto Image1 (not the multi-res bitmap, but Image1).
The image does not have to be a bitmap; it can be any supported image type. The name choice you'll have to ask Embarcadero about, I'm afraid.

Related

ImageList promises me Alphablending, but how do I enable it?

I want my buttons to have images with alphablending on them.
As instructed I've included a TXPManifest component on my mainform.
Below are some images I've loaded into my project.
However my BitBtn, which is linked to the imagelist via an ActionList still looks off.
<<-- It looks like this at runtime, Yikes!
How do I get Delphi 2007 running on my Windows 7 laptop to actually use the alpha channel the ImageList keeps teasing me with?
In response to #RRUZ, here are the imagelist properties:
(Note the absence of a colordepth property)
EDIT
The alpha-blending does work with the TMS AdvGlowButton:
So it's probably not a ImageList issue, as much as it is an BitBtn issue.
UPDATE 2
Downloaded and installed PngComponents. Putting a TPNGImageList on a blank form instantly crashes D2007. (Maybe something in the settings/path/etc, but I'm drifting too far from the original issue so I'm dropping the png pursuit).
So that doesn't work.
I suggest you to refer to Anders Melander's Blog.
Hes has published 2 relevant posts both related to alpha blending under Delphi 2007:
Alpha Blended Splash Screen in Delphi - Part 1
Alpha Blended Splash Screen in Delphi - Part 2
Very instructives.

Problem with TdxComponentPrinter (Delphi)

TdxComponentPrinter is a componenet that allow me print a TPanel on a paper. But there is problem and when the panel contains TImage, the background of the image will be converted to black in the paper.
Before print :
After print (on the paper) :
I have tried different ways to solve this problem. for example i used Repaint; method of TPanel,...
but doesn't work and the background of image is still black. I don't know why!!!
Help me please.
This is a png file, which might not be supported completely in your Delphi version. Did you try to change it to a TcxImage which might be more compatible with the DevExpress printing system?
It also might be worth it to submit this issue to DevExpress if you can't fix it. They reply really quick and know more about their components then all of use here on SO :-)
If it is already a jpg then you should improve the quality of the jpg. It looks like the black parts are compression artifacts where there is a mix between white and another color. If you clean up the background of the image with a paint program it will probably look a lot better.

Resizing an image in Delphi XE

I got a jpeg image in which is 1020x780, I am trying to resize this to 111x85 (which is in proportion) but it comes out pixelated.
I am tried just
a) Assign the image to a TImage component and set the Scaled/Resize property.
b) The resize code here http://www.delphigroups.info/2/4/313095.html
c) The resize code here http://www.swissdelphicenter.ch/torry/showcode.php?id=1896
However they all come out pixelated.
If I resize in Photoshop then it comes out nice. Getting it THAT good would be ideal, however I know they spent a lot of time/code into resize so something even halfway between would be great.
Any suggestions?
Have a look at Graphics32 library. It implements various image resampling and transformation algorithms for 32-bit bitmaps.
In my blog I talk about resize images using/implementing antialiasing.
Read the article and test the code here. It's writed in Spanish but you can use authomatic translate. In any case you can read only the code.
See the difference of apply and not apply the code:
The code work with BMP, but you can convert the image first and apply it.
Instead of using the built-in TImage for scaling, you could use an external library or component, e.g. ImageMagick or some off-the-shelf component. There exists at least one Pascal wrapper for ImageMagick
http://wiki.freepascal.org/PascalMagick)
, but I've never used it myself.
I have successfully used HiComponents ImageEn library to resize an image down to approx 250 pixels. It was a while ago, but I recall that the results were quite pleasing. http://www.hicomponents.com/main/products/products-imageenvcl - it's free now, and well worth a look if you're doing any graphics programming in Delphi.

Ugly "disabled" images of TMainMenu

Delphi 2010, Win32 VCL. I need to create a main menu for my application with the most standard look. TMainMenu looks nice in all Windows versions, the only bad thing is when it displaying images for items with Enabled=False.
Delphi has some strange method for building that disabled images (b/w extrusion with bevels, for me it looks like spew). I want to make a patch for that procedure in VCL sources and let menu to select disabled images from the same TImageList, but I can't find it.
Is it exists at all or it is some standard windows API call? Do you know where is that procedure located?
Sure OwnerDraw style can fix all this but I want a bit faster solution.
There's a great post on Galfar's Lair blog which describes the problem, and has code for a workaround, overriding the TImageList DoDraw method.
Here's the pic (linked) showing the 'before' and 'after'.
I think this relates to pretty much all Delphi versions.
If you can provide your images as PNG you can use TPngImageList from PngComponents. It has different options to make a blended or grayscaled disabled image. The PNG format allows you to make use of alphablending.

Delphi: image with alpha blending capabilities

Is there some simple component that could display PNG 32-bit images and alpha-blend it to another image on mouse enter and on mouse leave? Or even just a simple image that can load 32-bit PNG and additionally would have Alpha parameter...
I suppose I could use some skin library (alphacontrols?) or some graphics library, but for some simple purely visual effects that would be quite an overkill and I can't seem to find a simple one that does it for me and would work on Glass surface as well...
It is not quite a component, but here is a link to a good article on how to do it yourself. Its just a few lines of code:
http://melander.dk/articles/alphasplash/
The basic TImage is capable of displaying a PNG image and alpha-blend-it to whatever is behind it. You just need to add the "pngimage" unit to the uses clause of your form. You didn't mention the version of Delphi you're on: Delphi 2010 has this unit, but I have no idea with what version of Delphi they started shipping it. For Delphi 7 I know for sure you'll need to find the open source "pngimage".
If you need to do this when the user moves in and out of your control, consider caching the state images in bitmaps: it will be faster at runtime and you can use a single TImage that shows the current image, you don't need two overlapping TIMage controls.

Resources