Flipping Graphics

Mike Bonner bonnmike at gmail.com
Thu Jul 21 12:45:40 EDT 2016


Here is code in the ide that flips graphics, you can probably use it to
make your own version and stuff it in a library.

on revIDEFlipGraphics pGraphics, pOrientation
   # Make sure targets are all graphics
   if not revIDEEnsureControlsOfType(pGraphics, "graphic") then
      exit revIDEFlipGraphics
   end if

   repeat for each line tGraphic in pGraphics
      local tPoints, tNewPoints
      put the points of tGraphic into tPoints

      if pOrientation is "Horizontal" then
         ## 2014-08-20 EJB [[Bug 13191]]
         --flip graphic horizontally
         local tLeft, tRight
         put the left of tGraphic into tLeft
         put the right of tGraphic into tRight

         repeat for each line tPoint in tPoints
            -- added BN in case a line is empty
            if tPoint is empty then
               put cr after tNewPoints
               next repeat
            end if

            put tLeft + tRight - item 1 of tPoint, item 2 of tPoint & cr
after tNewPoints
         end repeat
      else
         --flip graphic vertically
         local tTop, tBottom
         put the top of tGraphic into tTop
         put the bottom of tGraphic into tBottom
         repeat for each line tPoint in tPoints
            -- added BN in case a line is empty
            if tPoint is empty then
               put cr after tNewPoints
               next repeat
            end if

            put item 1 of tPoint, tTop + tBottom - item 2 of tPoint & cr
after tNewPoints
         end repeat
      end if
      set the points of tGraphic to tNewPoints
   end repeat
end revIDEFlipGraphics

On Thu, Jul 21, 2016 at 10:39 AM, Klaus major-k <klaus at major-k.de> wrote:

> Hi Richmond,
>
> > Am 21.07.2016 um 18:36 schrieb Richmond <richmondmathewson at gmail.com>:
> >
> > As it is possible to *flip* a *graphic* via the *revMenubar*:
> Menu/Object/Flip Graphic why does it not
> > appear to be possible to *flip* using code:
> >
> > on mouseUp
> >  flip grc "XXX" horizontally
> > end mouseUp
> > ?
>
> as the dicitonary states, "flip" only works with images.
>
> > Richmond.
>
> Best
>
> Klaus
>
> --
> Klaus Major
> http://www.major-k.de
> klaus at major-k.de
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list