Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Need to know how to read a single pixel color from an image \ and BTW how to draw a filled polygon

Author
Message
Ermesjr
User Offline
Joined: 11th Feb 2021
Location:
Posted: 11th Feb 2021 22:46
hi there,

in DBPRO, it was easy to get the color of a pixel of the screen or image, using coords x,y

i don't see how to make this in AppGameKit,

and BTW, how to make a flilled 2d polygon.

many thanks,

Ermes design.
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Feb 2021 02:33
Pixel color

If you could explain a bit more about the context of the polygon i may be able to help
Ermesjr
User Offline
Joined: 11th Feb 2021
Location:
Posted: 12th Feb 2021 11:08
Thanks blink0k

well,for example, i would like to make a shape in 2d, not a pasted image but generated like this: " polygon x1,y1,x2,y2,x3,y3,x4,y4,color, filled flag "

for pixel color, i'm used to make images with a number of color to be picked from my program, and use it as info for whatever i'm in need of. like this: "color=pickcolor(imageid,x,y)"

dbpro has this commands, even for the polygon, with a plugin.

i've to tell you i'm an old user here, since dbclassic, maybe someone remenber my games "sunday drivers", "sunday panzers", etc.... if not, nevermid.
for me it's a long time away from coding, about 4 years, i see im'getting old and dumb, but i'm looking to make myself fine with AppGameKit, and sorry for broke english it's not my first language i'm from italy.

BTW, i've not found Read / Data statment in AppGameKit, but this is another topic i think.

Thank you.
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Feb 2021 23:28
You could do that polygon thing with an object memblock but i wouldn't recommend doing it every frame though. it would be super slow
Ermesjr
User Offline
Joined: 11th Feb 2021
Location:
Posted: 13th Feb 2021 13:30
Thanks, need to work 'bout this.
n00bstar
17
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 13th Feb 2021 14:00
@ErmesJr

You'll find that AppGameKit kind of forces you to write a lot of boilerplate code to achieve things that were built into DB, Blitz and the like. It's a bit of a bummer at first, but you'll get used to it. The trade off is that AppGameKit is a bit more versatile in the way it works. There's definitely an adaptation period. You'll probably run into problems with the way sprites work too, it's quite different from the old way of just drawing stuff to a buffer and flipping it....it's kind of all done for you automatically and it's a bit of a pain at first

Pixel commands are out, unfortunately, and you will have to code those yourself. Also unfortunate is that these commands will end up being much slower than what you had in DB because you need to use memblocks to make them work.

Read/Data is also out and there's no quick and dirty way to replace those right into your code. Personally, I use CSV files instead. They're easy to read in code, and can be edited with any spreadsheet software.
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Ermesjr
User Offline
Joined: 11th Feb 2021
Location:
Posted: 16th Feb 2021 14:47
Thanks,

i'm really disappointed because my toughts were AppGameKit was a sort of DBPro 2 but it's another thing. No sense about use 200 line of code for making something a single DBPro command can do. Very poor inheritance from BDC or DBPro,

I'm really worried about being too old for an adaptation period, about half a century... not easy to learn new concepts.

we'll see what happens, thanks dudes
PartTimeCoder
AGK Tool Maker
6
Years of Service
User Offline
Joined: 9th Mar 2015
Location: Suffolk UK
Posted: 19th Feb 2021 16:51 Edited at: 19th Feb 2021 16:52
As it happens, Not quite happy with AGK's draw system I decided to implement my own using GDI, drawing to an image, save out to temp and load back to agk as a sprite, automated within the plugin of course, I currently have basic shapes and images drawing with gradients... its looking ok IMO

IT IS NOT READY YET! BUT..........

I am making this plugin primarily for aiding me in UI development this is an example of what it can output so far ( a single image window frame with text and gradient fills)



^^ that window image is generated by the below code:


Custom polygon shapes are being added and it already GetPixel/SetPixelColor functions,

if this is something the community would also like to use for a small fee then let me know I'll put a page up (yeah soz but I have to start charging for my plugins as work, pandemic... ya know, life's hard!)

Attachments

Login to view attachments
Ermesjr
User Offline
Joined: 11th Feb 2021
Location:
Posted: 19th Feb 2021 21:09
Ah! long life to 2D draw commands!

it would be nice and useful. i like to make stuffs with 2D graphics.

thanks, Ermes
PartTimeCoder
AGK Tool Maker
6
Years of Service
User Offline
Joined: 9th Mar 2015
Location: Suffolk UK
Posted: 19th Feb 2021 23:08
OK, well I'm still working on it, I'll post a WIP thread when its close to ready and it can beta from there.
Raven
16
Years of Service
Recently Online
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 20th Feb 2021 07:04
GDI is not only old, but deprecated (with potential issues under Windows 8.x / 10.0)
On top of this... it's limited to Windows, is a Software Solution (i.e. runs on the CPU) and quite slow.

I'd personally recommend switching to https://www.libsdl.org/ (SDL), if you intend to create a 2D Drawing Library that is.
It supports all (and more) Platforms that AppGameKit does., and it integrates into whatever Native API is being used (OpenGL, Vulkan, Metal, DirectX).
Frankly I'm surprised it isn't what AppGameKit uses as it's 2D Backend... or maybe it is and they just have a very basic implementation.


Login to post a reply

Server time is: 2021-04-14 07:59:54
Your offset time is: 2021-04-14 07:59:54