C++ComponentsLanguage FeatureLearn C++

How To Use A Sharpen Effect in C+ Software On Windows?

What is the sharpen effect in C++ software and how do I use it? Which C++ IDE supports the ability to apply a sharpen effect easily? How can I use a sharpen effect from a framework library in my own C++ software? Is there an easy way to add sharpen effects to components? How can I add sharpen effect to alpha images on my applications? How can I use TSharpenEffect in C++ Builder? What are the visual tips to add sharpen in the development of C++ applications? Let’s answer these questions.

What IDE should I use for my C+ software?

C++ Builder IDE is the easiest and fastest C and C++ compiler and 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 Reflection Effects, Shadow Effects, Glow Effects, etc.

What is a sharpen effect in photography?

Sharpen Effect, also called Sharpness is a combination of resolution and acutance of an image which are the two main factors of this effect. Resolution is the pixel size of the image which means if you have more pixels it can be morphed into a sharper image. Acutance is a subjective measure of the contrast at an edge. Higher contrast edges may have higher sharpen modifications. Thus if an edge has more contrast it will appear to have a more defined edge to the human visual system that will make the object sharpen.

What is the C++ software TSharpenEffect?

TSharpenEffect is a class for creating an effect that sharpens the texture of visible objects. In other term, sharpen effect removes soft pixels between higher color pixel changes at the edge that results in sharper pixels between objects that makes texts and objects more sharpen. For further information about TShapenEffect, go to TImageFXEffect and FireMonkey Image Effects.

TSharpenEffect increases the difference in intensity between the texture’s pixels. The sharpening amount can be set through the Amount property.

The following table shows the result of the TSharpenEffect effect on a .png picture, placed on a form (using a TImage object). The default value (Amount=1) is used for the sharpening property.

How To Use A Sharpen Effect in C+ Software On Windows The Firemonkey FMX logo

How to add a sharpen effect in a C++ software app?

How To Use A Sharpen Effect in C+ Software On Windows The object inspector window

Adding a Sharpen Effect to a single or multiple UI Elements in C++ Builder is very easy,

1. In RAD Studio or C++ Builder, create a new C++ Builder Multi-Device FMX application

2. Drag the TSharpenEffect component from the Palette on to UI Element (for example to an Image)that you want to. If you want to apply the same reflection settings on some group of the components, include all components that you want to add reflection into a group component (i.e Layout, Rectangle…) and drag TShadowEffect to your group component. This will add reflection effect to the group component, not to the all group members. Which means bottom components might be much visible than top components. You can use the Structure panel to move UI elements into UI groups.

3. You can change sharpness by changing the Amount property between 0 to 2.0

Here is an example that uses same Image without Sharpen Effect and with Sharpen Effect. As you see this component affects directly on run time.

How To Use A Sharpen Effect in C+ Software On Windows The sharpen effect in use

Note that you can change the Amount property of the Sharpen Effects in design time and on runtime. Here we used maximum amount 2 to show the maximum difference.

What are some Additional tips on adding a sharpen effect to C++ software?

  1. Do not use Sharpen is not necessary
  2. Use the Amount property to make define sharpness (Amount is between 0 to 2.0, the maximum amount is 2.0)
  3. If you don’t want to distort your image much but add a little sharpness you can use sharpen Amount between 0 to 0.5
  4. If your Image has constant sharpness (Amount) then we recommend you save this new image use in that way.
  5. Sharpen Effect is good to clarify texts on images which a background texture image. This may improve readability of texts
  6. Sharpen Effect can be good to offer different effects on their photos.
  7. Sharpen Effect is good in different color groups in images, this may sharpen these objects.
  8. Don’t forget higher resolution images may have higher sharpness. Use this effect on higher resolutions as much as possible then you can display in your visual resolution.
  9. Higher contrast edges may have higher sharpen modifications
  10. You can use single Sharpen Effect to group of components which are grouped in a TPanel, TGroup, TLayout, TRectangle or in any component. Just drag TSharpenEffect to this grouping component.
  11. If you have a constant, non-changing static image that will have the same amount of sepia at runtime, I recommend you save this result as a new Image and use it. Note that these kind of 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.
  12. You can use sliders or knobs to control the effect amount at runtime and you can do animation effects too.

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.

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

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
Artificial Intelligence TechC++C++11C++14C++17Language FeatureLearn C++

Learn How To Read The WAV Waveform Audio File Format In C++

C++C++11Learn C++

What Is Assignment Operator Overloading?

C++C++11Introduction to C++Learn C++Syntax

Full List Of Features In C++ 11

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

How To Use Basic Methods Of Strings In C++?