Server migration complete, Welcome to version 2.1.1



Welcome, Guest.
Please login or register.
Forgot your password?

+-Site Stats

Total Members: 15473
Latest: vb
New This Month: 95
New This Week: 10
New Today: 9
Total Posts: 126844
Total Topics: 15549
Most Online Today: 74
Most Online Ever: 7634
(January 21, 2020, 02:14:03 AM)
Users Online
Members: 6
Guests: 60
Total: 66

Could the background be a drawing or a picture

Started by arw01, October 27, 2014, 11:07:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


picked up from Dave's Whole House model thread..,1449.20.html

void xLightsFrame::UpdatePreview()
    const wxColour *color;
    wxString SelModelName=ListBoxElementList->GetStringSelection();
    wxClientDC dc(ScrolledWindowPreview);
    for (int i=0; i<PreviewModels.size(); i++)
        color = (PreviewModels[i]->name == SelModelName) ? wxYELLOW : wxLIGHT_GREY;

I was thinking this was responsible for the actual yellow on the grid highlighting and de-highlighting as it played along, not actually drawing in the preview area.  See the wxYELLOW and wx_LIGHT_GREY would represent that to me.


Yeah, you're right, I shouldn't go from memory sometimes.  :)

I tracked this down a while ago but never got around to changing any code.

It's xLightsFrame::PreviewOutput()

ScrolledWindowPreview is the window that the models are drawn on via:


If you look for ScrolledWindowPreview in xLightsMain.cpp, you can change it's initial color to confirm that is the window.

There is already some work done inside xLightsFrame::OnButtonSetBackgroundClick() in TabPreview, but I am not sure of the state of it.


Mat wrote this code 18 months ago. He was going great, he wrote preview function in less than one week. He then ran into a snag loading an image into the background. I dont remember if he said it was a bug in wxwidgets, or performance. Maybe ill ping him. He worked on it for 1-2 weeks and i then said we will go with preview without a background image. it was a nice to have. people were so impressed with the preview that no one really was complaining. It was on matt's to do to go back and review.

He told me he planned on switching to opengl for both performance but also features. In feb of this year he started that process. He then got a job at LOR and the preview rewrite was put on hold.

Dave Pitts is also looking into the how to get a background image loaded.
Littleton, CO Latest releases xLights/Nutcracker Forum Facebook [url=


If you want to work on this, here is a patch that may get you going.  This code displays a background image on the preview window.  The image gets resized when the window is resized which may not be desirable in the final code.  I've attached a diff against a fairly recent TabPreview.cpp file.

This is an example, it is by no means complete.

To test it, apply the patch, then edit TabPreview.cpp and look for the following:


wxString theFilename = "ToTestPutTheFullPathToYourBackgroundFilenameHere.jpg";

Change the value of 'theFilename' to the full path to a background image.  Compile and run.

Go to the preview screen and open a sequence using the Open button.  This will also load the preview image.  For some reason I haven't looked into yet, the image will not display until you resize the window, so resize it by a pixel or two.  You should see a background image now.

You can move models around, and play the sequence and it will play the models over top of the background image.

There are a few optimizations in the code to try to make it fast.  The code caches the background image so it is only loaded once.  Then we only resize this cached image when necessary.  After we resize, we cache the bitmap so that all we have to do on screen refreshes is to draw the bitmap to the window before drawing the models onto the window.

Again, this is a hack and not complete, but hopefully it will help give you something to go on since it is working code to display a background.  It needs some wxWidgets glue to select the background file, some other glue to maintain the aspect ratio, etc. but I think that it could be usable.  Drawing the bitmap every 50ms frame refresh did not seem to cause that much of a CPU load on my Linux system.  I can't say for sure how performance on Windows will be since I don't run xLights on Windows.

[attachment deleted by admin]

Support FPP

+- Recent Topics

USB Wifi Adapter by jem5136
Today at 05:37:34 AM

show locks me out of falcon player by breese
Today at 04:11:38 AM

F48 with Daisy Chained Smart Receivers by Starry
Today at 03:18:05 AM

Unable to get DHCP after FPP install by Jlwright325
November 27, 2022, 11:31:30 PM

What is the second best way to get rid of pixel gap errors? by k6ccc
November 27, 2022, 10:32:34 PM

FPP connect by LedMutt
November 27, 2022, 09:29:34 PM

FPP Scheduler duplicate by Aaron Maue
November 27, 2022, 09:24:20 PM

Audio Stalls on 8th music sequence by JonD
November 27, 2022, 08:09:16 PM

Kulp 32A-B setup by tgeorges
November 27, 2022, 05:54:31 PM

MultiSync copying of Show Files not working in FPP 6.1.1 by jnealand
November 27, 2022, 05:27:32 PM

Powered by EzPortal
Powered by SMFPacks Menu Editor Mod