Rotate brush is not identique to source

Report any Hollywood bugs here
Post Reply
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Rotate brush is not identique to source

Post 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
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Rotate brush is not identique to source

Post 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...
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: Rotate brush is not identique to source

Post by sinisrus »

Rotate with CopyBrush()??? Is it possible???

Thann you
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Rotate brush is not identique to source

Post 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.
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: Rotate brush is not identique to source

Post by sinisrus »

it is not possible to rotate 90, 180 identical with hollywood?
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: Rotate brush is not identique to source

Post 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)
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: Rotate brush is not identique to source

Post by sinisrus »

I am sorry is not identique. look carefully :-/

thanks anyway
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Rotate brush is not identique to source

Post 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.
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: Rotate brush is not identique to source

Post by sinisrus »

Thank you for this :-)
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Rotate brush is not identique to source

Post 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
Post Reply