Page 1 of 1

Rotate brush is not identique to source

Posted: Fri Sep 23, 2016 4:57 pm
by sinisrus
Hello,

I have problem with rotate brush :

Code: Select all

/* Nouveau projet Hollywood */

 

@DISPLAY 1,{COLOR=#GRAY}

XScreenWidth=300

A=CreateBrush(NIL,XScreenWidth,27,#BLACK,{AlphaChannel = True, Clear=True})

SetFont(#SANS,15)
SetFontStyle(#ANTIALIAS)

SelectBrush(A,#SELMODE_COMBO,2)
  SetFillStyle(#FILLCOLOR)
  BOX(1,0,XScreenWidth,27,$6EBEFF)

  FOR i=0 TO XScreenWidth
      IF (i%2=0)
      LINE(PosX+i,PosY,PosX+i,PosY+3,COLOR1)
      LINE(PosX+i,#BOTTOM,PosX+i,#BOTTOM-3,COLOR1)
      ENDIF
  NEXT
EndSelect

/*****************************/

B=CopyBrush(A,Nil)
C=CopyBrush(B,Nil)

SelectBrush(A) Textout(#CENTER,#CENTER-1,"Original A") EndSelect

SelectBrush(B) Textout(#CENTER,#CENTER-1,"Copy A To B and rotate (not identique to A)") EndSelect
RotateBrush(B,-90)

SelectBrush(C) Textout(#CENTER,#CENTER-1,"Copy B To C and rotate (not identique to A)") EndSelect
RotateBrush(C,-360)

DisplayBrush(A,30,5)         
DisplayBrush(B,30,35)
DisplayBrush(C,30,350)

 

/* Boucle infinie */
Repeat
        WaitEvent
Forever

Re: Rotate brush is not identique to source

Posted: Thu Sep 29, 2016 5:38 pm
by airsoftsoftwair
That is a feature ;) RotateBrush() will always run its transformation code. It won't treat modulo 90, 180, 270 and 360 rotations as special cases and run special code. But you can easily implement this yourself and just call FlipBrush() or CopyBrush() in case of a special rotation angle...

Re: Rotate brush is not identique to source

Posted: Thu Sep 29, 2016 8:53 pm
by sinisrus
Rotate with CopyBrush()??? Is it possible???

Thann you

Re: Rotate brush is not identique to source

Posted: Thu Sep 29, 2016 10:57 pm
by airsoftsoftwair
No, what I meant was that if you pass 360 to RotateBrush(), you probably just want to do nothing because nothing will change with an angle of 360, so you shouldn't call RotateBrush() in that case.

Re: Rotate brush is not identique to source

Posted: Fri Sep 30, 2016 7:47 am
by sinisrus
it is not possible to rotate 90, 180 identical with hollywood?

Re: Rotate brush is not identique to source

Posted: Sun Oct 02, 2016 11:58 pm
by xabierpayet
try this,will work fine

SelectBrush(B) Textout(#CENTER,#CENTER-1,"Copy A To B and rotate (not identique to A)") EndSelect
RotateBrush(B,-90,1,1,true)

SelectBrush(C) Textout(#CENTER,#CENTER-1,"Copy B To C and rotate (not identique to A)") EndSelect
RotateBrush(C,-360,1,1,true)

Re: Rotate brush is not identique to source

Posted: Mon Oct 03, 2016 4:39 pm
by sinisrus
I am sorry is not identique. look carefully :-/

thanks anyway

Re: Rotate brush is not identique to source

Posted: Fri Oct 07, 2016 10:23 pm
by airsoftsoftwair
Well, I could add some code of course that treats 90, 180, 270, 360 degrees rotations as special cases and uses dedicated code for them to give the best results. I'll see what I can do.

Re: Rotate brush is not identique to source

Posted: Sun Nov 27, 2016 9:58 am
by sinisrus
Thank you for this :-)

Re: Rotate brush is not identique to source

Posted: Tue Jan 17, 2017 7:47 pm
by airsoftsoftwair

Code: Select all

- New: RotateBrush(), TransformBrush() as well as all other functions that rotate images now use
  dedicated code to handle the special cases of a rotation by 90, 180, 270, and 360 degrees to
  transform the image data; this is much faster and the transformation is also done in a lossless
  way