Home  /  Autodocs

sketchboard.gadget

sketchboard gadget class

FUNCTIONS

SGM_Clear SGM_Redo SGM_Scroll SGM_Undo SKETCHBOARD_GetClass

SUPERCLASS

gadgetclass

REQUIRES

bevel.image

DESCRIPTION

This class is intended to be used to edit smaller bitmaps with a limited set of drawing tools. It is used by the Pointer preferences as well as the IconEdit utility.

Special features include bitmap scaling, an optional grid pattern and optional hot spot indicator.

ATTRIBUTES

GA_ReadOnly (BOOL)
This attribute overrides the behavior of the superclass to set and clear the GFLG_SELECTED flag. Set the gadget to read only when accessing the SGA_BitMap.

Defaults to FALSE.

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)

GA_Disabled (BOOL)
This attribute overrides the behavior of the superclass to also set and clear the GFLG_SELECTED flag.

Defaults to FALSE.

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)

SGA_BitMap (struct BitMap *)
Pointer to the source bitmap which will be copied from when used with OM_NEW, OM_SET and OM_UPDATE. This bitmap is only read from.

The sketchboard object always uses its own internal bitmap for editing. The internal bitmap can be retrieved using this attribute and OM_GET. Set the gadget to GA_ReadOnly before invoking OM_GET and be ready to handle a NULL pointer if the gadget has not yet been layed out.

Defaults to NULL (blank).

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)

SGA_MouseX (UWORD)
The current mouse X coordinate within the drawing area.

When using OM_GET, initialize the tag value to the mouse X coordinate relative to the gadget's bounds. This value will then be scaled to provide the mouse X coordinate within the drawing area.

When SGA_Scale is 1 there is no scaling because each pixel is exactly one square in the drawing area. When SGA_Scale is 2 there are 2 pixels for every one square withing the drawing area and so forth.

Applicability is (OM_GET, OM_NOTIFY)

SGA_MouseY (UWORD)
The current mouse Y coordinate within the drawing area.

When using OM_GET, initialize the tag value to the mouse Y coordinate relative to the gadget's bounds. This value will then be scaled to provide the mouse Y coordinate within the drawing area.

When SGA_Scale is 1 there is no scaling because each pixel is exactly one square in the drawing area. When SGA_Scale is 2 there are 2 pixels for every one square withing the drawing area and so forth.

Applicability is (OM_GET, OM_NOTIFY)

SGA_Width (UWORD)
The width of the drawing in pixels.

Defaults to 32.

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)

SGA_Height (UWORD)
The height of the drawing in pixels.

Defaults to 32.

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)

SGA_APen (UBYTE)
Current primary drawing pen.

Defaults to 1.

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET, OM_NOTIFY)

SGA_Tool (UWORD)
The currently active drawing tool which is one of the following:

SGTOOL_FREEHAND_DOTS
freehand dots only

SGTOOL_FREEHAND
freehand connected lines

SGTOOL_ELLIPSE
ellipse

SGTOOL_ELLIPSE_FILLED
filled ellipse

SGTOOL_RECT
rectangle

SGTOOL_RECT_FILLED
filled rectangle

SGTOOL_LINE
single line

SGTOOL_FILL
flood fill an area

SGTOOL_GETPEN
get primary pen (SGA_APen notifies)

SGTOOL_HOTSPOT
set image hot spot

SGTOOL_SELECT
selecting a part of the image for cut, copy or move

SGTOOL_MOVE
move the image og selection

Defaults to SGTOOL_FREEHAND_DOTS.

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET, OM_NOTIFY)

SGA_UndoAvailable (BOOL)
This attribute indicates whether an undo operation is possible with the currently selected SGA_Tool.

Applicability is (OM_GET, OM_NOTIFY)

SGA_RedoAvailable (BOOL)
This attribute indicates whether a redo operation is possible with the currently selected SGA_Tool.

Applicability is (OM_GET, OM_NOTIFY)

SGA_ShowGrid (BOOL)
This attribute enables or disables the drawing grid.

Defaults to TRUE.

Applicability is (OM_NEW, OM_SET, OM_UPDATE)

SGA_ScaleByCtrlMouseWheel (BOOL)
Enables Scaling by user turning the mouse wheel with Ctrl held down

Defaults to FALSE

Applicability is (OM_GET)

SGA_Scale (UWORD)
Determines the scaling factor to use starting from 1.

Defaults to 3.

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)

SGA_AfPt (UWORD *)
Control the area fill pattern for the space not being edited around the image.

Defaults to NULL (checkerboard pattern).

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)

SGA_AfPtSize (WORD)
Size of area fill pattern.

Defaults to 1.

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)

SGA_HPropTotal (UWORD)
Total horizontal size of the sketch when scaled. For use when interconnecting with a propgclass object or similar.

Applicability is (OM_GET, OM_NOTIFY)

SGA_HPropTop (UWORD)
Top of the horizontal size of the sketch when scaled. For use when interconnecting with a propgclass object or similar.

Applicability is (OM_SET, OM_UPDATE, OM_GET, OM_NOTIFY)

SGA_HPropVisible (UWORD)
Visible horizontal size of the sketch when scaled. For use when interconnecting with a propgclass object or similar.

Applicability is (OM_GET, OM_NOTIFY)

SGA_VPropTotal (UWORD)
Total vertical size of the sketch when scaled. For use when interconnecting with a propgclass object or similar.

Applicability is (OM_GET, OM_NOTIFY)

SGA_VPropTop (UWORD)
Top of the vertical size of the sketch when scaled. For use when interconnecting with a propgclass object or similar.

Applicability is (OM_SET, OM_UPDATE, OM_GET, OM_NOTIFY)

SGA_VPropVisible (UWORD)
Visible vertical size of the sketch when scaled. For use when interconnecting with a propgclass object or similar.

Applicability is (OM_GET, OM_NOTIFY)

SGA_HotSpot (ULONG)
The current hot spot location packed into a ULONG. The upper word is the X position while the lower word is the Y position. The hot spot will be rendered as a small square.

Defaults to -1 (no hot spot).

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)

SGA_Changed (BOOL)
The flag will be set to TRUE when the drawing has been changed in some way.

Defaults to FALSE.

Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET, OM_NOTIFY)

SGA_RastPort (struct RastPort *)
This attribute is for subclass implementors only. It points the the layered RastPort being used for the drawing. The pointer may change when SGA_SketchWidth or SGA_SketchHeight changes. It is also possible it may be NULL.

Applicability is (OM_GET)

SGA_SketchBoardRect (struct Rectangle *)
This attribute is for subclass implementors only. It defines the area bounds where the actual rendering takes place relative to the top left corner of the parent window. This is a read only attribute.

Applicability is (OM_GET)

SGA_SubWidth (UWORD)
see next

SGA_SubHeight (UWORD)
These attribute are currently not implemented.

SGA_DoubleScaleX (BOOL)
Internally double X scale. Useful for correcting the aspect ratio.

Applicability is (OM_NEW, OM_SET)

SGA_DoubleScaleY (BOOL)
Internally double Y scale. Useful for correcting the aspect ratio.

Applicability is (OM_NEW, OM_SET)

SGA_TopLayerBitmap (struct BitMap *)
A bitmap that acts as top layer on top of the image itself. The use can move this bitmap around with the Move tool. Many actions like change of tool or selecting another area may dispose the internal SGA_TopLayerBitmap.

After OM_SETting this attribute you can release the bitmap as the gadget copies it to its own one.

For OM_GET this will return a pointer to the gadget's bitmap; don't cache this pointer!

Be prepared to handle NULL pointers (out of memory, no selection, or gadget hasn't been layouted).

NOTE:
when setting or getting this you also need to

do SGA_TopLayerWidth.

Applicability is (OM_GET, OM_NEW, OM_SET)

SGA_TopLayerWidth (WORD)
The real width of the SGA_TopLayerBitmap. It can be 0 if there is no selection.

Applicability is (OM_GET, OM_NEW, OM_SET)

SGA_WithBevel (BOOL)
Whether to use a bevel.

Defaults to TRUE. Applicability is (OM_NEW)

SGA_WithBevel (BOOL)
Whether to use a bevel.

Defaults to TRUE. Applicability is (OM_NEW)

SGA_ScrollWheelResponse (ULONG)
See <gadgets/sketchboard.h> for possible values. Defaults to SGSCROLLWHEEL_SCROLLANDZOOM. (IS) (V47)

SGA_MaxUndoSteps (ULONG)
Defaults to 16. (IS) (V47)

SGA_UpdatedBitMap (struct BitMap *)
Exactly the same as SGA_BitMap EXCEPT it doesn't reset the change stack, but instead records this update as a step in the change stack. (ISG) (V47)

SGA_MaxScale (ULONG)
Maximum scale. Defaults to 16. Probably shouldn't be much bigger. (ISG) (V47.19)