GithubHelp home page GithubHelp logo

Comments (12)

ajstarks avatar ajstarks commented on August 20, 2024

Note that this is a vector library, and pixel-level operations are usually not done at this level.
A possible workaround is to draw a rectangle or circle with the desired dimensions.

What is your application doing?

from openvg.

tofrnr avatar tofrnr commented on August 20, 2024

it's putting a series of function values
f(x) = y
in a coordinate system, shown as (x,y)

from openvg.

ajstarks avatar ajstarks commented on August 20, 2024

I suggest, picking the right scale for your app, and use circles to represent the points. See: https://github.com/ajstarks/openvg/blob/master/go-client/vgplot/vgplot.go for an example.

from openvg.

tofrnr avatar tofrnr commented on August 20, 2024

yes, but that's too much computation IMO
no idea, but perhaps
line (x,y,x,y) would also work, but that's already too much computation, too.

from openvg.

ajstarks avatar ajstarks commented on August 20, 2024

if you know the (x,y) coordinates, just place an appropriately sized circle.

from openvg.

tofrnr avatar tofrnr commented on August 20, 2024

yes, I understood your proposal, but as I said: too much computation to do.
It's a matter of execution speed:
There are about 10000-40000 points to draw each second.

from openvg.

ajstarks avatar ajstarks commented on August 20, 2024

With that throughput requirement you will need to pre-allocate the object and reuse using low-level OpenVG calls.

from openvg.

tofrnr avatar tofrnr commented on August 20, 2024

That's supposed to be too hard to understand to me, I just wanted to put single pixels by simple pixel(x,y) API calls.

from openvg.

ajstarks avatar ajstarks commented on August 20, 2024

There is a fork of the library that pre-allocates: https://github.com/paeryn/openvg/tree/newfonts

from openvg.

tofrnr avatar tofrnr commented on August 20, 2024

thank you, But there I also can't find a pixel(x,y) API function:

extern void Translate(VGfloat, VGfloat);
    extern void Rotate(VGfloat);
    extern void Shear(VGfloat, VGfloat);
    extern void Scale(VGfloat, VGfloat);
    extern void Text(VGfloat, VGfloat, const char *, Fontinfo, int);
    extern void TextMid(VGfloat, VGfloat, const char *, Fontinfo, int);
    extern void TextEnd(VGfloat, VGfloat, const char *, Fontinfo, int);
    extern VGfloat TextWidth(const char *, Fontinfo, int);
    extern void Cbezier(VGfloat, VGfloat, VGfloat, VGfloat, VGfloat, VGfloat, VGfloat, VGfloat);
    extern void Qbezier(VGfloat, VGfloat, VGfloat, VGfloat, VGfloat, VGfloat);
    extern void Polygon(VGfloat *, VGfloat *, VGint);
    extern void Polyline(VGfloat *, VGfloat *, VGint);
    extern void Rect(VGfloat, VGfloat, VGfloat, VGfloat);
    extern void Line(VGfloat, VGfloat, VGfloat, VGfloat);
    extern void Roundrect(VGfloat, VGfloat, VGfloat, VGfloat, VGfloat, VGfloat);
    extern void Ellipse(VGfloat, VGfloat, VGfloat, VGfloat);
    extern void Circle(VGfloat, VGfloat, VGfloat);
    extern void Arc(VGfloat, VGfloat, VGfloat, VGfloat, VGfloat, VGfloat);
    extern void Image(VGfloat, VGfloat, int, int, char *);
    extern void Start(int, int);
    extern void End();
    extern void SaveEnd(char *);
    extern void Background(unsigned int, unsigned int, unsigned int);
    extern void BackgroundRGB(unsigned int, unsigned int, unsigned int, VGfloat);
    extern void init(int *, int *);
    extern void finish();
    extern void setfill(VGfloat[4]);
    extern void setstroke(VGfloat[4]);
    extern void StrokeWidth(VGfloat);
    extern void Stroke(unsigned int, unsigned int, unsigned int, VGfloat);
    extern void Fill(unsigned int, unsigned int, unsigned int, VGfloat);
    extern void RGBA(unsigned int, unsigned int, unsigned int, VGfloat, VGfloat[4]);
    extern void RGB(unsigned int, unsigned int, unsigned int, VGfloat[4]);
    extern void FillLinearGradient(VGfloat, VGfloat, VGfloat, VGfloat, VGfloat *, int);
    extern void FillRadialGradient(VGfloat, VGfloat, VGfloat, VGfloat, VGfloat, VGfloat *, int);
    extern void ClipRect(VGint x, VGint y, VGint w, VGint h);
    extern void ClipEnd();
    extern Fontinfo loadfont(const int *, const int *, const unsigned char *, const int *, const int *, const int *,
                 const short *, int, int, int);
    extern void unloadfont(Fontinfo);
    extern void makeimage(VGfloat, VGfloat, int, int, VGubyte *);
    extern void saveterm();
    extern void restoreterm();
extern void rawterm();

from openvg.

ajstarks avatar ajstarks commented on August 20, 2024

As I said, substitute pixel(x,y), with Circle(x,y,size), where size is appropriately scaled to your canvas.
you could also use a Line(x, y, x+(unit), y) where unit the the appropriate size.

You will have to determine if the throughput is sufficient for your app.

from openvg.

tofrnr avatar tofrnr commented on August 20, 2024

yes, thank you, but I assumed it was easier to have a dedicated Pixel(x,y) or Dot(x,y) API function nevertheless
(Pixel size by StrokeWidth() size )

from openvg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.