Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant archive_postsperpage - assumed 'archive_postsperpage' (this will throw an Error in a future version of PHP) in ..../archive/index.php on line 456
Pixel Reader [Archive] - Forums

PDA

View Full Version : Pixel Reader



Xleniz
06-13-2013, 10:42 PM
I made a "SUPER" pixel reader :[

Pros:
It can detect positions 1, position 2, position 3, and play song for each position

Cons:
It takes 0.2 to read pixel, which means, if you run fast, you wont get music.

So my question is: How to do pixelreading in fastest way, C#?
(( Im Doing bitblt right now, its faster than both lockbits and bmp getpixel ))

I found an UNSAFE Code, but I cannot get it to work:



static Color[] GetPixelColumnFast(Bitmap bmp, int x)
{
Color[] pixelColumn = new Color[bmp.Height];
BitmapData pixelData = bmp.LockBits(
new Rectangle(0, 0, bmp.Width, bmp.Height),
ImageLockMode.ReadOnly,
PixelFormat.Format32bppArgb);
unsafe
{
int* pData = (int*)pixelData.Scan0.ToPointer();
pData += x;
for (int i = 0; i < bmp.Height; ++i)
{
pixelColumn[i] = Color.FromArgb(*pData);
pData += bmp.Width;
}
}
bmp.UnlockBits(pixelData);

return pixelColumn;
}


THNX

++++ If theres a better way to detect pixels, like, minimap and compare with (?), tell me pliz.

Blood
06-15-2013, 02:02 AM
A few days ago I was using Scan Lines in Delphi 7 to make a bombermine bot for practise coding....
200~300ms to find something in the screen...
But it really sucks when you need to put every tile in a grid and tell if it is blockable or not...
Then I stopped the project because I cant find a faster way :/