C++ComponentsIntroduction to C++Language FeatureLearn C++

How To Add A No Code Emboss Effect To Images in Your Apps

What is an emboss effect in C++? Is there an easy way to add emboss effects to components? How can I add a emboss effect to images on my applications? How can I use TEmbossEffect in C++ Builder? What are the visual tips to add a sepia effect in the development of C++ software applications? Let’s answer these questions.

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. One of the greatest features of VCL and FMX UI frameworks is the effects on UI elements. There are many UI effects that can be used on the most of visual elements supported officially by the Embarcadero. There are many good effects that we can use: Sepia Effects, Reflection Effects, Shadow Effects, Glow Effects, etc. Let’s see how we do Sepia Effect in C++ Builder.

What is an Emboss Effect?

The emboss effect is a great way to manipulate digital photos to emboss images in gray colors like they are relief on the paper or on the stone. Whatever your photo has color pixels, all colors are going to gray colors.

How can I use the emboss effect in my C++ apps with no extra code required?

TEmbossEffect is a class for creating an effect that embosses the texture of visible objects. For further information, go to TImageFXEffect and FireMonkey Image Effects. TEmbossEffect finds the contrast lines and adds shadows to them in order to create the effect of depressing or raising the image relative to its background. The embossing amplitude and width – how strong the emboss effect will be – can be set through the Amount and Width properties.

  1. Create a new Multi-Device C++ Builder Project, save all project files in a folder
  2. Drag a TImage component from the component palette onto the form,
  3. Load an Image by using its MultiResBitmap property
  4. Copy and paste this TImage (Image1), position the new one (Image2) to the left
  5. Now we have two same Images. Let’s add Embossffect to the right one.
  6. Drag TEmbossEffect from Palette to the new TImage (i.e.Image2). If you do this, it will automatically add the Emboss Effect on the new Image with the 0.5 amount which is the default.
  7. You can modify the Amount (0 to 1.0) of Emboss Effect from the Object Inspector if you want. Lower values add a lighter amount of emboss effect, which is a more flat surface, higher values have much emboss effect. The maximum is 1.0.
How To Add A No Code Emboss Effect To Images in Your Apps showing effect

8. Finally, you can run the application by pressing F9 or Run button, Here is the result.

How To Add A No Code Emboss Effect To Images in Your Apps controlling the effect

What are some additional tips on adding an emboss effect to my apps at design or run time?

  • Digital photos of users are a good target on which to apply the emboss effect, do not use on components if not necessary.
  • Emboss effect always results in a gray colors picture.
  • Lower values add a lighter amount of emboss effect, which is a flatter surface, higher values have a strong emboss effect. The maximum is 1.0.
  • Emboss Effect is good to determine z level of pixels (maybe altitude in topography) in some specific photos. That means grayscale on these images can be used as a z level to create 3D images. You can use Embossed Images to create their Embossed 3D images, solids, etc. Note that in this method, the Z level is limited in a small amount.
  • If you have a constant, non-changing static image that will have the same amount of emboss at runtime, I recommend you save this result as a new Image and use it. Note that emboss effects cost GPU usage due to distortion on all pixels of that UI element. Thus, it may mean more energy consumption which will impact mobile users and that may cause your app to be listed as a higher energy consuming app in user task managers and monitors. If you really overdo it Android and iOS users may even receive warnings about your app being a battery hog which can negatively impact their perception of an otherwise great app. So, the golden rule is – use the effect in moderation.
  • You can use sliders, knobs, or other visual components to alter the effect amount at runtime and you can add animation effects too.

As you see the emboss effect is generally good if you want users to modify their images (like photo editors, photo effectors) by adding an emboss option. You can let them arrange the amount of the sepia value. Note that you can also develop your custom pixel manipulator in C++ if you want to develop more professional sepia effects with more optional parameters.

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here.

close

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

33+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux and some other operating systems. Dr. Yilmaz Yoru was born in 1974, Eskisehir-Turkey. He graduated from the department of Mechanical Engineering of Eskisehir Osmangazi University in 1997. One year later he started to work in the same university as an assistant. He received his MSc and PhD degrees from the same department of the same university. He has married and he is a father of a son. Some of his interests are Programming, Thermodynamics, Fluid Mechanics and Artificial Intelligence. He also likes the graphical 2D & 3D design and high-end innovations.
Related posts
C++C++11C++14C++17Introduction to C++Learn C++

Inserting A String Into A Wide String In A Modern C++ App

C++C++11C++14C++17Introduction to C++Learn C++

How To Use WString find_first_of() In A Modern C++ App

C++Learn C++

How To Read An XML File In A C Program Or C++ App

C++Learn C++

Solve A 3 Diagonal Matrix Using Successive Over Relaxation