How to rotate square part of a pixmap 45 degrees?

BlitzMax Forums/BlitzMax Beginners Area/How to rotate square part of a pixmap 45 degrees?

My question is (as the title may suggest); How does one rotate a square part of a pixmap 45 degrees?
I would also like to know how to rotate it 315 degrees. So The part can be turned back again.
The square would have a width and Height of 64 pixels.
I need something like this to create a seamless isometric tile from non tiling images.
[EDIT] oh yes; the square to rotate 45 stands on its tip, while the square to be rotated 315 stands on its side. [/EDIT]

there is no build in instruction to rotate a Pixmap. you can do it through an image.
steps:
copy/convert pixmap to image
setrotation to 45
draw the image to screen:
grab rotated image from screen as pixmap

you need to use these commands:
loadimage - to convert pixmap to image
grabpixmap - to grab the pixmap from the screen

Also search the forums for the pixmap rotation code that I posted.

Here's some ancient B2D code, should be easy enough to adapt for your needs...
;**************************************************************************************************
;***** Rotazooming - vomit inducing - YAN 2001
;**************************************************************************************************

Graphics 640,480

source_image = LoadImage("phsyc.png") ; a 128x128 pixel image
rot_image = CreateImage(160, 160)

Dim sint#(359), cost#(359)

For t=0 To 359
	sint#(t) = Sin(t)
	cost#(t) = Cos(t)
Next

SetBuffer BackBuffer()

a = 0 : s# = 0 : tx# = 0 : ty# = 0

Repeat
	
	fast_rotateflt(source_image, 128, 128, 64, 64, rot_image, 156, 156, cost#(a)*80, sint#(a)*160, a, s#)
		
	TileBlock rot_image, tx#, ty#
		
	Flip
		
	a = (a + 1) Mod 360
	s# = Abs(cost#(a)) + 0.4
	tx# = cost#(a) * 160
	ty# = sint#(a) * 160
			
Until KeyDown(1)

End

;

Function fast_rotateflt(src_image, src_w, src_h, src_cx, src_cy, dst_image, dst_w, dst_h, dst_cx, dst_cy, angle, scale#)
	;src_w & src_h MUST be powers of 2 : 2,4,8,16,32...etc
	ducol# = sint#(angle) * (1 / scale#)
	dvcol# = cost#(angle) * (1 / scale#)
	durow# = dvcol#
	dvrow# = -ducol#
	
	rowu# = src_cx - ((dst_cx * dvcol#) + (dst_cy * ducol#))
	rowv# = src_cy - ((dst_cx * dvrow#) + (dst_cy * durow#))
	
	src_buff = ImageBuffer(src_image)
	dst_buff = ImageBuffer(dst_image)
	src_h = src_h - 1
	src_w = src_w - 1
	dst_h = dst_h - 1
	dst_w = dst_w - 1

	LockBuffer(ImageBuffer(src_image))
	LockBuffer(ImageBuffer(dst_image))
	
	For y=0 To dst_h
		u# = rowu#
		v# = rowv#
		
		For x=0 To dst_w
			
			CopyPixelFast (u# And src_w), (v# And src_h), src_buff, x, y, dst_buff
			
			u# = u# + durow#
			v# = v# + dvrow#
		Next
		
		rowu# = rowu# + ducol#
		rowv# = rowv# + dvcol#
	Next
	
	UnlockBuffer(ImageBuffer(src_image))
	UnlockBuffer(ImageBuffer(dst_image))
End Function

;Original C routine By Steven M Mortimer
;
;void FastRotate(
;    WORD *pDstBase, Int dstW, Int dstH, Int dstDelta,
;    WORD *pSrcBase, Int srcW, Int srcH, Int srcDelta,
;   Float fDstCX, Float fDstCY,
;    Float fSrcCX, Float fSrcCY, 
;    Float fAngle, Float fScale)
;{   
;    srcDelta /= sizeof(WORD);
;    dstDelta /= sizeof(WORD);

;   Float duCol = (Float)Sin(-fAngle) * (1.0f / fScale);
;   Float dvCol = (Float)Cos(-fAngle) * (1.0f / fScale);
;   Float duRow = dvCol;
;   Float dvRow = -duCol;

;   Float startingu = fSrcCX - (fDstCX * dvCol + fDstCY * duCol);
;   Float startingv = fSrcCY - (fDstCX * dvRow + fDstCY * duRow);

;   Float rowu = startingu;
;   Float rowv = startingv;

;   For(Int y = 0; y < dstH; y++)
;   {
;       Float u = rowu;
;       Float v = rowv;
;   
;       WORD *pDst = pDstBase + (dstDelta * y);

;       For(Int x = 0; x < dstW ; x++)
;       {   
;           WORD *pSrc = pSrcBase + (((Int)u) & srcW-1) + 
;                        ((((Int)v) & srcH-1) * srcDelta );
                       
;           *pDst++ = *pSrc++;

;           u += duRow;
;           v += dvRow;
;       }

;       rowu += duCol;
;       rowv += dvCol;
;   }
;


@ Jesse
I Forgot to mention that I want to do this in MAxGui, so I suppose I can't do that?
@ ImaginaryHuman
I tried to follow what was going on in this thread: http://www.blitzbasic.com/Community/posts.php?topic=73042#816898
Don't know if this was the code You mentioned, but I was lost in so many ways, I just gave up.
@ Yan
Yes; that looks very adaptable. At least I think I can follow the flow.

Everybody: Grouphug!

Yes that's the one.

Follow my signature link, I have an antialias pixmap rotating code you can try.

Boy! am I out of my element!
I think I can understand about a third of all this pixel-juggling.
But perhaps that's enough to use some of it for my seamless isometric tile code.
Though I wish I could do without rotating the texture, because of the morphing I think will occur when I tilt the seamless tile back on its tip.
But I only know how to make a normal tile seamless, not one that's rotated 45 degrees.
_____________________________________________________________
"enough!" "let's work!" "where's my thinking cap!"
~it's in the well master~
"how did it get there Thar?"
~I dropped it master~
"did you wear the cap at that time Thar?"
~no master~
"AH!"
________from 'Thar's lonely quest' by Mark Hellmson_________

save yourself some head aches and rotate all of your images in a paint program and save them rotated.

heh; can't do that!
It would make it easier to make it seamless, but the isometric tiles I need,
will be not perfectly centered to the texture, but 1 pixel shifted to the right.
So I need to be in more control, than I would have to be if they were regular tiles.
But no sweat; I think I will get there, If I use the code you suggested as a guideline.
____________________________________________________________
"oh traveler, why are you so sad?"
~I am very tired, for I have walked for three days, without food nor water.~
"but cool water flows under the bridge you crossed and succulent fruit grows in this tree you sit under."
~ah, a tree you say.~
________from 'Thar's lonely quest' by Mark Hellmson_________