Java
  Home arrow Java arrow Page 2 - Getting Started with Java 2D
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Getting Started with Java 2D
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 3
    2007-05-08

    Table of Contents:
  • Getting Started with Java 2D
  • Two-dimensional drawing
  • Image Processing
  • Using Java 2D API Step By Step

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Getting Started with Java 2D - Two-dimensional drawing


    (Page 2 of 4 )

    Two-dimensional drawing is also called 2D drawing for short. It provides all the basic functionalities required for drawing two dimensional graphics. These functionalities include shapes, stroking, filling, color, alpha compositing, clipping, antialiasing, text, and transformations.

    By definition, a shape in Java 2D is "an infinitely thin boundary which defines an inside and an outside in which pixels inside the shape are affected by the drawing operation, but those outside are not." In other words, anything defined using curves and lines that creates a boundary is a shape. Java 2D provides toolbox of standard shapes such as rectangles, arcs, and so forth.

    Stroking is the process of drawing outlines of shapes with varying thickness and dotted lines. Using Java 2D this can be achieved very easily. By using the API one can define any dotted line pattern and specify how the corners and vertices of shapes are to be drawn.

    While stroking deals with the boundary and outline of a shape, filling deals with space enclosed within the boundary or stroke that is the shape's interior. Using Java 2D, shapes can be filled using a solid color, pattern or gradient.

    Displaying a color correctly depends mainly on the hardware. Hence it is one of the difficult aspects of computer graphics. Since Java is platform independent, the 2D API provides for a platform independent way of representing colors that does not depend on hardware or viewing conditions. 

    The process of adding new elements into the existing drawing is known as compositing. In normal drawing operations source destinations overwrite destination pixels, whereas in compositing both are produced in the final image. When compositing is done, if the pixels are being drawn as partially transparent, so that the destination pixels show through, then such compositing is known as alpha compositing. Java 2D provides alpha compositing through Porter-Duff rules which provide considerable flexibility in using compositing.

    Limiting the area of the drawing operations is known as clipping. Using Java 2D API, any shape can be used for clipping.

    Normally any drawing on the screen would have jagged edges. The technique of smoothing the edges of drawn images is termed antialiasing. Java 2D API takes care of the details of producing antialiased drawing.

    Using 2D API, one can render strings, retrieve the shapes of individual strings or letters, and manipulate text in the same ways that shapes are manipulated. It can also use any of the True Type or Type1 fonts installed in client system. 

    Every object in Java 2D is subject to transformations. This means that any object can be translated, rotated, scaled and sheared as it is drawn.

    Now let's look at the image processing functionalities provided by Java 2D.

    More Java Articles
    More By A.P.Rajshekhar


       · In this article I have discussed the basics of Java 2D graphics. Please do...
     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek