Skip to content

Instantly share code, notes, and snippets.

@wararyo
Created March 12, 2015 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wararyo/b2ebc87cb321623c3c1d to your computer and use it in GitHub Desktop.
Save wararyo/b2ebc87cb321623c3c1d to your computer and use it in GitHub Desktop.
test code for OpenVG on Raspberry Pi using https://github.com/ajstarks/openvg
// first OpenVG program
// Anthony Starks (ajstarks@gmail.com)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <VG/openvg.h>
#include <VG/vgu.h>
#include "fontinfo.h"
#include "shapes.h"
#include "MTLmr3m.inc"
Fontinfo Font_MTLmr;
int main(int argc, char *argv[]) {
int width, height;
char s[3];
init(&width, &height); // Graphics initialization
Font_MTLmr = loadfont(MTLmr_glyphPoints,
MTLmr_glyphPointIndices,
MTLmr_glyphInstructions,
MTLmr_glyphInstructionIndices,
MTLmr_glyphInstructionCounts,
MTLmr_glyphAdvances,
MTLmr_characterMap,
MTLmr_glyphCount);
Start(width, height); // Start the picture
Background(0, 0, 0); // Black background
Fill(44, 77, 232, 1); // Big blue marble
Circle(width / 2, 0, width); // The "world"
Fill(255, 255, 255, 1); // White text
TextMid(width / 2, (height / 2), argv[1], Font_MTLmr, width / 10); // Greetings
End(); // End the picture
fgets(s, 2, stdin); // look at the pic, end with [RETURN]
finish(); // Graphics cleanup
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment