php - Changing the center of rotation of Imagerotate -


imagerotate rotates image using given angle in degrees.

the center of rotation center of image, , rotated image may have different dimensions original image.

how change center of rotation coordinate x_new , y_new , avoid automatic resizing?

example: rotation around red dot.

example

first idea comes mind move image new center @ x_new, y_new rotate , move back.

assumptions:

0 < x_new < w 0 < y_new < h 

pseudocode:

new_canter_x = max(x_new, w - x_new) new_center_y = max(y_new, h - y_new)  create new image (plain or transparent background): width = new_canter_x * 2 height = new_center_y * 2  copy old image new 1 coords: new_center_x - x_new new_center_y - y_new  imagerotate new image. 

now have cut part interested in out of it.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -