-
-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[KHA FEATURE THOUGHT] replace graphics.fillRect with graphics.fill #214
Comments
I like skia (https://skia.org/) api : https://skia.org/user/api |
I would also prefer the skia api. Plus it's easier to implement. |
Having drawings functions like the skia would be nice in Kha. But I think Kha could put this (and other features like creative coding as in #212) in separate repos, like "official kha extensions", to mantain the main repo small. |
but if you get what i mean. whilst having a function that does a lot is alright to some degree. but if you can esily just say put in rather than just that it has this extesibility too it. plus easily for implementing changes with having to damage other code. if you get me? ;) UPDATE |
Well, are you ok with the skia method of doing that? |
aye. i guess so. |
Oki, the skia method does that too, so I'll go for that. |
its 'simplicity with power' that i think would be good. because even though kha can make really awesome things, its making it approachable to new users. so they can look at something and understand it well actually, that could be the slogan - 'simplicity with power' ;) |
Always trying to do simplicity ala http://www.infoq.com/presentations/Simple-Made-Easy ;) |
lewislepton might want to experiment with GraphicsKha experiments of mine on github it has quite a bit of drawing stuff but it's still experimental. |
This is the design of what I'm implementing in the Graphics2 api: var g = framebuffer.g2;
g.begin(true);
// Applied when style is not specified
g.style.fill = true;
g.style.fillColor = Color.fromFloats(r, g, b, a);
g.style.stroke = true;
g.style.strokeColor = Color.Black;
g.style.strokeWeight = 1.0;
//...
var style = new Style();
// Drawing
g.rect(x, y, width, width);
g.push();
g.translate(x, y);
g.arc(x, y, width, height, startAngle, endAngle, style);
var transform = g.pop();
g.scale(3.0, 3.0);
g.translate(32, 0);
g.ellipse(x, y, width, height);
g.setTransform(transform);
g.ellipse(x, y, width, height, style);
g.setTransform(transform);
g.rotate(Math.PI);
g.triangle(x1, y1, x2, y2, x3, y3);
g.resetTransform();
g.beginShape(TRIANGLES);
g.vertex(x1, y1);
g.vertex(x2, y2);
g.vertex(x3, y3);
g.vertex(x4, y4);
g.vertex(x5, y5);
g.vertex(x6, y6);
g.endShape();
g.line(x1, y1, x2, y2);
g.quad(x1, y1, x2, y2, x3, y3, x4, y4);
g.end(); It's begin easy to implement for all targets because I made the underling code more generic. |
@hammeron-art don't forget the rounded rectangles :) This will be open source? Kha needs a good drawing lib like flash graphics. |
@RafaelOliveira It's for Kha itself. It isn't a full featured lib but shape drawing like html5 canvas. |
Ah, with style objects, looks good. PS: Graphics3 will be an OpenGL 1 style api to support 3D on older systems. No relation to Graphics2. |
I'm not sure how OpenGL 1 worked but as I see it the only difference between 2d and 3d drawing is that the latter takes z positions. Internally the transformation matrix, vertex buffer building, shaders, etc, is the same as Graphics2. |
Graphics2 has no vertex buffers - only internally when implemented on top of Graphics4. Graphics3 will have them, will be like Graphics4 minus shaders plus more state. |
To get more into the thinking behind that: Kha is a hardware/software abstraction library, the only reason for graphics2 to exist is to abstract away typical 2D apis like . There are no systems which provide 3D apis in that style as their lowest level graphics api so no need for Kha to do anything like that. |
Oh, I see. I was thinking in a primitive drawing thing but the goal is a 3D api. |
so i was just thinking about the api/code for kha, things that could be made more simpler. and one that points out to me is the use of 2 rectangle drawing function.
whilst i know that drawRect has a strength, thats fine.
but it would be good to have just a fill function, that will replace the fillRect. so like the .color. we only have to put up above the code
so rather than having this
or having this
so in essence we only use 1 for drawing rectangle technique
anyhow, hope that load of typing made sense ;)
The text was updated successfully, but these errors were encountered: