Question
Convert the solution of Part IV of Assignment 4 so that it sends the output to an HTML5/SVG file called A5P1.html rather than to the
Convert the solution of Part IV of Assignment 4 so that it sends the output to an HTML5/SVG file called A5P1.html rather than to the console or stdout. You must use the sample A4P4 solution provided including its HTML5/SVG API (i.e., the functions provided to render HTML5 and SVG). To get started with this part, write the function createFile. Note in A4P4, the opacity of the circle rows ranges from 1.0 to 0.6 from left to right. The opacity of the circle rows in A5P1 must range from 0.6 to 1.0. Finally, call the SVG API function textSwipeAnimateSVG which swipes in text from the righthand side. The text SVG Text Animation must end up at the position (x,y) = (50, 255) and use the RGB color (60, 249, 237) and opacity 1.0 to draw the text message. Study the syntactically correct C program provided in iLeap in the file A5P1Template.c carefully and in detail.
CODE
#include#include #define ID0 ("") #define ID1 (" ") #define ID2 (" ") #define WINWIDTH (500) #define WINHEIGHT (300) #define FILENAME ("A5P1.html") #define FOPENERR ("fopen error %s") // prototypes int main(void); FILE* createFile(char* fnam); void prologue(FILE* ofp, char* winTabTitle, char* opening, char* col); void epilogue(FILE* ofp, char* closing, char* col); void drawHeader1HTML5(FILE* ofp, char* id, char* text, char* col); void drawParaHTML5(FILE* ofp, char* id, char* text, char* col); void openSVG(FILE* ofp, char* id, int w, int h); void closeSVG(FILE* ofp, char* id); void commentSVG(FILE* ofp, char* id, char* cmt); void fillRectSVG(FILE* ofp, char* id, int x, int y, int w, int h, int r, int g, int b, float op); void fillCircleSVG(FILE* ofp, char* id, int cx, int cy, int rad, int r, int g, int b, float op); void fillEllipseSVG(FILE* ofp, char* id, int cx, int cy, int rx, int ry, int r, int g, int b, float op); void drawShapesSVG(FILE* ofp); void drawCirclesRowSVG(FILE* ofp, char* id, int cx, int cy, int rad, int n, int r, int g, int b); int main(void) { FILE* ofp = createFile(FILENAME); if (ofp == NULL) { printf("Write createFile function "); } else { prologue(ofp, "My CSC 111 Art", "Welcome to my CSC 111 Webpage", "red"); drawShapesSVG(ofp); epilogue(ofp, "SVG is a great skill for my co-op job resume", "blue"); }//if return EXIT_SUCCESS; }//main FILE* createFile(char* fnam) { // Create a new file. // The name of the file is given in the parameter fnam // Replace with your code here return NULL; }//createFile void drawCirclesRowSVG(FILE* ofp, char* id, int cx, int cy, int rad, int n, int r, int g, int b){ // Use the function fillCircleSVG to create the SVG circles // Replace with your code }//drawCirclesRowSVG void prologue(FILE* ofp, char* winTabTitle, char* opening, char* col) { fprintf(ofp, "%s%s ", ID0, ""); fprintf(ofp, "%s%s ", ID0, ""); fprintf(ofp, "%s%s ", ID0, ""); fprintf(ofp, "%s%s ", ID1, " "); fprintf(ofp, "%s%s ", ID2, winTabTitle); fprintf(ofp, "%s%s ", ID1, " "); fprintf(ofp, "%s%s ", ID0, ""); fprintf(ofp, "%s%s ", ID0, ""); drawHeader1HTML5(ofp, ID1, opening, col); }//prologue void epilogue(FILE* ofp, char* closing, char* col) { drawParaHTML5(ofp, ID1, closing, col); fprintf(ofp, "%s%s ", ID0, ""); fprintf(ofp, "%s%s ", ID0, ""); }//epilogue void openSVG(FILE* ofp, char* id, int w, int h) { fprintf(ofp, "%s ", id); }//closeSVG void fillRectSVG(FILE* ofp, char* id, int x, int y, int w, int h, int r, int g, int b, float op) { fprintf(ofp, "%s", id, x, y, w, h,r, g, b, op); }//fillRectSVG void fillCircleSVG(FILE* ofp, char* id, int cx, int cy, int rad, int r, int g, int b, float op) { fprintf(ofp, "%s ", id, cx, cy, rad, r, g, b, op); printf("op[%d]=%.1f_ ", cx, op); }//fillCircleSVG void fillEllipseSVG(FILE* ofp, char* id, int cx, int cy, int rx, int ry, int r, int g, int b, float op) { fprintf(ofp, "%s ", id, cx, cy, rx, ry, r, g, b, op); }//fillEllipseSVG void defAnimateSwipeSVG(FILE* ofp, char* id, char* link, int f, int t, int b, int d) { fprintf(ofp, "%s ", id); fprintf(ofp, "%s ", id); }//defAnimateSwipeSVG void textSwipeAnimateSVG(FILE* ofp, char* id, char* txt, int x, int y, int r, int g, int b, float op){ defAnimateSwipeSVG(ofp, ID2, "defAnimateSwipeSVG", 500, 50, 0, 5); fprintf(ofp, "%s", id, link, f, t, b, d); fprintf(ofp, "%s %s ", id, "defAnimateSwipeSVG", x, y, r, g, b, op, txt); printf("%s_x=%d_y=%d_r=%d_g=%d_b=%d_op=%.1f_ ", txt, x, y, r, g, b, op); }//textSwipeAnimateSVG void commentSVG(FILE* ofp, char* id, char* cmt) { fprintf(ofp, "%s ", id, cmt); }//commentSVG void drawHeader1HTML5(FILE* ofp, char* id, char* text, char* col) { fprintf(ofp, "%s%s
", id, col, text); }//drawHeader1HTML5 void drawParaHTML5(FILE* ofp, char* id, char* text, char* col) { fprintf(ofp, "%s%s
", id, col, text); }//drawParaHTML5 void drawShapesSVG(FILE* ofp) { commentSVG(ofp, ID1, "Outline SVG viewbox"); openSVG(ofp, ID1, WINWIDTH, WINHEIGHT); commentSVG(ofp, ID1, "Define and paint SVG view box"); fillRectSVG(ofp, ID2, 0, 0, WINWIDTH, WINHEIGHT, 245, 245, 220, 1.0); commentSVG(ofp, ID2, "Draw SVG shapes"); fillCircleSVG(ofp, ID2, 50, 150, 40, 60, 249, 237, 0.8); fillRectSVG(ofp, ID2, 130, 120, 100, 60, 0, 255, 0, 0.7); fillEllipseSVG(ofp, ID2, 370, 150, 100, 40, 255, 0, 255, 0.6); commentSVG(ofp, ID2, "SVG draw circles rows"); drawCirclesRowSVG(ofp, ID2, 50, 50, 50, 5, 255, 0, 0); drawCirclesRowSVG(ofp, ID2, 50, 250, 50, 5, 0, 0, 255); commentSVG(ofp, ID2, "SVG animation"); textSwipeAnimateSVG(ofp, ID2, "SVG Text Animation", 50, 255, 60, 249, 237, 1.0); closeSVG(ofp, ID1); }//drawShapesSVG
Assignment 4 solution is irrelevant. Only complete FILE* createFile and drawCirclesRowSVG function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started