Making a MaxGUI Application: StripAnimMakerLite Part 7a - Capturing Image to AnimStrip
(c) Assari Jan 26 2005

Part 7 will be broken into two parts. To capture the Image to AnimStrip we need to do several things
We will do the first item in part 7a and the other 2 items in part 7b.

New Additions to Part 1 - Variable Definitions

We need to add the Canvas3 global definition

    Global Canvas3:TGadget '---------Canvas3 is our AnimStrip

New Additions to Part 2 - Gadget Creation Block

No changes required for this block but later we need to modify the CreateCanvases function

New Additions to Part 3 - MAIN LOOP

No addition to the Main Loop

New Additions to Part 4 - Function Definitions

The functions to modify are:-
CreateCanvases()

Note the the y position is calculated to be below the Main Canvas and its horizontal scrollbar.
The width of Canvas3 is almost the width of our Main Window and its height is 128, the maximum size allowed for our anim image block
    Function CreateCanvases:Int()

'---------Canvas1 is our Main Canvas
  Canvas1:TGadget=CreateCanvas(0,0,480,400,MyWindow)
'---------Canvas2 is our zoomed window
  Canvas2:Tgadget=CreateCanvas(GadgetWidth(Canvas1)+22,0,48*6,48*6,MyWindow)
'---------Canvas2 is our zoomed window
  Canvas3:TGadget=CreateCanvas(0,GadgetHeight(Canvas1)+22, ..                               GadgetWidth(MyWindow)-10,128,MyWindow)

End Function



Process GadgetPaint Event

Nothing special here, just the normal SetGraphics, CLS and Flip
    Function Process_GadgetPaintEvent:Int()

    Select EventSource()
    Case Canvas1
        SetGraphics CanvasGraphics (Canvas1)
        Cls
        DrawPixmap Pix,0,0
        If MouseInCanvas1 Then
            DrawCursor(mx1,my1,xsize, ysize)
            If CursorResize=True
                SetColor 255,0,0
                DrawCursor(mx1_old,my1_old,xsize_old, ysize_old)
                SetColor 0,0,0
            EndIf
            RedrawGadget(Canvas2)
        EndIf
        Flip

    Case Canvas2
        SetGraphics CanvasGraphics(Canvas2)
        Cls
        If MouseInCanvas1=True Then
            If CursorResize=False Then DrawPixUnderCursor(Canvas2,Pix,mx1,my1)
            If CursorResize=True Then DrawPixUnderCursor(Canvas2,Pix,mx1_Old,my1_Old)

        EndIf
        Flip

    Case Canvas3
        SetGraphics CanvasGraphics(Canvas3)
        Cls
        Flip
   
    End Select 'EventSource()

End Function




If you want to download the uptodate source here or simply move on to the next Tutorial as this one is rather short.

That's all for now. Return to Main Index.