Beispiel #1
0
		GroupMenu::GroupMenu(const SmashData&smashData) : SmashBros::Menu::BaseMenuScreen(smashData)
		{
			smashButton = getItem(addItem(RectD(0.05, 0.2, 0.55, 0.6), new Animation(1, smashData.getMenuData()->getAssetManager(), "buttons/group/smash.png")));
			specialSmashButton = nullptr;//specialSmashButton = getItem(addItem(RectD(0.45f,0.25f,0.5f,0.5f), new Animation(smashData.getMenuData().getAssetManager(), 1, "buttons/group/specialsmash.png"));
			rulesButton = getItem(addItem(RectD(0.275, 0.6, 0.725, 0.9), new Animation(1, smashData.getMenuData()->getAssetManager(), "buttons/group/rules.png")));
			
			groupSmashData = new GroupSmashData();
			//TODO make the character select screen be loaded when the screen fades to black
			//(create an intermediate screen for while it's loading)
			smashMenu = new GroupSmashCharacterSelectMenu(smashData, *groupSmashData);
			rulesMenu = new GroupRulesMenu(smashData, *groupSmashData);
		}
		BaseMenuScreen::BaseMenuScreen(const SmashData&smashData)
		{
			AssetManager* assetManager = smashData.getMenuData()->getAssetManager();
			
			img_headerbar_small = assetManager->getTexture("elements/headerbar_small.png");
			img_headerbar_full = assetManager->getTexture("elements/headerbar_full.png");
			
			hoverPulseScale = 1;
			hoverPulseGrowing = true;
			hoverPulseEnabled = false;
			hoverPressed = false;
			
			ScreenElement* element = getElement();
			
			backgroundElement = new ImageElement(assetManager->getTexture("backgrounds/main.png"), ImageElement::DISPLAY_ZOOM);
			backgroundElement->setLayoutRule(LAYOUTRULE_LEFT,   0, LAYOUTVALUE_RATIO);
			backgroundElement->setLayoutRule(LAYOUTRULE_TOP,    0, LAYOUTVALUE_RATIO);
			backgroundElement->setLayoutRule(LAYOUTRULE_RIGHT,  1, LAYOUTVALUE_RATIO);
			backgroundElement->setLayoutRule(LAYOUTRULE_BOTTOM, 1, LAYOUTVALUE_RATIO);
			element->addChildElement(backgroundElement);
			
			headerbarElement = new ImageElement(img_headerbar_full, ImageElement::DISPLAY_ZOOM);
			headerbarElement->setLayoutRule(LAYOUTRULE_LEFT,   0.0,   LAYOUTVALUE_RATIO);
			headerbarElement->setLayoutRule(LAYOUTRULE_TOP,    0.0,   LAYOUTVALUE_RATIO);
			headerbarElement->setLayoutRule(LAYOUTRULE_RIGHT,  1.0,   LAYOUTVALUE_RATIO);
			headerbarElement->setLayoutRule(LAYOUTRULE_BOTTOM, 0.134, LAYOUTVALUE_RATIO);
			element->addChildElement(headerbarElement);
			
			element->sendChildElementToBack(headerbarElement);
			element->sendChildElementToBack(backgroundElement);
			
			backButton = (SpriteActor*)getItem(addItem(RectD(0, 0, 0.145, 0.145), new Animation(1, assetManager, "buttons/back.png")));
		}
Beispiel #3
0
static LRESULT OnPaint(HWND hwnd)
{
    ClientRect rect(hwnd);
    DoubleBuffer buffer(hwnd, rect);
    HDC hdc = buffer.GetDC();
    HBRUSH brushBg = CreateSolidBrush(COL_WINDOW_BG);
    HBRUSH brushWhite = GetStockBrush(WHITE_BRUSH);
    FillRect(hdc, &rect.ToRECT(), brushBg);

    PreviewBase *preview = (PreviewBase *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
    if (preview && preview->renderer) {
        int pageNo = GetScrollPos(hwnd, SB_VERT);
        RectD page = preview->renderer->GetPageRect(pageNo);
        if (!page.IsEmpty()) {
            rect.Inflate(-PREVIEW_MARGIN, -PREVIEW_MARGIN);
            float zoom = (float)min(rect.dx / page.dx, rect.dy / page.dy) - 0.001f;
            RectI onScreen = RectD(rect.x, rect.y, page.dx * zoom, page.dy * zoom).Round();
            onScreen.Offset((rect.dx - onScreen.dx) / 2, (rect.dy - onScreen.dy) / 2);

            FillRect(hdc, &onScreen.ToRECT(), brushWhite);
            preview->renderer->Render(hdc, onScreen, pageNo, zoom);
        }
    }

    DeleteObject(brushBg);
    DeleteObject(brushWhite);

    PAINTSTRUCT ps;
    buffer.Flush(BeginPaint(hwnd, &ps));
    EndPaint(hwnd, &ps);
    return 0;
}
Beispiel #4
0
void DumpThumbnail(BaseEngine *engine)
{
    RectD rect = engine->Transform(engine->PageMediabox(1), 1, 1.0, 0);
    if (rect.IsEmpty()) {
        Out("\t<Thumbnail />\n");
        return;
    }

    float zoom = min(128 / (float)rect.dx, 128 / (float)rect.dy) - 0.001f;
    RectI thumb = RectD(0, 0, rect.dx * zoom, rect.dy * zoom).Round();
    rect = engine->Transform(thumb.Convert<double>(), 1, zoom, 0, true);
    RenderedBitmap *bmp = engine->RenderBitmap(1, zoom, 0, &rect);
    if (!bmp) {
        Out("\t<Thumbnail />\n");
        return;
    }

    size_t len;
    ScopedMem<unsigned char> data(tga::SerializeBitmap(bmp->GetBitmap(), &len));
    ScopedMem<char> hexData(data ? str::MemToHex(data, len) : NULL);
    if (hexData)
        Out("\t<Thumbnail>\n\t\t%s\n\t</Thumbnail>\n", hexData.Get());
    else
        Out("\t<Thumbnail />\n");

    delete bmp;
}
Beispiel #5
0
bool XARGenerator::OutputLineEntity(const Style& style, const Transformation& trans, const PointD& p1, const PointD& p2)
{
	// truncate floating point values to INT32
	DocCoord dcPos1((INT32)p1.x, m_docSize.y - (INT32)p1.y);
	DocCoord dcPos2((INT32)p2.x, m_docSize.y - (INT32)p2.y);

#if SVGDEBUG
	svgtrace(DBGTRACE_SHAPES, "line: x1=%d y1=%d x2=%d y2=%d\n", dcPos1.x, dcPos1.y, dcPos2.x, dcPos2.y);
#endif

	bool ok = true;
	CXaraFileRecord Rec(0);
	Rec.Reinit(TAG_PATH_STROKED, TAG_PATH_SIZE);
	Rec.WriteUINT32(2);	 // two coordinates
	Rec.WriteBYTE(0x06); // moveto
	Rec.WriteBYTE(0x02); // lineno
	Rec.WriteCoord(dcPos1);
	Rec.WriteCoord(dcPos2);
	ok = m_pExporter->WriteRecord(&Rec);

	RectD boundings = RectD(p1, p2);
	/***/ ok = m_pExporter->WriteZeroSizedRecord(TAG_DOWN);
	OutputStyles(style, trans, boundings, STYLE_STROKE_ALL|STYLE_OPACITY);
	/***/ ok = m_pExporter->WriteZeroSizedRecord(TAG_UP);

	return ok;
}
ActionRetCodeEnum
ViewerDisplayScheduler::createFrameRenderResultsGeneric(const ViewerNodePtr& viewer,
                                                        const TreeRenderQueueProviderPtr& provider,
                                                        TimeValue time,
                                                        bool isPlayback,
                                                        const RotoStrokeItemPtr& activeDrawingStroke,
                                                        const std::vector<ViewIdx>& viewsToRender,
                                                        bool enableRenderStats,
                                                        RenderFrameResultsContainerPtr* future)
{
    // A global statistics object for this frame render if requested
    RenderStatsPtr stats;
    if (enableRenderStats) {
        stats.reset( new RenderStats(enableRenderStats) );
    }


    // Get parameters from the viewport
    bool fullFrameProcessing = viewer->isFullFrameProcessingEnabled();
    bool draftModeEnabled = viewer->getApp()->isDraftRenderEnabled();
    unsigned int mipMapLevel = getViewerMipMapLevel(viewer, draftModeEnabled, fullFrameProcessing);
    bool byPassCache = viewer->isRenderWithoutCacheEnabledAndTurnOff();
    ViewerCompositingOperatorEnum viewerBlend = viewer->getCurrentOperator();
    bool viewerBEqualsViewerA = viewer->getCurrentAInput() == viewer->getCurrentBInput();

    // Create the global results object
    ViewerRenderFrameResultsContainerPtr results(new  ViewerRenderFrameResultsContainer(provider));
    *future = results;
    results->time = time;
    results->recenterViewer = viewer->getViewerCenterPoint(&results->viewerCenter);

    std::list<RectD> rois;
    if (!viewer->isDoingPartialUpdates()) {
        rois.push_back(RectD());
    } else {

        // If the viewer is doing partial updates (i.e: during tracking we only update the markers areas)
        // Then we launch multiple renders over the partial areas
        std::list<RectD> partialUpdates = viewer->getPartialUpdateRects();
        for (std::list<RectD>::const_iterator it = partialUpdates.begin(); it != partialUpdates.end(); ++it) {
            if (!it->isNull()) {
                rois.push_back(*it);
            }
        }
    }

    for (std::list<RectD>::const_iterator it = rois.begin(); it != rois.end(); ++it) {
        // Render all requested views
        for (std::size_t view_i = 0; view_i < viewsToRender.size(); ++view_i) {
            ActionRetCodeEnum stat = createFrameRenderResultsForView(viewer, provider, results, viewsToRender[view_i], stats, isPlayback, it->isNull() ? 0 : &(*it), mipMapLevel, viewerBlend, byPassCache, draftModeEnabled, fullFrameProcessing, viewerBEqualsViewerA, activeDrawingStroke);
            if (isFailureRetCode(stat)) {
                return stat;
            }
        } // for each view

    }
    return eActionStatusOK;
} // createFrameRenderResultsGeneric
Beispiel #7
0
RectD
KnobGui::getViewportRect() const
{
    if (_imp->customInteract) {
        return _imp->customInteract->getViewportRect();
    }

    return RectD();
}
Beispiel #8
0
RectD GetBoundingRect(IGraphItem * item) 
{
	if (item)
	{
		if (ElementG * eg = GetElementG(item))
			return eg->GetBoundingBox();
	}
	return RectD();
}
Beispiel #9
0
    RectD GetPageRect(int pageNo) {
        if (preventRecursion)
            return RectD();

        preventRecursion = true;
        // assume that any engine methods could lead to a seek
        RectD bbox = engine->PageMediabox(pageNo);
        bbox = engine->Transform(bbox, pageNo, 1.0, 0);
        preventRecursion = false;
        return bbox;
    }
RectD
GuiAppInstance::getPaintStrokeWholeBbox() const
{
    QMutexLocker k(&_imp->rotoDataMutex);

    if (!_imp->rotoData.stroke) {
        return RectD();
    }

    return _imp->rotoData.stroke->getWholeStrokeRoDWhilePainting();
}
	bool Set(IGraphItem * item)
	{
		if (m_hotItem != item)
		{
			GetInvalidateRect(m_prevInvalidateRect);
			m_hotItem = item;
			m_hotEdge = dynamic_cast<IEdge * >(m_hotItem.get());
			m_hotVertex = m_hotEdge == NULL ? dynamic_cast<IVertex * >(m_hotItem.get()) : NULL;
			m_invalidateRect = RectD();
			return true;
		}
		return false;
	}
Beispiel #12
0
	void Game::loadContent(AssetManager* assetManager)
	{
		assetManager->setRootDirectory("assets");
		
		dialogueBox = new DialogueBox(assetManager, RectangleD(0, 0, 330*3/2, 110));
		dialogueBox->setTextPadding(RectD(30, 26, 30, 8));
		
		addMap("village", new Village(this, assetManager));
		
		player = new Jerk(this, assetManager);
		
		goToMap("village", Vector2d(400, 200));
	}
Beispiel #13
0
void FixSubgraphSizes(ICluster * cluster, RectD  & parentRect)
{
	RectD childRect;
	for(IClusterSet::const_iterator itr = cluster->GetClusters().begin(); itr != cluster->GetClusters().end(); ++itr)
	{
		std::string cluster;
		FixSubgraphSizes(itr->get(), childRect);
	}

	for(IVertexSet::const_iterator itr = cluster->GetVertices().begin(); itr != cluster->GetVertices().end(); ++itr)
	{
		if (childRect.IsEmptyArea())
			childRect = GetBoundingRect(itr->get());
		else
			childRect.Union(GetBoundingRect(itr->get()));
	}

	//if (!GetBoundingRect(cluster).Contains(childRect))
	{
		if (childRect.IsEmptyArea())
			childRect = GetBoundingRect(cluster);
		else
			childRect.Union(GetBoundingRect(cluster));


		if (ElementG * eg = GetElementG(cluster))
		{
			assert(eg->m_polygons.size() == 1);
			if (eg->m_polygons.size() == 1)
			{
				eg->m_polygons[0]->m_points.clear();
				eg->m_polygons[0]->SetBoundingBox(RectD());
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetLeft(), childRect.GetBottom()));
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetLeft(), childRect.GetTop()));
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetRight(), childRect.GetTop()));
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetRight(), childRect.GetBottom()));
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetLeft(), childRect.GetBottom()));
			}
			//eg->SetBoundingBox(childRect);
			eg->CalcBoundingBox();
		}

		//childRect.Union(GetBoundingRect(cluster));
		//ElementGPtr elementG = new ElementG(childRect);
		//cluster->SetProperty(SVG_PROP_ELEMENTG, elementG);
	}
	if (parentRect.IsEmptyArea())
		parentRect = childRect;
	else
		parentRect.Union(childRect);
}
Beispiel #14
0
		MenuBar::MenuBar(double x, double y, const WideString&label_text, AssetManager*assetManager, const Dictionary&properties) : SpriteActor(x, y)
		{
			addAnimation("MenuBar", new Animation(1, assetManager, "elements/menu_bar.png"));
			changeAnimation("MenuBar", Animation::FORWARD);
			
			autoLayoutMgr.setFrame(getFrame());
			
			Font* font = assetManager->getFont("fonts/default.ttf");
			label_color = Color::BLACK;
			label_actor = new TextActor(label_text, font, label_color, 24, Font::STYLE_PLAIN, TextActor::ALIGN_BOTTOMLEFT);
			autoLayoutMgr.add(RectD(0.05, 0.05, 0.575, 0.95), label_actor);
			
			applyProperties(properties);
		}
Beispiel #15
0
IFACEMETHODIMP PreviewBase::GetThumbnail(UINT cx, HBITMAP *phbmp, WTS_ALPHATYPE *pdwAlpha)
{
    BaseEngine *engine = GetEngine();
    if (!engine)
        return E_FAIL;

    RectD page = engine->Transform(engine->PageMediabox(1), 1, 1.0, 0);
    float zoom = min(cx / (float)page.dx, cx / (float)page.dy) - 0.001f;
    RectI thumb = RectD(0, 0, page.dx * zoom, page.dy * zoom).Round();

    BITMAPINFO bmi = { 0 };
    bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
    bmi.bmiHeader.biHeight = thumb.dy;
    bmi.bmiHeader.biWidth = thumb.dx;
    bmi.bmiHeader.biPlanes = 1;
    bmi.bmiHeader.biBitCount = 32;
    bmi.bmiHeader.biCompression = BI_RGB;

    unsigned char *bmpData = NULL;
    HBITMAP hthumb = CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, (void **)&bmpData, NULL, 0);
    if (!hthumb)
        return E_OUTOFMEMORY;

    page = engine->Transform(thumb.Convert<double>(), 1, zoom, 0, true);
    RenderedBitmap *bmp = engine->RenderBitmap(1, zoom, 0, &page);

    HDC hdc = GetDC(NULL);
    if (bmp && GetDIBits(hdc, bmp->GetBitmap(), 0, thumb.dy, bmpData, &bmi, DIB_RGB_COLORS)) {
        // cf. http://msdn.microsoft.com/en-us/library/bb774612(v=VS.85).aspx
        for (int i = 0; i < thumb.dx * thumb.dy; i++)
            bmpData[4 * i + 3] = 0xFF;

        *phbmp = hthumb;
        if (pdwAlpha)
            *pdwAlpha = WTSAT_RGB;
    }
    else {
        DeleteObject(hthumb);
        hthumb = NULL;
    }

    ReleaseDC(NULL, hdc);
    delete bmp;

    return hthumb ? S_OK : E_NOTIMPL;
}
Beispiel #16
0
RectD XARGenerator::GetMaximumBoundings(const PathDataVector& pathVector)
{
	PointD p1(1e50, 1e50); // the maximum values
	PointD p2(-1e50, -1e50);
	for (unsigned int i = 0; i < pathVector.GetCount(); ++i) {
		const PointD& p = pathVector[i].m_coord;
		if (p.x < p1.x)
			p1.x = p.x;
		if (p.y < p1.y)
			p1.y = p.y;
		if (p.x > p2.x)
			p2.x = p.x;
		if (p.y > p2.y)
			p2.y = p.y;
	}

	return RectD(p1, p2);
}
	PixelIterator::PixelIterator(const Vector2u&dims, const RectangleU&srcrect, const RectangleD&dstrect, const RectangleD&looprect, double xincrement, double yincrement, const TransformD&transform, const Vector2d&rat, bool mirrorHorizontal_arg, bool mirrorVertical_arg)
	{
		if(!dstrect.contains(looprect))
		{
			throw IllegalArgumentException("loopRect", "not within bounds of dstRect");
		}
		if((unsigned int)(srcrect.x + srcrect.width) > dims.x)
		{
			throw IllegalArgumentException("srcRect", "not within bounds of dimensions");
		}
		else if((unsigned int)(srcrect.y + srcrect.height) > dims.y)
		{
			throw IllegalArgumentException("srcRect", "not within bounds of dimensions");
		}
		usesTransform = true;
		started = false;
		dimensions = Vector2d((double)dims.x, (double)dims.y);
		srcRect = srcrect;
		srcRectD = RectangleD((double)srcRect.x, (double)srcRect.y, (double)srcRect.width, (double)srcRect.height);
		srcRectRight = srcRectD.x + srcRectD.width;
		srcRectBottom = srcRectD.y + srcRectD.height;
		dstRect = dstrect;
		loopRect = looprect;
		loopRectRel = RectD(loopRect.x-dstRect.x, loopRect.y-dstRect.y, loopRect.x+loopRect.width-dstRect.x, loopRect.y+loopRect.height-dstRect.y);
		ratio.x = rat.x;
		ratio.y = rat.y;
		incr.x = xincrement;
		incr.y = yincrement;
		incrpxl.x = incr.x*ratio.x;
		incrpxl.y = incr.y*ratio.y;
		inverseTransform = transform.getInverse();
		mirrorHorizontal = mirrorHorizontal_arg;
		mirrorVertical = mirrorVertical_arg;
		currentPoint.x = loopRect.x - dstRect.x;
		currentPoint.y = loopRect.y - dstRect.y;
		row = 0;
		lastRowStartIndex = 0;
		currentPixelIndex = calculatePixelIndex();
		lastRowStartIndex = currentPixelIndex;
	}
Beispiel #18
0
 virtual RectD PageContentBox(int pageNo, RenderTarget target=Target_View) {
     return RectD();
 }
Beispiel #19
0
 virtual RectD PageMediabox(int pageNo) { return RectD(); }
Beispiel #20
0
 virtual RectD GetDestRect() const {
     return RectD(DEST_USE_DEFAULT, DEST_USE_DEFAULT, DEST_USE_DEFAULT, DEST_USE_DEFAULT);
 }
Beispiel #21
0
 virtual RectD PageMediabox(int pageNo) {
     return pdfEngine ? pdfEngine->PageMediabox(pageNo) : RectD();
 }
Beispiel #22
0
 virtual RectD PageContentBox(int pageNo, RenderTarget target=Target_View) {
     return pdfEngine ? pdfEngine->PageContentBox(pageNo, target) : RectD();
 }
 virtual RectD GetDestRect() const { return RectD(); }
		SoloMenu::SoloMenu(const SmashData&smashData) : SmashBros::Menu::BaseMenuScreen(smashData)
		{
			trainingButton = getItem(addItem(RectD(0.1, 0.2, 0.9, 0.8), new Animation(1, smashData.getMenuData()->getAssetManager(), "buttons/solo/training.png")));
		}
Beispiel #25
0
std::pair<ImagePtr, RectI>
TrackMarker::getMarkerImage(int time,
                            const RectI& roi) const
{
    std::list<ImageComponents> components;

    components.push_back( ImageComponents::getRGBComponents() );

    const unsigned int mipmapLevel = 0;
    assert( !roi.isNull() );

    NodePtr node = getContext()->getNode();
    NodePtr input = node->getInput(0);
    if (!input) {
        return std::make_pair(ImagePtr(), roi);
    }

    AbortableRenderInfoPtr abortInfo = AbortableRenderInfo::create(false, 0);
    const bool isRenderUserInteraction = true;
    const bool isSequentialRender = false;
    AbortableThread* isAbortable = dynamic_cast<AbortableThread*>( QThread::currentThread() );
    if (isAbortable) {
        isAbortable->setAbortInfo( isRenderUserInteraction, abortInfo, node->getEffectInstance() );
    }

    ParallelRenderArgsSetter::CtorArgsPtr tlsArgs(new ParallelRenderArgsSetter::CtorArgs);
    tlsArgs->time = time;
    tlsArgs->view = ViewIdx(0);
    tlsArgs->isRenderUserInteraction = isRenderUserInteraction;
    tlsArgs->isSequential = isSequentialRender;
    tlsArgs->abortInfo = abortInfo;
    tlsArgs->treeRoot = getContext()->getNode();
    tlsArgs->textureIndex = 0;
    tlsArgs->timeline = node->getApp()->getTimeLine();
    tlsArgs->activeRotoPaintNode = NodePtr();
    tlsArgs->activeRotoDrawableItem = RotoDrawableItemPtr();
    tlsArgs->isDoingRotoNeatRender = false;
    tlsArgs->isAnalysis = true;
    tlsArgs->draftMode = true;
    tlsArgs->stats = RenderStatsPtr();
    ParallelRenderArgsSetter frameRenderArgs(tlsArgs);
    RenderScale scale;
    scale.x = scale.y = 1.;
    EffectInstance::RenderRoIArgs args( time,
                                        scale,
                                        mipmapLevel, //mipmaplevel
                                        ViewIdx(0),
                                        false,
                                        roi,
                                        RectD(),
                                        components,
                                        eImageBitDepthFloat,
                                        false,
                                        node->getEffectInstance(),
                                        eStorageModeRAM /*returnOpenGlTex*/,
                                        time);
    std::map<ImageComponents, ImagePtr> planes;
    EffectInstance::RenderRoIRetCode stat = input->getEffectInstance()->renderRoI(args, &planes);

    appPTR->getAppTLS()->cleanupTLSForThread();

    if ( (stat != EffectInstance::eRenderRoIRetCodeOk) || planes.empty() ) {
        return std::make_pair(ImagePtr(), roi);
    }

    return std::make_pair(planes.begin()->second, roi);
} // TrackMarker::getMarkerImage