Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <86y1afopik.fsf@linuxsc.com>
Deutsch   English   Français   Italiano  
<86y1afopik.fsf@linuxsc.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups: comp.lang.c
Subject: Re: filling area by color atack safety
Date: Mon, 18 Mar 2024 02:30:59 -0700
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <86y1afopik.fsf@linuxsc.com>
References: <ut3669$21eur$1@i2pn2.org> <ut4020$2s8ov$1@dont-email.me> <20240317144625.00002011@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="392b353a6389bc0498ba35815d55dc9d";
	logging-data="119735"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18n6GJVOZ+/Jc8Svom5baMw0NgIWcPwG/Y="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:ELUpQqGAtBo8oGFg+KfXfziM/Ro=
	sha1:ES2PPKvH5Q//VM3PrEz0pdGECdE=
Bytes: 2740

Michael S <already5chosen@yahoo.com> writes:

>> On 16/03/2024 04:11, fir wrote:
>>
>>> i was writing simple editor (something like paint but more custom
>>> for my eventual needs) for big pixel (low resolution) drawing
>>>
>>> it showed in a minute i need a click for changing given drawed area
>>> of of one color into another color (becouse if no someone would
>>> need to do it by hand pixel by pixel and the need to change color
>>> of given element is very common)
>>>
>>> there is very simple method of doing it - i men i click in given
>>> color pixel then replace it by my color and call the same function
>>> on adjacent 4 pixels (only need check if it is in screen at all and
>>> if the color to change is that initial color
>>>
>>> int RecolorizePixelAndAdjacentOnes(int x, int y, unsigned
>>> old_color, unsigned new_color)
>>> {
>>>   if(old_color == new_color) return 0;
>>>
>>>   if(XYIsInScreen( x, y))
>>>   if(GetPixelUnsafe(x,y)==old_color)
>>>   {
>>>   SetPixelSafe(x,y,new_color);
>>>   RecolorizePixelAndAdjacentOnes(x+1, y, old_color, new_color);
>>>   RecolorizePixelAndAdjacentOnes(x-1, y, old_color, new_color);
>>>   RecolorizePixelAndAdjacentOnes(x, y-1, old_color, new_color);
>>>   RecolorizePixelAndAdjacentOnes(x, y+1, old_color, new_color);
>>>   return 1;
>>>   }
>>>
>>>   return 0;
>>> }

[...]

> Except I don't understand why it works it all.
> Can't fill area have sub-areas that only connected through diagonal?

It is customary in raster graphics to count pixels as adjacent
only if they share an edge, not if they just share a corner.
Usually that gives better results;  the exceptions tend to need
special handling anyway and not just connecting through
diagonals.