Exemplo n.º 1
0
void
ClearBackGround (PRECT pClipRect)
{
	TFB_Palette color;

	COLORtoPalette (_get_context_bg_color (), &color);
	TFB_Prim_FillRect (pClipRect, &color);
}
Exemplo n.º 2
0
static void
ClearBackGround (RECT *pClipRect)
{
    RECT clearRect;
    Color color = _get_context_bg_color ();
    clearRect.corner.x = 0;
    clearRect.corner.y = 0;
    clearRect.extent = pClipRect->extent;
    TFB_Prim_FillRect (&clearRect, color, DRAW_REPLACE_MODE,
                       pClipRect->corner);
}
Exemplo n.º 3
0
void
DrawFilledRectangle (RECT *lpRect)
{
    POINT origin;

    if (GraphicsSystemActive () && GetContextValidRect (NULL, &origin))
    {
        Color color = GetPrimColor (&_locPrim);
        DrawMode mode = _get_context_draw_mode ();
        TFB_Prim_FillRect (lpRect, color, mode, origin);
    }
}
Exemplo n.º 4
0
void
DrawFilledRectangle (PRECT lpRect)
{
	RECT ValidRect;
	HOT_SPOT OldHot;

	if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
	{
		TFB_Palette color;
		
		COLORtoPalette (GetPrimColor (&_locPrim), &color);
		TFB_Prim_FillRect (lpRect, &color);  
		_CurFramePtr->HotSpot = OldHot;
	}
}
Exemplo n.º 5
0
void
DrawBatch (PPRIMITIVE lpBasePrim, PRIM_LINKS PrimLinks, 
		BATCH_FLAGS BatchFlags)
{
	RECT ValidRect;
	HOT_SPOT OldHot;

	if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
	{
		COUNT CurIndex;
		PRIM_LINKS OldLinks;
		PPRIMITIVE lpPrim;

		BatchFlags &= BATCH_SINGLE
				| BATCH_BUILD_PAGE
				| BATCH_XFORM;

		BatchFlags |= _get_context_flags () & BATCH_CLIP_GRAPHICS;

		BatchGraphics ();

		if (BatchFlags & BATCH_BUILD_PAGE)
		{
			ClearBackGround (&ValidRect);
		}

		CurIndex = GetPredLink (PrimLinks);

		if (BatchFlags & BATCH_SINGLE)
		{
			if (CurIndex == END_OF_LIST)
				BatchFlags &= ~BATCH_SINGLE;
			else
			{
				lpBasePrim += CurIndex;
				OldLinks = GetPrimLinks (lpBasePrim);
				SetPrimLinks (lpBasePrim, END_OF_LIST, END_OF_LIST);
				CurIndex = 0;
			}
		}

		for (; CurIndex != END_OF_LIST; CurIndex = GetSuccLink (GetPrimLinks (lpPrim)))
		{
			GRAPHICS_PRIM PrimType;
			PPRIMITIVE lpWorkPrim;
			RECT ClipRect;
			TFB_Palette color;

			lpPrim = &lpBasePrim[CurIndex];
			PrimType = GetPrimType (lpPrim);
			if (!ValidPrimType (PrimType))
				continue;

			lpWorkPrim = lpPrim;

			switch (PrimType)
			{
				case POINT_PRIM:
					COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
					TFB_Prim_Point (&lpWorkPrim->Object.Point, &color);
					break;
				case STAMP_PRIM:
					TFB_Prim_Stamp (&lpWorkPrim->Object.Stamp);
					break;
				case STAMPFILL_PRIM:
					COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
					TFB_Prim_StampFill (&lpWorkPrim->Object.Stamp, &color);
					break;
				case LINE_PRIM:
					COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
					TFB_Prim_Line (&lpWorkPrim->Object.Line, &color);
					break;
				case TEXT_PRIM:
					if (!TextRect (&lpWorkPrim->Object.Text,
							&ClipRect, NULL_PTR))
						continue;

					_save_stamp.origin = ClipRect.corner;
					
					_text_blt (&ClipRect, lpWorkPrim);
					break;
				case RECT_PRIM:
					COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
					TFB_Prim_Rect (&lpWorkPrim->Object.Rect, &color);
					break;
				case RECTFILL_PRIM:
					COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
					TFB_Prim_FillRect (&lpWorkPrim->Object.Rect, &color);
					break;
			}
		}

		UnbatchGraphics ();

		_CurFramePtr->HotSpot = OldHot;

		if (BatchFlags & BATCH_SINGLE)
			SetPrimLinks (lpBasePrim,
					GetPredLink (OldLinks),
					GetSuccLink (OldLinks));

	}
}
Exemplo n.º 6
0
void
DrawBatch (PRIMITIVE *lpBasePrim, PRIM_LINKS PrimLinks,
           BATCH_FLAGS BatchFlags)
{
    RECT ValidRect;
    POINT origin;

    if (GraphicsSystemActive () && GetContextValidRect (&ValidRect, &origin))
    {
        COUNT CurIndex;
        PRIMITIVE *lpPrim;
        DrawMode mode = _get_context_draw_mode ();

        BatchGraphics ();

        if (BatchFlags & BATCH_BUILD_PAGE)
        {
            ClearBackGround (&ValidRect);
        }

        CurIndex = GetPredLink (PrimLinks);

        for (; CurIndex != END_OF_LIST;
                CurIndex = GetSuccLink (GetPrimLinks (lpPrim)))
        {
            GRAPHICS_PRIM PrimType;
            PRIMITIVE *lpWorkPrim;
            RECT ClipRect;
            Color color;

            lpPrim = &lpBasePrim[CurIndex];
            PrimType = GetPrimType (lpPrim);
            if (!ValidPrimType (PrimType))
                continue;

            lpWorkPrim = lpPrim;

            switch (PrimType)
            {
            case POINT_PRIM:
                color = GetPrimColor (lpWorkPrim);
                TFB_Prim_Point (&lpWorkPrim->Object.Point, color,
                                mode, origin);
                break;
            case STAMP_PRIM:
                TFB_Prim_Stamp (&lpWorkPrim->Object.Stamp, mode, origin);
                break;
            case STAMPFILL_PRIM:
                color = GetPrimColor (lpWorkPrim);
                TFB_Prim_StampFill (&lpWorkPrim->Object.Stamp, color,
                                    mode, origin);
                break;
            case LINE_PRIM:
                color = GetPrimColor (lpWorkPrim);
                TFB_Prim_Line (&lpWorkPrim->Object.Line, color,
                               mode, origin);
                break;
            case TEXT_PRIM:
                if (!TextRect (&lpWorkPrim->Object.Text, &ClipRect, NULL))
                    continue;
                // ClipRect is relative to origin
                _text_blt (&ClipRect, &lpWorkPrim->Object.Text, origin);
                break;
            case RECT_PRIM:
                color = GetPrimColor (lpWorkPrim);
                TFB_Prim_Rect (&lpWorkPrim->Object.Rect, color,
                               mode, origin);
                break;
            case RECTFILL_PRIM:
                color = GetPrimColor (lpWorkPrim);
                TFB_Prim_FillRect (&lpWorkPrim->Object.Rect, color,
                                   mode, origin);
                break;
            }
        }

        UnbatchGraphics ();
    }
}