Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Filling color crosses the boundry #12

Open
Quamber opened this issue Mar 25, 2014 · 19 comments
Open

Filling color crosses the boundry #12

Quamber opened this issue Mar 25, 2014 · 19 comments

Comments

@Quamber
Copy link

Quamber commented Mar 25, 2014

Hi Chintan,

i checked the issues for this repo and solved some of my problems but unable to found solution for an issue that i am facing.

The issue is

I am filling colors to some of the images in UIImage. I do have checked the points for filling is correct but when i do fill the images. The outer side or the empty pixel are of the image gets random filling.

Foo

@Quamber
Copy link
Author

Quamber commented Mar 25, 2014

here is another sample for the issue i am facing.
Foo

@drmaxmad
Copy link

Facing the same issue..

@Chintan-Dave
Copy link
Owner

Right now I have one assumption that may last pull cause this problem.

You can check this here : https://github.com/Chintan-Dave/UIImageScanlineFloodfill/pull/11/files

Undo this file changes and see what happen. Let me know about this.

@Quamber
Copy link
Author

Quamber commented Mar 25, 2014

okay i will comment after completing this. but i have already checked this repo about 1.5 months ago and faced the same issue. however this pull is 14 days old.

@Quamber
Copy link
Author

Quamber commented Mar 25, 2014

The pixels in that area are empty . Should i create a tag for this repo on StackOverFlow?

@Chintan-Dave
Copy link
Owner

I am not getting what is "empty". You mean transparent?

@Quamber Quamber closed this as completed Mar 25, 2014
@Quamber Quamber reopened this Mar 25, 2014
@Quamber
Copy link
Author

Quamber commented Mar 25, 2014

Yes transparent .. check this sample image http://i1341.photobucket.com/albums/o750/Quamber_Ali/circle4_zpsf0e3b7af.png

@Quamber
Copy link
Author

Quamber commented Mar 26, 2014

Dear Chintan, I tried reverting to pull # 10 and then check the issue still exists. Please Help..

@Quamber
Copy link
Author

Quamber commented Mar 27, 2014

Did you checked this.?

@Chintan-Dave
Copy link
Owner

Right now I am busy in other work so can't solve this. You can try one thing. Find values(RGBA) for transparent colour and put condition according to that.

@drmaxmad
Copy link

Hi Chintan,
What you have suggested would take little time for us as we need to understand your algorithm completely. we have tried this already. If you can make change or point us to right function it will be very helpful.

@Quamber
Copy link
Author

Quamber commented Mar 27, 2014

Chintan, i tried to put old alpha on the new one so that the transparent remains transparent. but still of no use. Should i send the changes classes ? Also that if you about these bugs and are unable to resolve please let me know.

@drmaxmad
Copy link

Hi Chintan, I have resolved the issue with simple memset() function after the malloc() call. It came out exactly what i expected, due to limited memory available on iphone / ipad (specially simulator) i suspected that malloc() may allocate memory in heap where there is junk data (from last to floodfill malloc call) so i simply set every pixel (data in memory ) to 0 before drawing the image in context. Under my testing it is working smoothly. I have forked (accidentally) your code and will update it soon with complete description.

@ambujshukla
Copy link

Hi @drmaxmad ....How you used this "memset() " function...Plz tell me....

@drmaxmad
Copy link

Hi,
I used it set the allocated memory to 0, like memset (*data, 0, size_of_data)

@ambujshukla
Copy link

Ok..thnx a lot...:)

@bismasaeed00
Copy link

@drmaxmad memset comment help me a lot but it took some time to figure out how to use that function. I am adding the exact line of code here. Search for malloc and place the below line after that.
memset (imageData, 0, height_width_4);

@Cu-Toof
Copy link

Cu-Toof commented Dec 7, 2017

@bismasaeed00 I added func memset:
unsigned char *imageData = malloc(height * width * 4); memset(imageData, 0, height * width * 4);
But issue still isn't solved and crash when I touch outside image:
screen shot 2017-12-07 at 15 09 54

Could you please tell me a solution for it?
thanks,

@drmaxmad
Copy link

drmaxmad commented Dec 16, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants