tito-t
Posts: 298
Joined: Thu Jan 07, 2016 5:14 pm

what means: openVG command finish() depricated?

Sun Oct 30, 2016 9:29 am

hello,
using openVG I get the compiler warning

Code: Select all

    // first OpenVG program
// Anthony Starks ([email protected])
// Adapted for paeryn's fork by paeryn
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "VG/openvg.h"
#include "VG/vgu.h"
#include "fontinfo.h"
#include "shapes.h"

int main() {
    int width, height;
    char s[3];

    // Request a window size of 600x360 with top-left at 20,20
    initWindowSize(20, 20, 600, 360);
    init(&width, &height);                  // Graphics initialization

    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, "hello, world", SerifTypeface, width / 10);  // Greetings
    End();                                  // End the picture
    WindowOpacity(128); // Make the window half opacity
                // Can now see what is behind it   
    fgets(s, 2, stdin);                     // look at the pic, end with [RETURN]
    finish();                               // Graphics cleanup
    exit(0);
}
 
// unbenannt.c:31:5: warning: ‘void finish()’ is deprecated (declared at /usr/include/shapes.h:45) [-Wdeprecated-declarations]

what does that mean? What is wrong with my code?
- Tim

User avatar
Paeryn
Posts: 2015
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: what means: openVG command finish() depricated?

Sun Oct 30, 2016 10:00 am

tito-t wrote:hello,
using openVG I get the compiler warning

Code: Select all

    // first OpenVG program
// Anthony Starks ([email protected])
// Adapted for paeryn's fork by paeryn
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "VG/openvg.h"
#include "VG/vgu.h"
#include "fontinfo.h"
#include "shapes.h"

int main() {
    int width, height;
    char s[3];

    // Request a window size of 600x360 with top-left at 20,20
    initWindowSize(20, 20, 600, 360);
    init(&width, &height);                  // Graphics initialization

    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, "hello, world", SerifTypeface, width / 10);  // Greetings
    End();                                  // End the picture
    WindowOpacity(128); // Make the window half opacity
                // Can now see what is behind it   
    fgets(s, 2, stdin);                     // look at the pic, end with [RETURN]
    finish();                               // Graphics cleanup
    exit(0);
}
 
// unbenannt.c:31:5: warning: ‘void finish()’ is deprecated (declared at /usr/include/shapes.h:45) [-Wdeprecated-declarations]

what does that mean? What is wrong with my code?
It's not an OpenVG function, it's one of libshapes'. In my latest version of ajstarks' library I deprecated a few function names to give some consistency to function name usage. There were several functions that started with lower case letters whilst the majority start capitalised. Most of the new versions just have the initial letter capitalised (I think only init and finish changed more becoming InitShapes and FinishShapes). The deprecation warning is just that, a warning that in the future the old name will be removed. At the moment you can use either the old name or the new name.

I just checked the readme, it looks like I forgot to mention the name changes (I probably edited the wrong version on my PC so it didn't get updated). You can see the function name changes by looking at the shapes.h file, after each block of deprecated functions the new names are listed.

So finish() is now called FinishShapes().
<Edit> Fixed new name of finish.
Last edited by Paeryn on Sun Oct 30, 2016 10:16 am, edited 1 time in total.
She who travels light — forgot something.

tito-t
Posts: 298
Joined: Thu Jan 07, 2016 5:14 pm

Re: what means: openVG command finish() depricated?

Sun Oct 30, 2016 10:06 am

thank you very much for your reply!

but now I get the error
unbenannt.c:31:12: error: ‘Finish’ was not declared in this scope

On your github site there indeed is still the lower case finsh in the examples.
Also the new Dot() function has not been mentioned at the start page AFAICS.
It would be very much appreciatable if you would wish to update your lib tutorial and examples too! 8-)
- Tim

User avatar
Paeryn
Posts: 2015
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: what means: openVG command finish() depricated?

Sun Oct 30, 2016 10:13 am

tito-t wrote:thank you very much for your reply!

but now I get the error
unbenannt.c:31:12: error: ‘Finish’ was not declared in this scope

On your github site there indeed is still the lower case finsh in the examples.
Also the new Dot() function has not been mentioned at the start page AFAICS.
It would be very much appreciatable if you would wish to update your lib tutorial and examples too! 8-)
Oops, sorry, that sbould be FinishShapes().

Dot() is listed in the readme, right at the end of the Shapes section and just before the Text & Images section.
She who travels light — forgot something.

tito-t
Posts: 298
Joined: Thu Jan 07, 2016 5:14 pm

Re: what means: openVG command finish() depricated?

Sun Oct 30, 2016 10:19 am

thank you very much, now this compiles without neither (or do you say in English: either?) moaning: ;)

Code: Select all

// first OpenVG program
// Anthony Starks ([email protected])
// Adapted for paeryn's fork by paeryn
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "VG/openvg.h"
#include "VG/vgu.h"
#include "fontinfo.h"
#include "shapes.h"

int main() {
    int width, height;
    char s[3];

    // Request a window size of 600x360 with top-left at 20,20
    InitWindowSize(20, 20, 600, 360);
    InitShapes(&width, &height);                  // Graphics initialization

    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, "hello, world", SerifTypeface, width / 10);  // Greetings
    End();                                  // End the picture
    WindowOpacity(128); // Make the window half opacity
                // Can now see what is behind it   
    fgets(s, 2, stdin);                     // look at the pic, end with [RETURN]
    FinishShapes();                               // Graphics cleanup
    exit(0);
}
- Tim

tito-t
Posts: 298
Joined: Thu Jan 07, 2016 5:14 pm

Re: what means: openVG command finish() depricated?

Sun Oct 30, 2016 10:27 am

ps,
I actually expected to read about Dot() in the section Shapes (i.e., presumably at the top of it)...:

https://github.com/paeryn/openvg/
Shapes

void Line(VGfloat x1, VGfloat y1, VGfloat x2, VGfloat y2)

Draw a line between (x1, y1) and (x2, y2).

void Rect(VGfloat x, VGfloat y, VGfloat w, VGfloat h)

Draw a rectangle with its origin (lower left) at (x,y), and size is (width,height).

void Roundrect(VGfloat x, VGfloat y, VGfloat w, VGfloat h, VGfloat rw, VGfloat rh)

Draw a rounded rectangle with its origin (lower left) at (x,y), and size is (width,height).
The width and height of the corners are specified with (rw,rh).

void Polygon(VGfloat *x, VGfloat *y, VGint n)

Draw a polygon using the coordinates in arrays pointed to by x and y. The number of coordinates is n.

void Polyline(VGfloat *x, VGfloat *y, VGint n)

Draw a polyline using the coordinates in arrays pointed to by x and y. The number of coordinates is n.

void Circle(VGfloat x, VGfloat y, VGfloat r)

Draw a circle centered at (x,y) with radius r.

void Ellipse(VGfloat x, VGfloat y, VGfloat w, VGfloat h)

Draw an ellipse centered at (x,y) with radii (w, h).

void Qbezier(VGfloat sx, VGfloat sy, VGfloat cx, VGfloat cy, VGfloat ex, VGfloat ey)

Draw a quadratic bezier curve beginning at (sx, sy), using control points at (cx, cy), ending at (ex, ey).

void Cbezier(VGfloat sx, VGfloat sy, VGfloat cx, VGfloat cy, VGfloat px, VGfloat py, VGfloat ex, VGfloat ey)

Draw a cubic bezier curve beginning at (sx, sy), using control points at (cx, cy) and (px, py), ending at (ex, ey).

void Arc(VGfloat x, VGfloat y, VGfloat w, VGfloat h, VGfloat sa, VGfloat aext)

Draw an elliptical arc centered at (x, y), with width and height at (w, h). Start angle (degrees) is sa, angle extent is aext.

Outlined versions of above shapes (omitting the need to set a transparent fill)

void RectOutline(VGfloat x, VGfloat y, VGfloat w, VGfloat h)
void RoundrectOutline(VGfloat x, VGfloat y, VGfloat w, VGfloat h, VGfloat rw, VGfloat rh)
void CircleOutline(VGfloat x, VGfloat y, VGfloat r)
void EllipseOutline(VGfloat x, VGfloat y, VGfloat w, VGfloat h)
void ArcOutline(VGfloat x, VGfloat y, VGfloat w, VGfloat h, VGfloat sa, VGfloat aext)
void QbezierOutline(VGfloat sx, VGfloat sy, VGfloat cx, VGfloat cy, VGfloat ex, VGfloat ey)
void CbezierOutline(VGfloat sx, VGfloat sy, VGfloat cx, VGfloat cy, VGfloat px, VGfloat py, VGfloat ex, VGfloat ey)
Last edited by tito-t on Sun Oct 30, 2016 11:30 am, edited 1 time in total.
- Tim

User avatar
Paeryn
Posts: 2015
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: what means: openVG command finish() depricated?

Sun Oct 30, 2016 10:39 am

tito-t wrote:thank you very much, now this compiles without neither (or do you say in English: either?) moaning: ;)
Without either moaning or with neither moaning. ;)

I'll get the readme updated soon (there are some more minor alterations planned so it will get done with that).
She who travels light — forgot something.

tito-t
Posts: 298
Joined: Thu Jan 07, 2016 5:14 pm

Re: what means: openVG command finish() depricated?

Sun Oct 30, 2016 11:13 am

Image

BTW,
InitShapes and FinishShapes are much better and far more comprehensible than the former
init
finish
which are really very much ambiguous by their meanings!

8-)
- Tim

Return to “OpenVG”

Who is online

Users browsing this forum: No registered users and 2 guests