Image Editor: of Professor & Head, Department of IT, CBIT

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

IMAGE EDITOR

A Project Report submitted in partial fulfillment of the


requirements for the award of degree of

BACHELOR OF ENGINEERING
IN
INFORMATION TECHNOLOGY

BY

KRISHNAVENI.T(0205-3006)
&
KANTHI.K.L.T(0205-3007)

Under the guidance


of
Dr. I.V. Ramana,
Professor & Head,
Department of IT, CBIT

DEPARTMENT OF INFORMATION TECHNOLOGY


CHAITANYA BHARATHI INSTITUTE OF TECHNOLOGY
HYDERABAD-75
2007-2008
DEPARTMENT OF INFORMATION TECHNOLOGY
CHAITANYA BHARATHI INSTITUTE OF TECHNOLOGY
(Affiliated to Osmania University;ISO Certified 9001:2000)
Chaitanya Bharathi P.O.,Gandipet,Hyderabad-500075.
Website:www.cbit.ac.in, www.cbitworld.com
Ph.Nos:08413-233356,54,08413-232488,87,08413-234162, Fax:08413-232099

CERTIFICATE

This is to certify that the project work entitled “ Image Editor” is a bonafide work
done and submitted by Krishnaveni.T(0205-3006) and Kanthi.K.L.T(0205-3007) , in
the partial fulfillment of the requirements for the award of Degree of Bachelor of
Engineering in Information Technology ,Chaitanya Bharathi Institute of
Technology, Affiliated to Osmania University,Hyderabad.

The results embodied in this report have not been submitted to any other
University or Institute for the award of any degree or diploma.

Project Guide
Dr.I.V.Ramana,
Professor & Head,
Dept of IT.,
CBIT,Hyderabad.
ACKNOWLEDGEMENTS

We thank Dr. I.V.Ramana, Professor and Head, Department of


Information Technology, for providing seamless support and knowledge over the past
one year, and also for providing right suggestions at every phase of the development
of our project.

We sincerely thank, S. Pavithran for his extensive support, guidance and


helping us put our ideas to work.

We express a whole hearted gratitude to Dr. B.Chennakesava Rao,


Principal, Chaitanya Bharathi Institute Of Technology for providing us the conducive
environment for carrying through our academic schedules and projects with ease.

We are grateful to Dr. I. Ramachandra Reddy, Director, CBIT for providing


us with all the moral support throughout our academic schedules.

We would also like to express gratitude to Prof. Suresh Pabboju for his useful
inputs at every stage of our project.

There is definitely a need to thank our friends and parents, without whose
support project would have been deferred.

KRISHNAVENI.T(0205-3006)

KANTHI.K.L.T(0205-3007)
ABSTRACT

Our project is concerned with developing an image editor in the


Linux platform. An image editor is a computer program that enables a user to
manipulate visual images to improve its appearance. It allows users to edit pictures
interactively on the computer screen and save them in one of many graphics file
formats.

Basic editing operations include selecting parts of an image, cropping,


scaling, sharpening and softening and changing the contrast of an image . The
editor is built in C++ programming language using Qt, a toolkit which
simplifies the work with graphics in C++.

Qt is a cross-platform application development framework, widely


used for the development of GUI programs and also used for developing non-
GUI programs such as console tools and servers. Qt uses C++ with several
non-standard extensions implemented by an additional pre-processor that
generates standard C++ code before compilation.

Qt is most notably used in KDE (K Desktop Environment) which is


a free graphical desktop environment for LINUX/UNIX workstations. It
provides basic desktop functions and applications for daily needs as well as
tools and documentation for developers to write stand-alone applications for the
system. There are many distributions of Linux OS, but the distribution used for
this project is Lenny(Debian Testing/Unstable).
TABLE OF CONTENTS

Contents Page No.


1. INTRODUCTION

1.1 Free (or open source) software


Free software is software that comes with a license that gives users certain
rights. In particular, the right to use the software, to modify it, to obtain its source,
and to pass it on (under the same terms). Notice that the term "free" is about rights,
not money. The Free Software Foundation (creators of the GNU GPL) speaks of free
in this context as in "free speech", not as in "no cost".

1.2 About KDE

KDE, or the K Desktop Environment, is a network transparent


contemporary desktop environment for UNIX workstations. KDE seeks to fulfill the
need for an easy to use desktop for UNIX workstations, similar to desktop
environments found on Macintosh and Microsoft Windows operating systems. KDE
is built with Trolltech's Qt toolkit which runs on most Unix and Unix-like systems,
Mac OS X and Microsoft Windows. All releases of KDE 3 are built upon Qt 3, which
was only released under the GPL for Linux and Unix-like operating systems,
including Mac OS X. For that reason, KDE 3 is only available on Windows through
ports involving an X server.

KDE 4 is based on Qt 4 which is also released under the GPL for


Windows and Mac OS X. Therefore KDE 4 applications can run natively on these
operating systems as well. KDE aims to make easy-to-use programs without
sacrificing features. KDE's Usability page states its goal as: "Working within the
existing design goals of a system, usability efforts aim to make the implementations
of these designs easier to use, faster to learn, more consistent and obvious, and
generally more ergonomic for their target audience. the KDE project serves as an
umbrella project for many standalone applications and smaller projects that are based
on KDE technology. These include KOffice, KDevelop, Amarok, K3b and many
others.

1.3 About NRCFOSS:

National Resource Centre for Free/Open Source Software (NRCFOSS)


aims to contribute to the growth of FOSS in India through Research and
Development, Human Resource Development, Networking and Entrepreneurship
Development, as well as serve as the reference point for all FOSS related activities in
the country including the creation and maintenance of this national FOSS Portal.

The National Resource Centre for Free/Open Source Software


(NRCFOSS) is funded by the Department of Information Technology (DIT), Ministry
of Communication and Information Technology (MCIT), Govt. of India, and is being
managed jointly by the Chennai division of the Centre for Development of Advanced
Computing(C-DAC) and AU-KBC Research Centre, Anna University, Chennai.
C-DAC is an Autonomous Scientific Society of the DIT, Govt. of India and AU-KBC
Research Centre is an Autonomous Research Centre of the Anna University.

1.4 About Qt:

Qt, by Trolltech, is a C++ toolkit for cross-platform GUI application


development. Qt provides single-source portability across Microsoft Windows, Mac
OS X, Linux, all major commercial Unix variants, and embedded Linux. On
embedded Linux, the Qt API is available as Qt/Embedded.

Qt provides application developers with all the functionality needed to build


applications with state-of-the-art graphical user interfaces. Qt is fully object-oriented,
easily extensible, and allows true component programming.
2.1 INTRODUCTION

This project aims at developing a picture editor.

2.1.1 Purpose

This document describes the external behavior of the application. It also


describes non-functional requirements, design constraints and other factors necessary
to provide a complete and comprehensive description of the requirements for the
software. The intended behavior of the system is clearly explained so that the
communication gaps do not lead to misinterpretations of actual requirements. The
requirements specified in this document are to be translated without any further
assumptions from the analysts or developers side to consequently lead to the system
with desired functionalities.

2.1.2 Scope of the system

Our application provides an editor to the user for viewing and performing
simple manipulations on images. It also provides some basic manipulations like
inverting the pixels in an image; transforming an image; zooming in and out for
detailed view; rotating and image; swapping the RGB components; performing fast
fourier transforms for a sharper and more accurate image and to fit the image to the
window size.

The user interface is simple and appropriate.


2.1.3 Product features

Image editor provides the following features to a user.


Image viewing
Image editor can load image formats supported by KDE.
It correctly displays images with alpha channel, using the traditional checker
board as a background to reveal transparency.

It lets the user accurately control the way images are scaled: user can zoom in and
out or automatically scale the image to fit the window. User can also rotate the
images by an angle of 90 degrees to the left or right.

Image manipulations
Our Image editor does not try to replace your favorite image editor, so it only
features the most simple image manipulations: rotation through mirroring and
inverting pixels. When working with JPEG files, it performs lossless
manipulations.

2.1.4 User Characteristics

The application is for occasional photographers and “single shot users”,


users who want to quickly view an image from a website or an email.
The application supports inverting pixels in an image. Hence it can be used to create
negative images.

The application is not intended for professional photographers and digital


artists.
The user need not have any inherent knowledge of Qt or Linux..The GUI
is simple and easy to understand. It has been developed keeping in mind an average
user.

2.1.5 Constraints

The application is licensed under the GNU GPL. This is to ensure that the
users enjoy the freedom guaranteed by the GPL.

Users are entitled to:


1. Run this software for any purpose.
2. Obtain and study this software's source code, and adapt it to their needs.
3. Redistribute this software and its source code to others (under the same terms).
4. Improve or modify this software, and release these changes to the public.

These freedoms apply to all the source code for all the modules your
software is based on. The freedoms also apply to any associated interface definition
files, and even include the scripts and control files used to control compilation and
installation of the executable; otherwise users could not exercise their rights.

2.1.6 Assumptions and dependencies

The very minimum assumption made for this application is that the user
would be running this application on a system which has Qt 4.0. This assumption has
been made based on the fact that we require an X-server to successfully implement
graphics.
3. DESIGN USING UML

3.1 An Overview of UML:

The UML is a language for,


• Visualizing
• Specifying
• Constructing
• Documenting

These are the artifacts of a software-intensive system.

The embedded real-time software systems encountered in applications


such as telecommunications, school systems, aerospace, and defense typically tends
to be large and extremely complex. It is crucial in such systems that the software is
designed with a sound architecture. A good architecture not only simplifies
construction of the initial system, but also, readily accommodates changes forced by a
steady stream of new requirements

Visual modeling is a way of thinking about problems using models


organized around real world ideas. Models are useful for understanding problems,
communication with everyone involved with the project, modeling enterprises,
preparing documentation and designing programs and database. Modeling promotes
better understanding of requirements, cleaner designs and more maintainable systems.

Models are abstractions that portraits the essentials of complex problem or


structure by filtering out nonessential details, thus making the problem easier to
understand.
print
help

exit

transform

swapcolors

end user
invert

open

rotate

fit to window

zoom

Fig.3.1 Use case diagram for Image editor


Use case diagram represents the relationship between various actors involved and the
use cases related to the project.
User Editor Image Database

request to open
an image

displays the available options

checks for
image

found?
displays file not
found

returns image
opens image for
image returned for viewing
further actions

zoom?
request to
zoom in or out

zoom out

request to rotate the zoom in


image left or right

request to fit the rotate left/right?


image into window

rotate right

rotate left

request to
swap colors

image fitted to
window

colors
request to swapped
invert pixels
pixels inverted

request to
fast fourier
transform
transform applied

changed image
for viewing

Fig.3.2 Activity Diagram


The above figure represents the flow of activity in this project.
connect(printAct, SIGNAL(triggered()), this, SLOT(print()));

exitAct = new QAction(tr("E&xit"), this);


exitAct->setShortcut(tr("Ctrl+Q"));
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

zoomInAct = new QAction(tr("Zoom &In (25%)"), this);


zoomInAct->setShortcut(tr("Ctrl++"));
zoomInAct->setEnabled(false);
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));

zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this);


zoomOutAct->setShortcut(tr("Ctrl+-"));
zoomOutAct->setEnabled(false);
connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut()));

normalSizeAct = new QAction(tr("&Normal Size"), this);


normalSizeAct->setShortcut(tr("Ctrl+S"));
normalSizeAct->setEnabled(false);
connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize()));

fitToWindowAct = new QAction(tr("&Fit to Window"), this);


fitToWindowAct->setEnabled(false);
fitToWindowAct->setCheckable(true);
fitToWindowAct->setShortcut(tr("Ctrl+F"));
connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow()));

aboutAct = new QAction(tr("&About"), this);


connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
aboutQtAct = new QAction(tr("About &Qt"), this);
connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}

In the private createAction() function, we create the actions providing the


application features.

We assign a short-cut key to each action and connect them to the


appropiate slots. We only enable the openAct and exitAxt at the time of creation; the
others are updated once an image has been loaded into the application. In addition we
make the fitToWindowAct checkable.

void ImageViewer::createMenus()
{
fileMenu = new QMenu(tr("&File"), this);
fileMenu->addAction(openAct);
fileMenu->addAction(printAct);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);

viewMenu = new QMenu(tr("&View"), this);


viewMenu->addAction(zoomInAct);
viewMenu->addAction(zoomOutAct);
viewMenu->addAction(normalSizeAct);
viewMenu->addSeparator();
viewMenu->addAction(fitToWindowAct);

helpMenu = new QMenu(tr("&Help"), this);


helpMenu->addAction(aboutAct);
helpMenu->addAction(aboutQtAct);
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(viewMenu);
menuBar()->addMenu(helpMenu);
}

In the private createMenu() function, we add the previously created


actions to the File, View and Help menus.

The QMenu class provides a menu widget for use in menu bars, context
menus, and other popup menus. The QMenuBar class provides a horizontal menu bar
that consists of a list of pull-down menu items. So at the end we put the menus in the
ImageViewer's menu bar which we retrieve with the QMainWindow::menuBar()

function.

The private updateActions() function enables or disables the Zoom In,


Zoom Out and Normal Size menu entries depending on whether the Fit to Window
option is turned on or off.

In scaleImage(), we use the factor parameter to calculate the new


scaling factor for the displayed image, and resize imageLabel. Since we set the

scaledContents property to true in the constructor, the call to QWidget::resize () will

scale the image displayed in the label. We also adjust the scroll bars to preserve the
focal point of the image.

At the end, if the scale factor is less than 33.3% or greater than 300%, we
disable the respective menu entry to prevent the image pixmap from becoming too
large, consuming too many resources in the window system.
You can connect as many signals as you want to a single slot, and a signal can be
connected to as many slots as you need. It is even possible to connect a signal directly
to another signal. Together, signals and slots make up a powerful component
programming mechanism.

Object Model:

The standard C++ object model provides very efficient runtime support for the object
paradigm. But its static nature is inflexible in certain problem domains. Graphical
user interface programming is a domain that requires both runtime efficiency and a
high level of flexibility. Qt provides this, by combining the speed of C++ with the
flexibility of the Qt Object Model.
Qt adds these features to C++:
--a very powerful mechanism for seamless object communication called signals and
slots
--query able and designable object properties
--powerful events and event filters
--contextual string translation for internationalization
--sophisticated interval driven timers that make it possible to elegantly integrate many
tasks in an event-driven GUI
--hierarchical and query able object trees that organize object ownership in a natural
way
guarded pointers (QPointer) that are automatically set to 0 when the referenced object
is destroyed, unlike normal C++ pointers which become dangling pointers when their
objects are destroyed
--a dynamic cast that works across library boundaries.

Layout Management:

The Qt layout system provides a simple and powerful way of specifying the layout of
child widgets. By specifying the logical layout once, we can do the following:
--Position the child widgets.
--Assign sensible default and minimum sizes for windows.
--Handle window resizing.
--Provide automatic update when contents change:
--Font size, text or other contents of child widgets.
--Hiding or showing a child widget.
--Removal of child widgets.
Layouts can be implemented in horizontal, vertical and grid formats. The above
mentioned features can be implemented using hand-written code.
Horizontal, Vertical, and Grid Layouts

The easiest way to give you widgets a good layout is to use the built-in layout
managers: QHBoxLayout, QVBoxLayout, and QGridLayout. These classes inherit
from QLayout, which in turn derives from QObject (not QWidget). They take care of
geometry management for a set of widgets. To create more complex layouts, you can
nest layout managers inside each other.

A QHBoxLayout lays out widgets in a horizontal row, from left to right (or right to
left for right-to-left languages).

A QVBoxLayout lays out widgets in a vertical column, from top to bottom.


A QGridLayout lays out widgets in a two-dimensional grid. Widgets can occupy
multiple cells.

When you use a layout, you don't need to pass a parent when constructing the child
widgets. The layout will automatically reparent the widgets (using
QWidget::setParent ()) so that they are children of the widget on which the layout is
installed.
Widgets in a layout are children of the widget on which the layout is installed, not of
the layout itself. Widgets can only have other widgets as parent, not layouts.

Plugin system:

Qt provides two APIs for creating plugins:


--A higher-level API for writing extensions to Qt itself: custom database drivers,
image formats, text codecs, custom styles, etc.
--A lower-lever API for extending Qt applications.
This enables developers to use Qt effectively while developing code for plugin based
applications. This feature is being prominently used in KDE’s Krita.
Qt provides unending support to the following technologies:
--Multithreaded Programming
--Main Window Architecture
--Rich Text Processing
--Model/View Programming
--Network Module
--OpenGL Module
--SQL Module
--XML Module
qmake

qmake is a tool from Trolltech that helps simplify the build process for

project across different platforms. qmake automates the generation of Makefiles so


that only a few lines of information are needed to create each Makefile. qmake can be
used for any software project, whether it is written in Qt or not.

qmake generates a Makefile based on the information in a project file

created by the developer, and are usually simple, but more sophisticated project files
can be created for complex projects. qmake contains additional features to support
development with Qt, automatically including build rules for moc and uic. qmake can
also generate projects for Microsoft Visual studio without requiring the developer to
change the project file.

You might also like