I got AHK script which uses GDI or GDI+ and there is rotation funtion, which rotates image (map which has several solid colors like green,blue,red,yellow,orange,white,gray,"desert"). I would like to do such rotation which will not blur the image but will use the colors which I use and need to be used so it is not blured. So the rotation function should find the closest color - one of the set.
Yet it has no sense to paste here all the code which is in AHK because there is gdip library which does the things. But this is what the AHK does:
1 2 3 4 5 6
|
pBitmap := Gdip_CreateBitmap(RWidth, RHeight) ; Create a new bitmap
G := Gdip_GraphicsFromImage(pBitmap) ; Get a pointer to the graphics of the bitmap
Gdip_SetSmoothingMode(G, 4)
Gdip_SetInterpolationMode(G, 7)
Gdip_TranslateWorldTransform(G, xTranslation, yTranslation)
Gdip_RotateWorldTransform(G, Angle)
|
And the Gdip_RotateWorldTransform does this dll call:
DllCall("gdiplus\GdipRotateWorldTransform", "uint", pGraphics, "float", Angle, "int", MatrixOrder)
I don't know id I need all these functions, but need to find a way how to skip bluring of the image.
Here - on right: original window, from where the image is taken and rotated
the resulted images is displayed under the window so you see the blured dots.
http://oi61.tinypic.com/2ztepty.jpg
I am interested what function to use or how to use them in C++ and I would try to add them to AHK.
Edit:
I have tried Gdip_SetInterpolationMode(G, 5)
which gives no blured points. This looks like very close solution what I thought it could be. But one more idea:
Is it possible to improve results, with this method?
1) First create image A from original image which will be blured.
e.g. Interpolation Mode 7 and rotate it
2) Then create next image B from the original with interpolation mode 5 and rotate it
3) Create new image which will compare the pixel with image A and B. And find the best color. E.g. In the image B there are blue dots beside the blue line which I want to remove. If it will compare with image A, program will see that there is not full blue, and there for will use the color nearest to the blured green -> so it will create clear green pixel.
What I am trying to explain that when you compare two images, the program could decide if the pixel from B should be placed there or not. But of not, so it must find nearest color which is not nearest of blue.