Skip to content

AtharvTalnikar/JAVA-image-manipulator-application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Functions supported

  • Implemented dither functionality correct: YES
  • Supported dither through script commands: YES
  • Supported dither through GUI: YES

Known bugs

The "run" command is not supported in the interactive command mode, and scripts can only be executed using the -file flag while running the JAR file. This limitation was discovered late in the process and reported to the developers. Since it does not impact the implementation or functionality of the Dither feature, no immediate fixes were anticipated.

Changes made to intergrate Dither functionality

Controller Changes

To incorporate the new Dither functionality, the controller layer was enhanced while adhering to the existing design patterns:

Command Design Pattern Integration:

  • A new Dither class was created, implementing the existing ImageCommand interface. This ensures consistency with the established command pattern.

  • The Dither command was added to the commands map in the ImageController class. This allows the dither operation to be invoked through text or script-based interactions, maintaining compatibility with existing command execution workflows.

Callback Mechanism for View Communication:

  • The dither() method was added to the Features interface, which serves as a callback mechanism for the view to interact with the controller. This avoided the creation of a new interface, ensuring that the view continues to interact with the controller through a single point of contact. This choice avoids unnecessary complexity by maintaining the existing interface and ensuring backward compatibility.

  • In the ViewController, which implements the Features interface, the dither() method was implemented to execute the appropriate logic and invoke the command. This seamless integration preserves the modular and decoupled structure of the application.

Model Changes

To support dithering functionality in the model layer, new interfaces and classes were introduced, extending the current design hierarchy:

Extending the Image Representation:

  • A new ExtendedImagev2 interface was created as an extension of the existing ExtendedImage interface. This approach maintains compatibility with previous implementations while allowing the introduction of new features.

  • The ExtendedRGBv2 class was implemented as an extension of ExtendedRGB, which itself is a concrete implementation of ExtendedImage. This inheritance preserves existing behaviors while enabling specific support for the dither functionality.

  • Adding new methods to the existing ExtendedImage interface would break backward compatibility with any existing classes that already implement it. This would violate the Interface Segregation Principle (ISP), as old implementations would be forced to define methods they do not need.

Processor Updates for Dither Operation:

  • The ImageProcessor interface was extended to include void ditherImage(String[] args). Unlike the image representation layer, the decision was made not to create a new processor interface because the design already assumes a single processor (ImageMap) for all image operations.

  • The ditherImage method was implemented in the current ImageMap processor. This implementation ensures that dithering operations are seamlessly integrated into the processing pipeline without disrupting the existing design.

View Changes

The view layer was updated to provide users with a visual and interactive interface for the dither functionality:

Button for Dither Operation:

  • A new "Dither" button was added to the graphical user interface (GUI). This button provides a direct way for users to apply the dither effect to an image.

  • When clicked, the button triggers the dither() method in the Features interface, which acts as the callback to execute the dither operation via the controller.

Split Preview Integration:

  • The dither functionality was integrated with the existing split view design in the application which allows users to preview the dithered image alongside the original image for a side-by-side comparison. This reuse ensures that new functionality benefits from consistent behavior and styling established in the application's current design.

Test cases

  • The ImageController and ViewController were tested using mock implementations of the model, consistent with the approach used in existing test cases.

  • For testing the model, an existing custom 4x4 grid was utilized to validate the functionality.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages