You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
So the primary goal of this plugin is not to simply read bitmaps and provide an API to access the pixel values. It's to facilitate things like this http://forum.sa-mp.com/showthread.php?t=516560 and the API should provide a simple and optimised way to do that leaving Pawn to do as little work as possible.
I'm thinking there should be the standard open and close functions that allocate and free a bitmap.
While it's in memory, the plugin should process the data in some way (off thread probably?) to build something akin to an index so picking pixels based on colour is fast. The kinds of images this plugin will work well with are flat images of the world map with very few colours (like on the link above). So I'm thinking of a pixel sorter style algorithm with buckets for each colour that map to XY coordinates.
Possible API:
PointFromColour(int colour)
PointsFromColour(int colour, int dest[], int max)
If these operations do turn out to be slow, I'm thinking of a streaming asynchronous API that uses Pawn callbacks when data is available:
PointsFromColour(int colour, string callback)
which would call callback either for each pixel or a group of pixels of a predefined size
Still needs ironing out, feedback appreciated!
The text was updated successfully, but these errors were encountered:
I suggest having the open function end with varargs for the colours whose data (position) you want to extract, like open(filename [[[, colour1], colour2], ...]) to make caching more efficient.
Yes that would make sense, and no args would result in all colours being cached I guess.
I say that because I have an image that literally only has 4 colours in it, white and 3 shades of green for 3 different types of trees. I know the colours already so I wouldn't need to specify them again.
This could also be used to assert if the colours actually exist in the image. If I specify Red Green and Blue but there are no Blue pixels, the open function could return some nonzero code.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
So the primary goal of this plugin is not to simply read bitmaps and provide an API to access the pixel values. It's to facilitate things like this http://forum.sa-mp.com/showthread.php?t=516560 and the API should provide a simple and optimised way to do that leaving Pawn to do as little work as possible.
I'm thinking there should be the standard
open
andclose
functions that allocate and free a bitmap.While it's in memory, the plugin should process the data in some way (off thread probably?) to build something akin to an index so picking pixels based on colour is fast. The kinds of images this plugin will work well with are flat images of the world map with very few colours (like on the link above). So I'm thinking of a pixel sorter style algorithm with buckets for each colour that map to XY coordinates.
Possible API:
PointFromColour(int colour)
PointsFromColour(int colour, int dest[], int max)
If these operations do turn out to be slow, I'm thinking of a streaming asynchronous API that uses Pawn callbacks when data is available:
PointsFromColour(int colour, string callback)
callback
either for each pixel or a group of pixels of a predefined sizeStill needs ironing out, feedback appreciated!
The text was updated successfully, but these errors were encountered: