The task here is to generate an interesting image that includes all 24-bit colours. (i.e. it must have a minimum of 16M pixels). You can generate this image via a function of your choosing (according to specified parameters), or you can use some other bitmap as template. However, either way, you must ensure that the output will have a total of 224 different RGB colors.
The 117raster project from the repository grcis (GIT) serves as a basis of the solution: the underlying framework is described here.
You place your new class(es) in a separate directory, and at the end submit the solution by zipping that directory and mailing it as an attachment. Please don't interfere with the 117raster project source files: if you encounter a bug in the base classes (to be more specific, a severe bug which makes it absolutely necessary to alter the project code), please contact us immediately, and we will fix it ourselves so that all lab participants can benefit from the bugfix.
A simple 16M-color image generation algorithm is implemented as a module (see interface IRasterModule) and is located in modules/FullColor/ModuleFullColor.cs.
The demo module can work with or without an input image (a solution with a reasonable input image is more difficult - which is why you get more points for it). In the text parameter ("Param") it is possible to define the dimensions of the output image (it must have at least 16Mpix to meet the requirements!), allows switching between "slow" and "fast" image access (safe vs. unsafe), and to forcibly ignore the input image (even if the user provides one).
We recommend that you use the class ModuleFullColor class in your solution, because it runs a check at the end of the update (Update()) which determines how many different colours appear in the result image. We will not accept submissions with missing colours, as this is the basic requirement for this assignment.
In the simpler version of the problem - without using an input image - only the size of the result can be variable, but of course hast to be at least 16M pixels. If you implement different approaches (eg different algorithms / ornaments, etc.), obtain your own parameters via the "Param" field, as in previous assignments. We appreciate it when you can generate 16M-color images of different sizes, i.e. if the size is something you can change.
A much more interesting task is to try to approximate an input raster image with the result image. The input can be anything: color or black and white, large or low resolution, the only constant is that you have to calculate the output with 16M colours! You can concentrate on the approximation of the input (ie try to make the output look similar to the input) or use only some part or component of the input - only one color channel, just some detail (cut-out), etc.Regardless of what approach you use, please test your algorithm on different inputs and various "Param" settings.
Parsing parameters from the text field: You may use functions from the supporting library Util. An example is given in the pilot implementation: Util.ParseKeyValueList( param ); first breaks the text into comma-separated sections, and then searches for definitions in the form <key>=<value>. See the pilot implementation example (the function bool Util.TryParse( p, "name", ref val ) returns true if the key was found, and the val parameter is overwritten at the same time.)
A change has been made to the 117raster framework. IRasterModule.UpdateAsync() is used, so that the calculation is performed in a second thread and does not block the main application form. In addition, the user can pause a long-lasting calculation with the "Break" button.
You as programmers do not have to worry too much about this change; as before, it is still possible to only use the synchronous (blocking) function Update(). The class DefaultRasterModule class includes a sensible implementation of the asynchronous UpdateAsync() function which calls a virtual Update() in another thread. If you encounter any problems with parallelism (we are especially interested in how it will work in Linux under Mono), let us know as soon as possible. Those interested can inspect our implementation of parallelism (117raster/FormMain.cs): and if you find suggestions for improvement, we would like to read them or discuss them during the practicals.
At minimum, you have to hand in your new class - the module (the descendant of DefaultRasterModule) which contains your image creation functionality, along with any other classes that you have implemented in a separate directory. Submit the solution by zipping the entire directory, and mailing it to your tutor as an attachment. Do not interfere with the 117raster project source files - your solution has to be a stand-alone module that plugs into an unmodified 117raster framework!
The solution is due: 24. 11. 2019
6 points for a working solution,
4 points for using an input image, and
up to 5 additional points for creativity, aesthetics, etc.
Visual Studio project: 117raster
A zipped sub-directory which can be used in the 117raster project.
Copyright (C) 2019 J. Pelikán and A. Wilkie , last change: 2019-10-26 04:52:15 +0200 (Sat, 26 Oct 2019)