Question: program in C + + with inline assembly ( needs to be . cpp source code with embedded assembly ) The problem: please use my
program in C with inline assembly needs to be cpp source code with embedded assembly
The problem:
please use my bit map creation program as reference:
#include
#include
#include
using namespace std;
#define IMAGESIZE
void drawLineint x int y int x int y char bitsIMAGESIZEIMAGESIZE;
int main
Initializes the bitmap array
char bitsIMAGESIZEIMAGESIZE;
for int i ; i IMAGESIZE; i
for int j ; j IMAGESIZE; j
bitsij staticcast IMAGESIZE i;
User input
cout "Enter two pairs of point coordinates in the range of IMAGESIZE : endl;
int x y x y;
cin x y x y;
Checks if input values are within range
if x x IMAGESIZE y y IMAGESIZE
x x IMAGESIZE y y IMAGESIZE
cout "Value out of range, ending." endl;
return ;
drawLinex y x y bits;
ofstream bmpOutoutputbmp ios::out ios::binary;
if bmpOut
cout "Could not open file, ending." endl;
return ;
BITMAPFILEHEADER bmfh;
BITMAPINFOHEADER bmih;
RGBQUAD colors;
bmfhbfType xd;
bmfhbfReserved;
bmfhbfReserved;
bmfhbfOffBits sizeofbmfh sizeofbmih sizeofcolors;
bmfhbfSize bmfhbfOffBits IMAGESIZE IMAGESIZE; Actual size of the bitmap data
bmih.biSize sizeofBITMAPINFOHEADER;
bmih.biWidth IMAGESIZE;
bmih.biHeight IMAGESIZE;
bmih.biPlanes ;
bmih.biBitCount ; bit grayscale
bmih.biCompression BIRGB;
bmih.biSizeImage ;
bmih.biXPelsPerMeter ; Standard resolution
bmih.biYPelsPerMeter ;
bmih.biClrUsed ; colors used
bmih.biClrImportant ;
Sets Bitmap with a grayscale background
for int i ; i ; i
colorsirgbBlue colorsirgbGreen colorsirgbRed i;
colorsirgbReserved ;
Write headers to the file
bmpOut.writereinterpretcast&bmfh sizeofbmfh;
bmpOut.writereinterpretcast&bmih sizeofbmih;
bmpOut.writereinterpretcastcolors sizeofcolors;
Write bitmap data
bmpOut.writereinterpretcastbits IMAGESIZE IMAGESIZE;
bmpOut.close;
Opens bitmap in Windows Paint
systemmspaint output.bmp;
return ;
Draws line
void drawLineint x int y int x int y char bitsIMAGESIZEIMAGESIZE
int dx absx x;
int dy absy y;
int sx x x : ;
int sy y y : ;
int err dx dy;
while true
Calculate brightness based on distance from the start point
float brightness f floatdx absx x dx;
bitsyx staticcastbrightness; Set pixel to grayscale value
Increase line width by pixels
for int i ; i ; i
if y i IMAGESIZE
bitsy ix staticcastbrightness;
if y i
bitsy ix staticcastbrightness;
if x x && y y break;
int e err;
if edy err dy; x sx;
if e dx err dx; y sy;
use this program to to draw lines in a bit map which provide a geographic map outline. Please adjust code so that the line calculating part is in inline assembly
After creating the basic bit map by pixels your program will read a text file which contains pairs of longitude and latitude numbers in that order These values will be positive, and will be within the following dimensions:
North maximum latitude
West maximum longitude
South minimum latitude
East minimum longitude
For longitude, maximum and minimum are relative to their absolute value.
here is the text file: DCBoundaryFile.txt
District of Columbia
