Tuesday, June 8, 2021

Creating a photo manipulation in Photoshop

Every one wants to change the photo from "what they see "to" what they want to see" . And photoshop handy in this case. As a beginner it is quite hard for us to learn photoshop and get a good photo manipulation out of it. But I have  created a very beginner friendly tutorial in creating a photomanipulation of an Oldman with egg in head.






























Photos used: 
Egg:


Saturday, August 15, 2020

How to create loading screen in C-Program.

 Creating loading screen in C-Program




As we all have seen that every software has their loading screen, we may want to add loading screen to our C programming project. Although we don't have anything to load we can add it to our project to make it look more attractive.

Header files used:

1. conio.h
   - It is used because getch( ) function is defined in this header file.

2.ctype.h
   - It is used because delay( ) function is defined in this header file.

3.graphics.h
   - It is used because of all the graphics function like settextstyle( ), setcolor( ), setbkolor( ), initgraph( ), closegraph( ).

Code:


#include<conio.h>
#include<graphics.h>
#include<ctype.h>
void loading();
void main()
{
int gm,gd=DETECT;
initgraph(&gd,&gm,"c:\\turboc3\\bgi");
loading();
closegraph();

}
void loading()
{
int i;
setbkcolor(BLUE);
settextstyle(0,0,2);
outtextxy(210,250,"Code In Nepal");
rectangle(185,300,475,310);
for(i=0;i<322;i++)
{
setcolor(10);
rectangle(205,300,155+i,304);
setcolor(WHITE);
rectangle(205,304,155+i,306);
setcolor(GREEN);
rectangle(205,306,155+i,310);
delay(4);
}
cleardevice();
setbkcolor(BLUE);
outtextxy(100,250,"Welcome to Code In Nepal");
getch();
}


HAPPY CODING😊😊

4 libraries/Features to be installed before getting started with programming in C in CodeBlocks IDE


There are so many IDEs to run C programs but not every IDE would have that user friendly environment and even may not be familiar with some features.Like those IDEs , CodeBlocks is a user friendly IDE with an attractive environment and is compatible with  languages like C and C++.But before getting started with programming in CodeBlocks,these 4 features are to be installed to avoid errors .

1.Graphics Header Files.

Compiling graphics file would show  Cannot find graphics.h. This is because graphics.h runs is not available in the library folder of Code::Blocks. To  compile graphics code on Code::Blocks, you need to setup winBGIm library.You can do it in following steps.

Step 1:To setup “graphics.h” in Code::Blocks, graphics library. Download WinBGIm graphics library from http://winbgim.codecutter.org/ .

Step 2:Extract the downloaded file. There will be three files:

  graphics.h

  winbgim.h

  libbgi.a

Step 3:Copy and paste graphics.h and winbgim.h files into the include folder of compiler directory. (If you have Code::Blocks installed in C drive of your computer, go through: Disk C >> Program Files >> CodeBlocks >> MinGW >> include.
Step 4:Copy and paste libbgi.a to the lib folder of compiler directory.
Step 5:Open Code::Blocks. Go to Settings >> Compiler >> Linker settings.In that window, click the Add button under the “Link libraries” part, and browse.Select the libbgi.a file which was just copied in step 4.
Step 6: In right part paste commands:

-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32.

You are ready to go with graphics in c.

2.Themes

In Code::Blocks,initially,you are available with only one theme.If you need dark or some costumized theme,you gotta follow those steps:

Step 1:Download this given file.( 

https://drive.google.com/file/d/1qj6UpKXokr_QHLrRalMrTcMjsed8vKcI/view )

(Source:Sangam.com.np)

Step 2:Goto C:\Program Files (x86)\CodeBlocks and open cb_share_config and open it.Click on the (…)like symbol and add the downloaded file and click transfer.) and close Code::Blocks.

Step 3:Open Code::Blocks,goto settings->editor and syntax highlighting and choose your fav theme.

3.Gotoxy function

You cannot use Gotoxy function in Code::Blocks until you declare given function and implement it.


#include<stdio.h>

COORD coord= {0,0}; // this is global variable void gotoxy(int x,int y)

{

coord.X=x; coord.Y=y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);

}

 

4.Opening graphics window in full screen

You will not be able to run graphics in full screen.Whenever you need to see a bigegr graphics,you may get a quarter window and will be so irritating.You gotta enter some code to make it run in full screen mode.Enter this code to get a full screen graphics window.

initwindow(2000,2000,"Big Window ");


Happy coding :)

Friday, August 14, 2020

How to use arrow key to choose option in C program (Using graphics)

  

Using arrow key to choose option in C program










While making a c program it isn't always good to choose our option by giving the input of number of option , so we can make our program look good by making the use of arrow key to choose option.


What will this code do:

1. Create options.

2.Use small rectangle to mark the option.

3.Chooses the option where the rectangle is.


Code:


#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void test(int);

void main()

{

int gd=DETECT,gm=0;

int y=127;

int key=0;

initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");

setcolor(4);

while(1)

{

cleardevice();

setbkcolor(BLUE);

setcolor(2);

settextstyle(0,0,2);

outtextxy(200,20,"Code In Nepal");

settextstyle(0,0,1);

setcolor(15);

outtextxy(20,130,"Like");

outtextxy(20,150,"Share");

outtextxy(20,170,"Subscribe");

rectangle(15,y,180,y+15);

key=getch();

if(key==27)

exit(0);

if(key==13)

{

test(y);

break;

}

if(key==80&&y<167)

{

y=y+20;

}

else if(key==72&&y>=142)

{

y=y-20;

}

else

y=y;

}

closegraph();


}


void test(int y)

{

if(y==127)

{

cleardevice();

outtextxy(50,50,"YOU CLICKED LIKE OPTION");

getch();

}

else if(y==147)

{

cleardevice();

outtextxy(50,50,"YOU CLICKED SHARE OPTION");

getch();

}

else if(y==167)

{

cleardevice();

outtextxy(50,50,"YOU CLICKED SUBSCRIBE OPTION");

getch();

}

}


Screenshots:





 


















 

Creating a photo manipulation in Photoshop

Every one wants to change the photo from "what they see "to" what they want to see" . And photoshop handy in this case. ...

Popular posts that you may be interested on