@DataBase "FC_Image"
@Author Olivier Laviale : Lotan <lotan9@aol.com> © 2002
@SmartWrap

@Node Main "Feelin : FC_Image"
@{lindent 2}@{PAR}
@{b}@{u}FC_Image@{ub}@{uu}@{PAR}@{lindent 4}

@{b}Image@{ub} class is used to display Feelin's standard images or some
selfmade image data. The image will be created and handled by the
@{"FC_ImageDisplay" link FC_ImageDisplay.guide/Main}.@{PAR}@{lindent 2}

@{b}Attributes@{ub}@{PAR}@{lindent 4}

@{" FA_Image        " link FA_Image}
@{" FA_AltImage     " link FA_AltImage}@{PAR}

@{" FA_Image_Width  " link FA_Image_Width}
@{" FA_Image_Height " link FA_Image_Height}@{PAR}

@{" FA_Image_State  " link FA_Image_State}@{PAR}
@EndNode

@Node FA_AltImage "FC_Image / FA_AltImage"
@{lindent 2}@{PAR}
@{fg shine}@{b}NAME@{ub}@{fg text}@{PAR}@{lindent 4}

@{b}FA_AltImage -- (00.00) [I..], STRPTR | ULONG@{ub}@{PAR}@{lindent 2}

@{fg shine}@{b}FUNCTION@{ub}@{fg text}@{PAR}@{lindent 4}

This attribute can be used to create an alternate image to @{fg shine}FA_Image@{fg text}. This
alternate image can be of any type.@{PAR}@{lindent 2}

@{fg shine}@{b}SEE ALSO@{ub}@{fg text}@{PAR}@{lindent 4}

@{" FA_Image " link FA_Image} @{PAR}
@EndNode
@Node FA_Image "FC_Image / FA_Image"
@{lindent 2}@{PAR}
@{fg shine}@{b}NAME@{ub}@{fg text}@{PAR}@{lindent 4}

@{b}FA_Image -- (00.00) [I..], STRPTR | ULONG@{ub}@{PAR}@{lindent 2}

@{fg shine}@{b}FUNCTION@{ub}@{fg text}@{PAR}@{lindent 4}

Specify the type of your image. Usually, you will use one of the predefined
standard images here, (one of the @{fg shine}FI_Xxx@{fg text} definitions from @{b}feelin.m@{ub}), but you
also can supply a string containing a Feelin image specification.@{PAR}

Standard image may be one of the predifined patterns (from @{fg shine}FI_Shine@{fg text} to
@{fg shine}FI_Shine_Highlight@{fg text}).@{PAR}

String specification always starts with a digit or a letter, followed by a
":", followed by some parameters. Currently, the following things are
defined (all numeric parameters need to be ascii values!):@{PAR}

@{b}0:<x>@{ub}@{PAR}@{lindent 8}

Where <x> is between @{fg shine}FI_Back_Window@{fg text} and @{fg shine}FI_Back_Last@{fg text}-1 or between @{fg shine}FI_Shine @{fg text}
and @{fg shine}FI_Shine_Highlight@{fg text} e.g. "0:12"@{PAR}@{lindent 4}

@{b}1:<r,g,b>@{ub}@{PAR}@{lindent 8}

Where <r,g,b> describe RGB values of a color e.g. "1:FF00FF" will be full
red. "c:" is also accepted.@{PAR}@{lindent 4}

@{b}2:<n>@{ub}@{PAR}@{lindent 8}

Where <n> is the name of an external picture file that should be loaded with
datatypes.@{PAR}@{lindent 4}

@{b}3:<n>@{ub}@{PAR}@{lindent 8}

Where <n> is the name of an external Feelin brush. This may result in a
single or double brush. A double brush is created from two files a "*.fb0"
and a "*.fb1". If brush's name ends with a ".fb0" an alternate image will
be loaded from disk, if this succeed a double brush is created, else brush
will be a single one.@{PAR}@{lindent 4}

@{b}F:<p>@{ub}@{PAR}@{lindent 8}

Where <p> is a pointer to a function (no hook!!). The function will be
called with a pointer to a @{"FS_Render" link FC_Window.guide/FS_Render} in A0 giving you everything you need
to know about graphical environnement, a pointer to a @{"FS_Rect" link FC_Area.guide/FS_Rect} in A1
describing the @{b}rectangle@{ub} to fill, a pointer to a @{"FS_Rect" link FC_Area.guide/FS_Rect} in A2 describing
the @{b}region@{ub} in which the rectangle is located, and some @{b}flags@{ub} in D0 (always
NULL for now).@{PAR}

Everything is checked (rport != NULL, x1 <= x2, y1 <= y2...) and the
rectangle is clipped (if possible) before the function is called.@{PAR}@{lindent 12}

void main()@{PAR}
{@{PAR}
    static char myback[16];@{PAR}

    sprintf(myback,"F:%lx\\0",&mydrawfunc)@{PAR}

    ...@{PAR}
        Child, AreaObject, FA_Back, myback, ...@{PAR}
    ...@{PAR}
}@{PAR}

void ASM SAVEDS mydrawfunc(REG_A0 struct FS_Render *Render,REG_A1 struct FS_Rect *Rect)@{PAR}
{@{PAR}
    struct RastPort *rp = Render -> psRPort;@{PAR}

    _APen(Render -> pnPens[FV_Pen_Highlight]);@{PAR}
    _Boxf(Rect -> x1,Rect -> y1,Rect -> x2,Rect -> y2);@{PAR}
}@{PAR}@{lindent 8}

Use region's coordinates to create stylish effects :@{PAR}@{lindent 12}

void ASM SAVEDS mydrawfunc(REG_A0 struct FS_Render *Render,REG_A2 struct FS_Rect *Region)@{PAR}
{@{PAR}
   UWORD x1,y1,x2,y2,x3;@{PAR}
   ULONG ap=2,bp=3;
   struct RastPort *rp = Render -> psRPort;

   static UWORD pt[] = {0xFF00,0x7F80,0x3FC0,0x1FE0,@{PAR}
                        0x0FF0,0x07F8,0x03FC,0x01FE,@{PAR}
                        0x00FF,0x807F,0xC03F,0xE01F,@{PAR}
                        0xF00F,0xF807,0xFC03,0xFE01};@{PAR}

   static UWORD zr[] = {0xFFFF,0xFFFF,0xFFFF,0xFFFF};@{PAR}

   x1 = Region -> x1; x3 = Region -> x2; x2 = (x3 - x1) / 3 + x1;@{PAR}
   y1 = Region -> y1; y2 = Region -> y2;@{PAR}

   ap = Render -> pnPens[FV_Pen_Fill];@{PAR}
   bp = Render -> pnPens[FV_Pen_HalfShadow];@{PAR}

   _APen(bp);@{PAR}
   _Boxf(x1,y1,x2,y2);@{PAR}

   SetAfPt(rp,pt,4);@{PAR}
   _APen(ap);@{PAR}
   _BPen(bp);@{PAR}
   _Boxf(x2+1,y1,x3,y2);@{PAR}
   SetAfPt(rp,zr,2);@{PAR}
}@{PAR}@{lindent 8}

This way will look far more better. You must keep in mind that your backdrop
may be used by childrens, windows... and is called each time an object is
activated / deactivated. This is only required by stylish rendering, filling
rectangles with a solid color do not require much care.@{PAR}@{lindent 2}

@{fg shine}@{b}SEE ALSO@{ub}@{fg text}@{PAR}@{lindent 4}

@{" FA_AltImage        " link FA_AltImage}@{PAR}
@EndNode
@Node FA_Image_State "FC_Image / FA_Image_State"
@{lindent 2}@{PAR}
@{fg shine}@{b}NAME@{ub}@{fg text}@{PAR}@{lindent 4}

@{b}FA_Image_State -- (00.00) [ISG], ULONG@{ub}@{PAR}@{lindent 2}

@{fg shine}@{b}FUNCTION@{ub}@{fg text}@{PAR}@{lindent 4}

Some Feelin images offer different states, you can select one of them by
setting this attribute. Simply use one of the @{fg shine}FV_Image_Normal@{fg text},
@{fg shine}FV_Image_Selected@{fg text}...@{PAR}@{lindent 2}

@{fg shine}@{b}NOTE@{ub}@{fg text}@{PAR}@{lindent 4}

Objects that respond to user input will automatically toggle their state
between @{fg shine}FV_Image_Normal@{fg text} to @{fg shine}FV_Image_Selected@{fg text} depending on their
@{"FA_Selected" link FC_Area.guide/FA_Selected} attribute.@{PAR}@{lindent 2}

@{fg shine}@{b}SEE ALSO@{ub}@{fg text}@{PAR}@{lindent 4}

@{" FA_Image " link FA_Image}@{PAR}
@EndNode
@Node FA_Image_Height "FC_Image / FA_Image_Height"
@{lindent 2}@{PAR}
@{fg shine}@{b}NAME@{ub}@{fg text}@{PAR}@{lindent 4}

@{b}FA_Image_Height -- (00.00) [..G], ULONG@{ub}@{PAR}@{lindent 2}

@{fg shine}@{b}FUNCTION@{ub}@{fg text}@{PAR}@{lindent 4}

Return image's height.@{PAR}

All images don't have dimension, currently only brushes and bitmaps will
return their dimensions, others will return 10.@{PAR}@{lindent 2}

@{fg shine}@{b}SEE ALSO@{ub}@{fg text}@{PAR}@{lindent 4}

@{" FA_Image       " link FA_Image}
@{" FA_Image_Width " link FA_Image_Width}@{PAR}
@EndNode
@Node FA_Image_Width "FC_Image / FA_Image_Width"
@{lindent 2}@{PAR}
@{fg shine}@{b}NAME@{ub}@{fg text}@{PAR}@{lindent 4}

@{b}FA_Image_Width -- (00.00) [..G], ULONG@{ub}@{PAR}@{lindent 2}

@{fg shine}@{b}FUNCTION@{ub}@{fg text}@{PAR}@{lindent 4}

Return image's width.@{PAR}

All images don't have dimension, currently only brushes and bitmaps will
return their dimensions, others will return 10.@{PAR}@{lindent 2}

@{fg shine}@{b}SEE ALSO@{ub}@{fg text}@{PAR}@{lindent 4}

@{" FA_Image        " link FA_Image}
@{" FA_Image_Height " link FA_Image_Height}@{PAR}
@EndNode
