Saturday, April 19, 2014

[Tutorial] Gimp for beginners Part 5 - Introduction to blend tool and filters

Introduction to blend tool and filters

The things that I am going to talk about today are some of the most important things in gimp and with them you can create some pretty awesome pictures. The things about which I am going to talk about is blend tool called gradient tool by photoshop geeks, a tool which blends two colors and filters which takes an input image and then apply some effects to it using some mathematical algorithm.

Okay I think that's enough intro, let's get to work now. What I will do today is that I will teach you how to make a moon, clouds and sky filled with stars and the greatest thing about all this is that you need nothing at all except gimp.

The first thing you need to do is create a new image and fill it with black color, you can set width of the image as 640 and height 400.

Create a new layer by going to "Layer" and selecting "New layer". In layer fill type choose "Transparency" and name this layer as "stars" so it is easy to look for it. Now go to filters, from it select "Noise" and select "Hurl" from it. Check the "Randomize" and choose 1 for "Randomization" and "Repeat".

Now go to "Colors" select "Desaturate" and from the dialog box that opens select "Luminosity". Make sure that stars layer has been selected. What are your thoughts about the stars then? Some of you might think that there are a lot of stars for this I recommend that you choose the "Airbrush" make sure your foreground color is black and the brush hardness is 50 or less and then randomly spray on the image. For me this is good so I won't be doing that.
Moving on, again go to layer and select "New layer" choose fill type as "transparency" and name this one as "Moon".
Select the "Ellipse select tool" and draw a circle with it.
Fill the circle with white color.

Now "Toggle Quick Mask" on, this is a dotted rectangle located at the bottom left corner of your screen and things outside the selection shall become red. I will explain more about quick mask in a later tutorial.

Select "blend tool". Now click on top left corner of your image and don't let go, a plus sign shall show up and drag it to the bottom right corner of your image.

 Your image should look something like this.

Toggle the quick mask off and something like this should come up on your image.

Now go to "Filters", "Render" then "Clouds" and then "Difference clouds". A dialog box shall open up. In it set Detail as 13, X-size as 4.4 and Y-size as 4.0 and check Randomize. If you want you can experiment and see how your end result will look like.

Mine looks like this.

Now deselect your selection by going to "Select" then click on "None". Using the fuzzy select tool select your circle or moon again. To me the moon looks a little dull, so what we can do is select "Dodge tool" and make sure that in type "Dodge" is selected.

Run the brush on the whole moon and it should brighten up.

Well that's our moon except its missing something, if you have a sharp eye like mine than you know its the glow. So let's add some glow to the moon. Create a new layer, fill type should be transparent and name it glow. Your circle selection should still be there. Go to Select and click on grow, set the "Grow selection by" to 18.

Fill the selection by a bright blue color, mine's 548295 in Html notation and that's hexadecimal.

Deselect your selection and go to "Filters", then "Blur" and select "Gausian Blur". Set both the "Horizontal" and "Vertical" to 41.
You should get something like this.
Set the glow's layer opacity to 25 and put it below the moon layer. Isn't it looks cool. Okay let's add some clouds now. Go to "Filters", "Render", "Clouds" and then select "Fog". Set "Fog color" as white, turbulence to 6.2 and opacity to 25. Click on "OK".
Here's how our clouds look but they kinda look like some comic clouds. Let's blur them so they look more real.
Go to "Filters" again, choose "Blur" and from it select "Gausian blur". Set both "Horizontal" and "Vertical" to 5.
It's fancy time now, let's add some fancy stuff to end this tutorial. Select "Text tool" and some text.
Right click on the text layer and select "Text to Path".

Go to "Select" and choose "From Path". Select "Blend tool" and go to tool options, select a gradient I selected "Golden". Select a shape and then drag on the selection from any two points you want.

That's all for today folks, I hope you did enjoyed this tutorial and I would love to hear your feedback and see what you have created. If you liked this, share it with others so that they can learn this cool stuff or share it anyway, there could be a person looking for this but doesn't knows about this site. You could be the guiding angel!

Programming on PSP - Lua Dev Tutorial#3 - Using Sounds

Okay now that we know how to use images, the steps are basically the same. First you load your sound file, and then you play it whenever it’s needed. There are functions that allow you to loop the sound file (to keep it playing continuously) and pause the sound file.

Loading a sound file

LuaDev only loads MP3, AT3, BGM and WAV files. So keep that in mind. To load a sound, you must set a variable to the sound file. For example:

bgmusic = sound.load("Sounds/music.wav")

The “sound.load” operation locates the sound file called “music.wav” in the “Sounds” folder and loads it into our program.

Playing a sound file.

Now that we’ve loaded our sound file, we can play it whenever we need to. To do this we use this function:
The “” operation plays the sound that we loaded earlier, which was defined as a variable, “bgmusic”

Pausing a sound file

To pause a sound file, we use this function:


The number “-1” indicates that the pause/play function is automatic. If not paused it pauses, if paused it resumes.
You can use “0” to resume the sound if paused and “1” to pause the sound if playing. (make sure you use a comma after indicating the variable)

Stopping a sound file

To stop a sound file we call this function.


This is pretty self-explanatory. I don’t think I need to get into detail with that.

To keep playing a sound file constantly – a loop.

To use this we call this function “sound.loop()”
For example:


This will keep playing the sound file continuously until the loop is stopped. To stop the loop we use this function.


Or you can free the sound file, using this function – This also frees more memory, it is recommended that you used this function.
That's all for now folks
Written By Joel16 & Edited by Ahmed Aziz

Sunday, April 13, 2014

C with classes / C++

C++ is an intermediate-level programming language. It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs; C++ was originally named C with Classes, adding object-oriented features, such as classes, and other improvements to the C programming language. The language was renamed C++ in 1983, due to involvement of the increment operator. It began as enrichment to C, first adding classes, then virtual functions, operator overloading, multiple inheritance, templates and exception handling, alongside changes to the type system and other features.
Most of the C++ programs process information and display results. It is consisting of a vocabulary of commands that humans can understand and that can be converted into machine language easily and a language structure that allows humans to combine these C++ commands into a program that generate interesting outputs.
It is one of the most popular programming languages and is implemented on a wide variety of hardware and operating system platforms. As an efficient performance driven programming language it is used in systems software, application software, and device drivers, embedded software, high-performance server client applications and entertainment software such as video games. Various entities provide both open source and proprietary C++compiler software including the FSF, LLVM, Microsoft and Intel.

  1. Coplien, J. (1998). Advanced C++ Programming Styles and Idioms. Illinois, USA.
  2. Stroustrup, B. (2009). The C++ programming language . Pearson Education.

Saturday, April 12, 2014

Programming on PSP - Lua Dev Tutorial#2 - Loading and displaying an image

Loading and displaying images

Loading an Image

So now you've learned the basics of printing text, using a certain color on the screen. Now we'll learn how to use images. Before displaying an image we must load it. To load an image, we set a variable to it. (A variable is basically a value that we define) for example in the tutorial above, red was our variable. It defined what color is. Anyways let’s get back to coding.
To load an image in LuaDev, we set a variable and call this function. Take note the quotations are required.

image.load("location/filename.format")  -- common ‘I’ is used in LuaDev

Location - To load an image, you must set up a location. If the location is in the same folder where the lua scipt is located, you can simply use the filename. Example if you want to load an image from a folder called “Images”, this is how you’d do it.

Filename – This is the name of the image you are using. For example

Format – LuaDev can load jpeg/png and gif images. These are the file formats.
This is how you load an image.

bg = image.load("Images/background.png")
bg is our variable.

Displaying an Image

After loading our image we need to display it. To display our image in Luadev, you can do it in two ways.

1. By calling the variable itself:

variable:blit(x,y) – I already stated above what the ‘x’ and ‘y’ means. Look into it for reference 

2. By calling “image.blit”

This is how to display an image.


This is what our code should look like altogether.
bg = image.load("Images/background.png")

while true do


bg = image.load("Images/background.png")

while true do

Both carry out the same operation.

Written By Joel16 & Edited by Ahmed Aziz

Wednesday, April 9, 2014

Show the numeric values entered in a character array

This program is used to show numeric values entered in a character array but the numeric values should be entered before the characters.

#include <iostream>
#include <conio.h>
#include <stdlib.h>

void main()
char arr[5];  //Creating a character array of size 5
cout<<"Enter the values of the array\n"; //Displaying a message asking to enter values
cin>>arr;  //taking input from the user and storing it in the character array
cout<<endl <<atoi(arr)<<endl<<"Program ends\n";  /*using built in function "atoi" and using it to convert numeric values
entered in a character array and converting into integer*/
Here's how the output will look like

Tuesday, April 8, 2014

Programming on PSP - Lua Dev Tutorial#1 - The Basics

These would be a series of tutorial for all those who want to learn luadev on PSP. All these tutorials are written by Joel16 so all credits goes to him.

Thanks to DeViaNTe for LuaDev.


First thing’s first, we need:
- LUA Dev’s interpreter (eboot that runs the lua scripts, “script.lua”). Download here
- Documentation (a text file or a website that lists all the known functions compatible with the interpreter) no worries the download above comes with it.
- Text editor ( I recommend notepad++, which can be downloaded here)
- Time, patience and a brain :P

Hello World – Just a simple text displaying program

So you’ve downloaded the interpreter and the documentation, and you’re ready to start programming on lua!

1. Open up notepad++ or whatever text editor you have, and create a new file.

2. Let’s start off with this line of code

red =,0,0)

What this does, is that it defines a color ‘red’ using RGB format. The first number defines R, the second or middle number defines G and the third or last number defines B. (R = red, G = green, B = blue). Have a look here for more colors 

3. Now that we’ve defined our color, we need to print text on the screen. So therefore we use this function:


The ‘color,color’ is used in LuaDev only when you’ve set a certain size. Take note the size isn’t required. I’m only including it to make things neat.

Okay so in LuaDev, “screen.print” is a function used for displaying text on a screen. Whenever you want text to be displayed on a screen you must use this function.

The “x” after the braket defines the x axis of the PSP screen. We all know the PSP screen’s resolution is 480x272. 480, is the width and 272 is the height (in pixels) of the screen.
So the “x” represents the X axis (anywhere from 0 to 480), and the “y” represents the Y axis. (anywhere from 0 to 272)

Now the “Text” bit represents the characters that are needed to be displayed on the screen, once the program is executed. It can be anything like “Hey there, name’s Joel” or “I love mum”. :lol:

The size.. Do I really explain this? Haha this obviously determines the size of the text. Take note these sizes aren’t like Microsoft office documents, they’re in decimal points. That is for example “0.6” is normal. Anything over one would appear quite large, well atleast that’s how it is in LuaDev.

The color, color – The first color determines the color of the text. The second determines the color of the shadow/highlight. This ‘second color’ (“,color)” is only called when you’ve set a certain size to your text. Although this isn’t necessary, we’re only going to be using it to make our program user friendly.

So now this is what it should look like:

screen.print(240,136,"Hello World",0.6,red,red)

This is basically all you need to know to run a simple hello world program. To use fonts, it is required that you set a variable called font, and used the function ‘font.load’ to load a specific font. Take note that LuaDev uses PGF fonts. The download above includes the software that convers TTF fonts to PGF. Anyways I won’t be getting into detail with this until later on.

4. This is what the whole code should look like:

red =,0,0) 

screen.print(240,136,"Hello World",0.6,red,red)

while true do

I know I haven’t defined a few things, so here’s what they mean.

screen.flip()- This function is called because when you print text, it is set to offscreen buffer, all drawing functions are. So, this means your text won't be visible until you type/call
screen.flip, which changes it to offscreen buffer to visible screen buffer.

while true do
screen.waitvblankstart() – What this does is that it loop the code in an endless loop while it is true (which it is), so now the text will stay displayed for a longer period of time (forever to be precise).

end - this is where we end our code.

Now on your text editor, save this file as “script.lua” without quotations. (If you’re using notepad, where you see the bit that says “.txt” select that box, and select “All files” then save the file as script.lua”
Now create a folder, it can be called anything. I’ll call mine HelloWorld. Now in this folder, place the Eboot,pbp(lua Dev interpreter) that was included in the archive I mentioned earlier and the lua file; script.lua. Now place this folder in your PSP/Game folder, and run the program in game section.

This is what the code should look like

That’s all for now, I’ll write up how to load, images, sounds and fonts later on.

Written By Joel16 & Edited by Ahmed Aziz

Thursday, April 3, 2014

[Tutorial] Gimp for beginners Part 4 - Making a monotone image

Making a montone image the quick way

In this tutorial I am going to quickly change a normal image to a montone one. First of all open the image you want to change into a monotone one. I am going to use the car image again from the first tutorial.

Now go and choose your foreground color as black. After that go to "Layer" and select "New layer".

A dialog box will open asking for you to choose the new layer properties. Leave everything as it is except in "Layer fill type" choose foreground color.

Go to layer modes and select "Color".

Right-click on the first layer and select "Merge down".

Now here's how your final image should look like. Wasn't that easy? Well that all for this tutorial.

I wanted to add this but forgot it when making the tutorial. When I told you go to layer modes and select "Color" you would have noticed that there were many other options too. Select them all and see what happens. If you want to understand more about this I recommend you go here.

Wednesday, April 2, 2014

[Tutorial C++] Basics of Programming Part 4

Conditional operators, if and if-else statements

Conditional operators
All the below operators are classified as conditional operators. These operators fall under this and category and are so called because they are used to check for conditions in conjunction with if (also it is used when ever we are making an expression we will see this later)  and then a desired outcome is set for them when it true.

  • ==  (Equal to)
  • !=   (Not equal to)
  • <    (Less than)
  • >    (Greater than)
  • <=  (Less than or equal to)
  • >=  (Greater than or equal to)

We can use these to check all kinds of useful things in our program like check for which student has the highest mark or which has the lowest mark or even check for who has the average marks. These operations though cannot be done on its own and we have to use something new.

if and if-else statements
"if" statements are one of the most useful things in programming languages and almost all languages have the same line of command. You compare something and then set a desired result if the condition is met. Though in "if-else" we compare something and then if the conditions fails we can decide on whether we want to set another condition or we can just let it go. This is how you would normally write an if and if-else statement.

For if
if (condition)
perform this

For if-else
if (condition)
perform this
perform this}

Another way to write if-else but the usage is in a different way
if (condition)
perform this}
perform this}
Notice that there are two ways to write an if-else statement, in the first way if one condition fails then you can write up another condition this can go on till the number of conditions you want but in the second one if the condition fails then you don't check for anything rather than you just tell the program to just do this. Now here's an example on how you would use these.

#include<iostream> //Declaring header file
#include<conio.h>  //Declaring header file

using namespace std;

int main() //main function
int marks[5]; //declaring an integer array

cout<<"Enter the marks of the five students."<<endl; //Displaying a message
cout<<"Enter student 1 marks"<<endl;  //Displaying a message
cin>>marks[0]; //taking input from user
cout<<"Enter student 2 marks"<<endl;  //Displaying a message
cin>>marks[1]; //taking input from user
cout<<"Enter student 3 marks"<<endl;  //Displaying a message
cin>>marks[2]; //taking input from user
cout<<"Enter student 4 marks"<<endl;  //Displaying a message
cin>>marks[3]; //taking input from user
cout<<"Enter student 5 marks"<<endl;  //Displaying a message
cin>>marks[4]; //taking input from user

if (marks[0]>90) //if statement to check whether student 1 got first position
cout<<"First position goes to student 1"; //if true then display this
  if (marks[1]>90) //if statement to check whether student 2 got first position
  cout<<"First position goes to student 2"; //if true then display this

    if (marks[2]>90) //if statement to check whether student 3 got first position
    cout<<"First position goes to student 3"; //if true then display this

     if (marks[3]>90) //if statement to check whether student 4 got first position
     cout<<"First position goes to student 4"; //if true then display this
      if (marks[4]>90) //if statement to check whether student 5 got first position
      cout<<"First position goes to student 5"; //if true then display this


 After seeing this and if you got the concept properly or by just testing it you will see that if for example both student 1 and student 2 get marks greater than 90 then the message that is shown tells first position goes to student 1 it doesn't tells that it goes to both. This is due to how if-else works, it works in a step-wise procedure so if first "if" becomes true then it shall skip the rest "if-else" statements otherwise if second "if" becomes true then it will skip the rest "if-else" statements after it and so on. If you don't want this and want to show for all students who got greater than 90 marks then remove all "else" from the code. Also you might have noticed that I haven't written the "perform this" code in square brackets well if you have only a single statement then you don't need the square brackets otherwise you do. I hope you got everything that I was trying to tell and like always here's how the program ran.



Copyright @ 2014 CPP Fuzz.