Exemple #1
0
void BlockHystogramShow (BLOCK *pBlock)
{
    char szBuffer [128];
    HystogramAllocateBody ();
    nHystColumns = pBlock -> nHystColumns;
    nHystColumnWidth = 1;
    memcpy (pHystogram,
            pBlock -> pHystogram,
            nHystColumns * sizeof (int));
    sprintf (szBuffer, "Block %d", pBlock -> nNumber);
    LT_GraphicsHystogramOutput (szBuffer);
    HystogramFreeData ();
}
Exemple #2
0
void LT_FreeAllData (void)
{
    WSB_FreeData ();
    SmartBreakingFreeData ();
    HystogramFreeData ();
    SeparatorsFreeData ();
    BlocksFreeData ();
    InitialBreakingFreeData ();
    PageMatrixFreeData ();
    CompsFreeData ();
    IntervalsFreeData ();
//    InclinesFreeData ();
    RootsFreeData ();

# ifdef LT_DEBUG
    LT_GraphicsClose ();
# endif

    LayoutBackupFreeData ();
}
Exemple #3
0
void BlocksBreak (void)
{
    BLOCK *p;
    int i;
    int nRootsInNotBreakedBlocks;

    if (!HystogramAllocateBody ())
        return;

    nRootsInNotBreakedBlocks = 0;
 AGAIN:
# ifdef LT_DEBUG
    //if (LT_DebugGraphicsLevel >= 4)
	if(!LDPUMA_Skip(hBlocksBreaking))
        LT_GraphicsBlocksOutput ("Blocks while breaking: again");
# endif
    for (p = pBlocksList; p != NULL; p = p -> pNext)
    {
        if (p -> uFlags & BF_NOT_BREAK_BLOCK)
			continue;

        for (i = 0; i < nSeps; i++)
        {
            switch (pSeps [i].Type)
            {
                default:
                    break;

                case SEP_VERT:
                    //if (TryCutBlockByVerticalSeparator   (p, i))  goto AGAIN;
					if (TryCutBlockByVerticalSeparator   (p, i, TRUE))
						goto AGAIN;
                    break;

                case SEP_HORZ:
                    if (TryCutBlockByHorizontalSeparator (p, i))
						goto AGAIN;
                    break;

                case SEP_RECT:
                    if (TryCutBlockByRectangleSeparator  (p, i))
						goto AGAIN;
                    break;
            }
        }


        //if (TryCutBlockOnVertical (p,0))          goto AGAIN;
		if (TryCutBlockOnVertical (p,0, FALSE))          goto AGAIN;

        if (bOptionSpecialHorizontalCutting &&
            TrySpecialHorizontalCutting (p))    goto AGAIN;

        if (TryCutBlockOnHorizontal (p))        goto AGAIN;

        if (bOptionSmartBreaking &&
            TrySmartBreaking (p))               goto AGAIN;

        if ( bOptionBusinessCardsLayout &&
             TryCutBlockOnVertical (p,1, FALSE))       goto AGAIN;

		// Rom
		//Handle hNotWholeLine = NULL;
		//Handle hHystogramNull = NULL;

		if(LDPUMA_Skip(hNotWholeLine))
		{
			for (i = 0; i < nSeps; i++)
			{
				switch (pSeps [i].Type)
				{
                default:
                    break;

                case SEP_VERT:
					if (TryCutBlockByVerticalSeparator   (p, i, FALSE))
						goto AGAIN;
                    break;

					/*
					case SEP_HORZ:
                    if (TryCutBlockByHorizontalSeparator (p, i))  goto AGAIN;
                    break;
					*/
				}
			}
		}

		/* Rom */
		if(LDPUMA_Skip(hHystogramNull))
		{
			if (TryCutBlockOnVertical (p,0, TRUE))          goto AGAIN;
		}



        p -> uFlags |= BF_NOT_BREAK_BLOCK;
        nRootsInNotBreakedBlocks += p -> nRoots;
        progress_set_percent (nRootsInNotBreakedBlocks * 100 / nRoots);

# ifdef LT_DEBUG
        //if (LT_DebugGraphicsLevel >= 4)
		if(!LDPUMA_Skip(hBlocksBreaking))
            LT_GraphicsBlocksOutput ("Blocks while breaking: set not break");
# endif
    }

    if (bOptionWhiteStripsBreaking)
        WhiteStripsBreaking ();

    HystogramFreeData ();
}
Exemple #4
0
Bool HystogramAllocateBody(void)
{
    BLOCK *p;
    int nBlockWidth;
    int nBlockHeight;
    int nMaxValue;
    HystogramFreeData();
    nMaxValue = 0;

    for (p = pBlocksList; p != NULL; p = p -> pNext) {
        nBlockWidth = p -> Rect.xRight - p -> Rect.xLeft + 1;
        nBlockHeight = p -> Rect.yBottom - p -> Rect.yTop + 1;

        if (nBlockWidth > nMaxValue)
            nMaxValue = nBlockWidth;

        if (nBlockHeight > nMaxValue)
            nMaxValue = nBlockHeight;
    }

    if (nMaxValue == 0)
        return (FALSE);

    nMaxValue++;
    pHystogram = static_cast<int*> (malloc((nMaxValue + 1) * sizeof(int)));
    //Andrey 05.03.2003: +1 т.к. в дальнейшем будет использоваться именно до такого значения

    if (pHystogram == NULL)
        ErrorNoEnoughMemory("in LTHYST.C,HystogramAllocateBody,part 1");

    if (bOptionPointSizeAnalysis) {
        pHystVertHeightesSum = static_cast<int*> (malloc(nMaxValue
                                                         * sizeof(int)));

        if (pHystVertHeightesSum == NULL)
            ErrorNoEnoughMemory("in LTHYST.C,HystogramAllocateBody,part 2");

        pHystHorzHeightesSum = static_cast<int*> (malloc(nMaxValue
                                                         * sizeof(int)));

        if (pHystHorzHeightesSum == NULL)
            ErrorNoEnoughMemory("in LTHYST.C,HystogramAllocateBody,part 3");

        pHystInt1 = static_cast<int*> (malloc(nMaxValue * sizeof(int)));

        if (pHystInt1 == NULL)
            ErrorNoEnoughMemory("in LTHYST.C,HystogramAllocateBody,part 4");

        pHystInt2 = static_cast<int*> (malloc(nMaxValue * sizeof(int)));

        if (pHystInt2 == NULL)
            ErrorNoEnoughMemory("in LTHYST.C,HystogramAllocateBody,part 5");
    }

    if (bOptionSpecialHorizontalCutting) {
        pHystTops = static_cast<int*> (malloc(nMaxValue * sizeof(int)));

        if (pHystTops == NULL)
            ErrorNoEnoughMemory("in LTHYST.C,HystogramAllocateBody,part 6");

        pHystBottoms = static_cast<int*> (malloc(nMaxValue * sizeof(int)));

        if (pHystBottoms == NULL)
            ErrorNoEnoughMemory("in LTHYST.C,HystogramAllocateBody,part 7");
    }

    return (TRUE);
}