Java绘图代写 | Game Engines and Graphics 2021 Assignment 1

本次澳洲代写是Java绘图分析的一个assignment

Assignment Specification

In this assignment, you will be required to implement some of the algorithms that we have discussed in lectures.
You will need to write a generic frame buffer class that is able to represent images and display them in your
application. Using this frame buffer class, you will need to implement the ability to draw pixels, lines, circles,
templates and filled primitives without using any existing graphics libraries. The only existing capability
which you are allowed to use is that which takes your image and displays it to the screen – otherwise you must
implement all the 2D graphics functions yourself. For other non-graphics functions, such as sorting a list or
writing to a disk, you may use existing libraries for your implementation. You can use Java Swing for the User
Interface elements but should not use any other external libraries or NetBeans.

Requirements

You are required to implement a drawing program that is written in Java. You should not use any other
languages for this assignment.

Your program must be able to read a command file supplied at start up and then render the specified primitives
into your frame buffer class. I provide some sample input tiles that your 2D engine should be able to render.

You must implement the frame buffer class and all primitive rendering operations yourself, using no other
libraries or classes to assist you. You may only use other classes to display the final frame buffer to the window,
and to perform general I/O operations such as reading the text file and printing out any debugging information.
You may not use code from any other sources – you must write everything yourself.
You must implement a parser that is able to read in the simple configuration files and render them to the display
(some base code is provided to assist with this).

Command file format

The command files that must be read by your program are based on a simple text format to make it easy to
implement. Each command is represented as a command followed by the required arguments, using one or more
space characters (or a comma in some cases) as a separator, and a new line character to end the command.

Anything after a # character should be ignored to the end of the line as a comment. Every command is only one
line long.

As each command is parsed, you should execute the command by drawing the primitive to the frame buffer, and
then display it immediately so the user can see the output as it is being assembled. You should also print out a
line of debugging to the console showing the operation of the program and what operation it has just performed.
When the end of the file is reached the program is complete and should wait for the user to close down the
program. Note the each pixel is using RGB565 encoding I.e. 5bits for Red (0-31), 6 bits for Green (0-63) and 5
bits for blue (0-31). Here are the commands that you are required to implement:

INIT [width] [height]
This will always be the first command in the file. It specifies the dimensions of the frame buffer required.

POINT [xc] [yc] ([R],[G],[B])
Draws a single pixel at (xc,yc) using the specified (R,G,B) colour. You need to complete the functionality for
this function

LINE_FLOAT [x1] [y1] [x2] [y2] ([R],[G],[B])
Draws a line from (x1,y1) to (x2,y2), using the specified (R,G,B) colour. This can use floats for the calculation
i.e y=mx+c.

LINE [x1] [y1] [x2] [y2] ([R],[G],[B])
Draws a line from (x1,y1) to (x2,y2), using the specified (R,G,B) colour. This should use Bresenham’s line
algorithm.

OUTLINE_POLYGON [x1] [y1] [x2] [y2] … [xN] [yN] ([R],[G],[B])
Draws an outline polygon with vertices (x1,y1), (x2,y2), … (xN, yN) using the specified RGB colour. Note that
there may be an infinite number of vertices specified, at any arbitrary location.

FILL_POLYGON [x1] [y1] [x2] [y2] … [xN] [yN] ([R],[G],[B])
Draws a filled polygon with vertices (x1,y1), (x2,y2), … (xN,yN) using the specified RGB colour. Note that
there may be an infinite number of vertices specified. It should be possible to render polygons that have
degenerate or inline vertices without experiencing problems. The polygon may be convex or concave, and edges
may cross over each other. When filling the polygon, you should use the odd-even rule to decide on which parts
to be filled.

OUTLINE_CIRCLE [xc] [yc] [radius] ([R],[G],[B])
Draws an outline circle centred about the point (xc,yc) with the specified radius (note that radius is half the
diameter). The specified RGB colour should be used for the drawing operation.

FILL_CIRCLE [xc] [yc] [radius] ([R],[G],[B])
Draws a filled circle centred about the point (xc,yc) with the specified radius (note that radius is half the
diameter). The specified RGB colour should be used for the drawing operation.

***THIS METHOD IS PROVIDED***
PAUSE [msec]
Pause the processing of the configuration file for the specified number of milliseconds. This is used to slow the
program down so that the assembly of the primitives can be observed more easily.

***THIS METHOD IS PROVIDED***
SAVE [filename.bmp]
Take the current frame buffer and save it to the specified output file. You can find information via Google on
how to implement a BMP file, which is simply a header followed by the 30-bit raw frame buffer data. Your
BMP file should at least be viewable using the Windows file explorer. Be careful to make sure you write the
width, height, and stride values correctly for all possible image sizes. You may either use a library to achieve
this or write out the raw binary file yourself.

Read Pixel Colours

Implement functions to retrieve the red, green or blue component of a pixel’s colour. You MUST use bitwise
operations and a mask to retrieve the values. Function definitions are provided for getRed [xc] [yc], getGreen
[xc] [yc] and getBlue [xc] [yc]

LOAD_PNG [filename.png] (Extension)
This method allows you to load a png file, extract its pixel data and store it in your own pixel buffer. You may
use existing java libraries to help with loading the file. The method should incorporate the alpha value included
in the PNG pixels to support transparency.


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: itcsdx@outlook.com  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论