Google Ads

January 31, 2019

Create a stylish button in GTK+ (Custom widget creation)

Often times we want to create our own form of buttons and widgets when using widget libraries such as GTK+. Although, we could achieve this by creating theme files but sometimes it is just easier to implement such widget using drawing routines available. In this tutorial, I am going to show you how to create a stylish button in GTK+ by not using widget provided button but by using drawing routines available for GTK+ library like shown below:




First, we create four png images for the button for hover, normal, pressed states and mask. We are going to use Cairo library for drawing our button state images into its container. All the functions required for creating this button are part of Standard GTK+ 2 package, so no external dependencies! for the button creation.

Second, we load button png images using cairo_image_surface_create_from_png function.

Third, we prepare a mask for the button as the button can have any shape where some parts of the button are transparent. We create a pixmap as button mask using gdk_pixmap_new function and format the mask according to mask png file using Cairo drawing functions. Our style button contain would be a GTK+ drawing widget. Finally, we set the mask using gtk_widget_shape_combine_mask function.

Fourth, we have to be able to update the button look according to its state which is achieved by connecting different signals to button container and updating button state variable in the signals callback functions and finally drawing the button images using Cairo functions. The callbacks functions can also be used for achieving normal button operations.

That's it!

Download the tutorial files from the following link:

gtk_style_button.zip

October 1, 2018

OpenGL texture compression library for Ubuntu for better graphics experience

If you are using Intel graphics chip for your graphics needs on Ubuntu then probably you need to install OpenGL texture compression library to gain proper graphics performance and quality out of your graphics card. By default this library is not available on Ubuntu due to license, IP or distribution restrictions. The library provides the following OpenGL extensions under Mesa3D OpenGL implementation:

GL_EXT_texture_compression_s3tc
GL_S3_s3tc

These OpenGL extensions provide support for efficient graphics texture uploading to your graphics processing unit making graphics applications utilize its memory bandwidths efficiently and productively to deliver best performance. Consequently, almost all games and applications make use of these OpenGL extensions. The library can be compiled from the source code under a GNU Linux distribution of choice easily. For Ubuntu based distributions the pre compiled and ready to be installed 32 Bit and 64 Bit libraries packages can be downloaded from the following link:

http://onthim.blogspot.com/p/onthim-downloads.html
 

Cheers,
Imam

April 8, 2018

Free secure file sharing using Snap Image Share

Sometimes we want to share files with our friends, colleagues and mates but also want to limit the access someway like how long the file will be available, number of downloads for the file, and so on. We can easily share files on Facebook and Instagram too, but to share files on these platforms the people you are sharing files to also need to have accounts on these platforms. Snap Image Share is a new free file sharing platform by SALHOS Engineering with which you can share as many files as you want with file size up-to 100 MB without any accounts or signup and also limit file sharing access like availability and downloads. Just like Google Drive and Dropbox file sharing services people do not need any account in Snap Share Image to download images. So, start sharing files now with Snap Image Share:

Snap Image Share

Cheers!
Imam