Closed Wither362 closed 1 year ago
Nice! I'll take a look at that later, rn I'm trying to make CI send you a url of the images generated from your PRs. Then, you could add a test, and it would display there.
Nice! I'll take a look at that later, rn I'm trying to make CI send you a url of the images generated from your PRs. Then, you could add a test, and it would display there.
Thanks!
How do I move a pixel from coordinates (x, y)
to coordinates (x2, y2)
?
I need it to finish this…
I found two solutions:
(x, y)
and paint a new pixel with the same color at (x2, y2)
(I can’t find out the functions I need to use)movePixel might already exist as copyPixel, but I'm not sure. A quick solution rn is to do setPixel(newX, newY, getPixel(oldX, oldY))
movePixel might already exist as copyPixel, but I'm not sure. A quick solution rn is to do
setPixel(newX, newY, getPixel(oldX, oldY))
Isn't setPixel(x, y, color)
to change the color of the specified pixel?
I want to move the pixel, but it might work also…
movePixel might already exist as copyPixel, but I'm not sure. A quick solution rn is to do
setPixel(newX, newY, getPixel(oldX, oldY))
Isn't
setPixel(x, y, color)
to change the color of the specified pixel?I want to move the pixel, but it might work also…
by moving do you mean switching between the pixels? setPixel(..., getPIxel(...)) simply "duplicates" the pixel at the old position to the new one. did you mean something else?
or maybe you mean moving the pixel at the old position to the new position, and resetting it's color to the default (0x00000000)
or maybe you mean moving the pixel at the old position to the new position, and resetting it's color to the default (0x00000000)
Yeah! That’s what I mean!
ok! ill implement this as movePixel() and add an extra argument for the reset color:
movePixel(fromX, fromY, toX, toY, ?oldPixelColor)
oh, that probably means implementing moveSafePixel and moveFloatingPixel
ok! ill implement this as movePixel() and add an extra argument for the reset color:
movePixel(fromX, fromY, toX, toY, ?oldPixelColor)
That sounds good! Maybe I can help you with the function code, but I’m not sure…
oh, that probably means implementing moveSafePixel and moveFloatingPixel
Yeah… 😅
those shouldn't be hard to implement, just the same function but doesnt throw/gets different type params.
im also gonna implement moveUnsafePixel for that extra speeeed🚀
implemented! merge the main branch to get these functions.
there are 4 new functions:
there are 4 new functions:
- movePixel() - behavior discussed above
- moveSafePixel() - safe as above, but handles positions outside the bounds of the image
- moveFloatingPixel() - allows using floats for pixel positions, blends colors if necessary.
- moveUnsafePixel() - same as movePixel() but without error handling, always faster than movePixel() but errors may be vague
Thanks! I think I will use moveSafePixel()
for better use
there are 4 new functions:
- movePixel() - behavior discussed above
- moveSafePixel() - safe as above, but handles positions outside the bounds of the image
- moveFloatingPixel() - allows using floats for pixel positions, blends colors if necessary.
- moveUnsafePixel() - same as movePixel() but without error handling, always faster than movePixel() but errors may be vague
It would help me if you could add moveFloatingSafePixel()
, but I don’t really care about doing the skewFloat()
function anyway…
I think CI is failing because of the added rotate car in the image class, variables shouldn't be added like that since they have to be based somewhere in the abstract (for example, width is stored in the first couple of bytes)
Another thing, if it isn't slow, I think floating pixel checks should be safe by default, since you need to be super careful otherwise
A stack overflow error is also interesting 🤔
And the error message seems lacking. I should revisit this sometime.
Also, I think you're implementation of rotation only works if rotate
is a storable value, which isn't the case here since image is an abstract. I wonder how much turning image into a regular class will effect performance...
Ahh… so… what should I do?
I’m kinda new in using abstracts…
I’m kinda new in using abstracts…
Sorry for late reply, abstracts are pretty well explained (I think) here: https://haxe.org/manual/types-abstract.html
I’m kinda new in using abstracts…
Sorry for late reply, abstracts are pretty well explained (I think) here: https://haxe.org/manual/types-abstract.html
Ok, thanks, so, I can’t use variables like I use them in class
es…
About creating a new test
I think I’ll use addToScreen()
, and I’ll copy one of the tests, so I’m not sure if it will work… but I’ll try
Looking at this again, I don't think most of the functions mentioned in the first message are really needed. Another thing, this would be wayyy easier to implement if you don't try to create any custom properties on the image class. Simply an image skewing algorithm that rotates an image providing an image and angle is pretty much 90% of the work done, since it lays the foundation for other functions to be implemented
Looking at this again, I don't think most of the functions mentioned in the first message are really needed. Another thing, this would be wayyy easier to implement if you don't try to create any custom properties on the image class. Simply an image skewing algorithm that rotates an image providing an image and angle is pretty much 90% of the work done, since it lays the foundation for other functions to be implemented
Ah, ok then
Yey! It works!
It works!
At least the functions
@ShaharMS, can you also implement a moveFloatingSafePixel
? It’s better when the rotation it’s almost exact, and not rounded like in Std.int()
I'm pretty sure floating operations are safe by default on latest main
I'm pretty sure floating operations are safe by default on latest main
I saw the functions, and nope, they aren’t safe
Did you merge latest main? I just looked at the code and floating operations check for safety
Oh! Now I see the changes, thanks!
Where’s pixel (0, 1)?
woah, just merged main into your pr, and looks like java doesnt like some of the functions here... you can ignore that for now, its probably because of the inline abuse in that class😂
woah, just merged main into your pr, and looks like java doesnt like some of the functions here... you can ignore that for now, its probably because of the inline abuse in that class😂
:'( not happy wither… but thanks for merging it
Yes dude! I finally got the algorithm to skew images!
TODO:
movePixel(x, y, toX, toY)
movePixelByID(id, toX, toY)
(may cause lag…)has
functions:hasPixelInRotation(x, y, angle)
- Just a function I thought it would be great if the image is rotated, just for non-interfering the coordinateshasFloatingPixelInRotation(x, y, angle)
hasPixelInRotationAndInView(x, y, angle)
(optional) - a mixuphasFloatingPixelInRotationAndInView
hasFloatingRotatedPixelInView
hasPixelInRotatedView
hasFloatingRotatedPixelInRotatedView
skewInPoint(x, y, angle)
- rotates the image from a pointskewFloatInPoint(x, y, angle)
skewView(x, y, angle)
- rotates the view of the image (THIS NOT ROTATES THE IMAGE)skewFloatView
skewFloat(angle)
- Rotates the image, but with perfect pixels coordinatesskew(angle)
- Rotates the image from the bottom left cornerstampSkewed()
(?) - Stamps an image but rotatedforEach
forEachRotatedPixel
forEachRotatedFloatingPixel
forEachRotatedPixelInView
forEachRotatedFloatingPixelInView
rotatedValue
(?) - How much is the image rotated (might be changed)rotationWidth
- Width of the image but when it’s rotatedrotationHeight
- Height of the image but when it’s rotated