Skip to content

Commit a77d5b3

Browse files
author
Travis Cobbs
committed
*** empty log message ***
1 parent 694233a commit a77d5b3

9 files changed

+129
-17
lines changed

AppResources.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#define IDB_NON_FLAT_QUAD_MASK 163
6060
#define IDR_TOOLBAR_MENU 163
6161
#define IDB_COLINEAR 164
62+
#define IDR_SS_PREVIEW 164
6263
#define IDB_COLINEAR_MASK 165
6364
#define IDB_TOOLBAR 166
6465
#define IDB_VERTEX_ORDER 167
@@ -278,7 +279,7 @@
278279
#ifndef APSTUDIO_READONLY_SYMBOLS
279280
#define _APS_NO_MFC 1
280281
#define _APS_3D_CONTROLS 1
281-
#define _APS_NEXT_RESOURCE_VALUE 164
282+
#define _APS_NEXT_RESOURCE_VALUE 165
282283
#define _APS_NEXT_COMMAND_VALUE 40075
283284
#define _APS_NEXT_CONTROL_VALUE 1190
284285
#define _APS_NEXT_SYMED_VALUE 101

AppResources.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@ IDB_DETERMINANT_MASK BITMAP DISCARDABLE "Icons\\error_determinant_mask.b
930930
IDB_FNF_MASK BITMAP DISCARDABLE "Icons\\error_fnf_mask.bmp"
931931
IDB_INFO_MASK BITMAP DISCARDABLE "Icons\\error_info_mask.bmp"
932932
IDB_OPENGL_MASK BITMAP DISCARDABLE "Icons\\error_opengl_mask.bmp"
933-
IDB_SS_PREVIEW BITMAP DISCARDABLE "Icons\\screen_saver_preview.bmp"
934933
IDB_EXTRA_DIRS BITMAP DISCARDABLE "Icons\\extra_dirs_toolbar.bmp"
935934
IDB_MATRIX BITMAP DISCARDABLE "icons\\error_matrix.bmp"
936935
IDB_MATRIX_MASK BITMAP DISCARDABLE "icons\\error_matrix_mask.bmp"
@@ -994,6 +993,7 @@ END
994993
//
995994

996995
IDR_STUDLOGO_PNG PNG DISCARDABLE "Textures\\StudLogo.png"
996+
IDR_SS_PREVIEW PNG DISCARDABLE "Icons\\screen_saver_preview.png"
997997

998998
/////////////////////////////////////////////////////////////////////////////
999999
//

Help.html

+41-2
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,19 @@
608608
<I>Width</I><BR>
609609
This is only available with the <I>Save image with specific size</I> check box
610610
checked. It then sets the width (in pixels) of the image file being
611-
created.</I>
611+
created. Note that if this is bigger than a certain threshold (which differs
612+
from one video card to another), a number of tiles will be rendered and stitched
613+
together automatically to form the full image. This may cause the actual image
614+
width to be slightly less than the requested width due to rounding.</I>
612615
</P>
613616
<P>
614617
<I>Height</I><BR>
615618
This is only available with the <I>Save image with specific size</I> check box
616619
checked. It then sets the height (in pixels) of the image file being
617-
created.</I>
620+
created. Note that if this is bigger than a certain threshold (which differs
621+
from one video card to another), a number of tiles will be rendered and stitched
622+
together automatically to form the full image. This may cause the actual image
623+
height to be slightly less than the requested height due to rounding.</I>
618624
</P>
619625
<P>
620626
<I>Zoom to Fit</I><BR>
@@ -777,6 +783,10 @@
777783
custom colors in the color panel correspond to the first 16 standard LDraw
778784
colors. Resetting the General preferences also resets these colors.
779785
</P>
786+
<P>
787+
<I>Trans</I> (Default: <I>Off</I>):<BR>
788+
Enabling this option causes default-colored items to be transparent.
789+
</P>
780790

781791
<P>
782792
<FONT SIZE=+1><B><A NAME="GeneralMiscBox">Misc Box</A></B></FONT><BR>
@@ -1996,6 +2006,20 @@
19962006
<I>Geometry-&gt;Edge Lines</I> box.
19972007
</TD>
19982008
</TR>
2009+
<TR>
2010+
<TD VALIGN="TOP">
2011+
PreferenceSet
2012+
</TD>
2013+
<TD VALIGN="TOP">
2014+
String
2015+
</TD>
2016+
<TD VALIGN="TOP">
2017+
YES
2018+
</TD>
2019+
<TD VALIGN="TOP">
2020+
Activates the specified preference set.
2021+
</TD>
2022+
</TR>
19992023
<TR>
20002024
<TD VALIGN="TOP">
20012025
PrintBackground
@@ -2601,6 +2625,21 @@
26012625
menu.
26022626
</TD>
26032627
</TR>
2628+
<TR>
2629+
<TD VALIGN="TOP">
2630+
TransDefaultColor
2631+
</TD>
2632+
<TD VALIGN="TOP">
2633+
Boolean
2634+
</TD>
2635+
<TD VALIGN="TOP">
2636+
NO
2637+
</TD>
2638+
<TD VALIGN="TOP">
2639+
Equivalent to the <I>Trans</I> check box in the
2640+
<I>General-&gt;Colors</I> box.
2641+
</TD>
2642+
</TR>
26042643
<TR>
26052644
<TD VALIGN="TOP">
26062645
UseFlatShading

Icons/screen_saver_preview.png

707 Bytes
Loading

LDView.dsp

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LDViewMain.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <TCFoundation/TCUserDefaults.h>
99
#include <TCFoundation/TCLocalStrings.h>
1010
#include <TCFoundation/mystring.h>
11+
#include <TCFoundation/TCImage.h>
1112
#include <CUI/CUIWindow.h>
1213
#include "SSPreview.h"
1314
#include "AppResources.h"

SSPreview.cpp

+78-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#include "SSPreview.h"
22
#include "AppResources.h"
3+
#include <TCFoundation/TCImage.h>
34

45
SSPreview::SSPreview(HWND hParentWindow, HINSTANCE hInstance)
56
:CUIWindow(hParentWindow, hInstance, 0, 0, 0, 0),
67
hBitmap(NULL),
7-
hBrush(NULL)
8+
hBmpDc(NULL)
89
{
910
setTitle("LDView SS Preview");
1011
}
@@ -15,8 +16,14 @@ SSPreview::~SSPreview(void)
1516

1617
void SSPreview::dealloc(void)
1718
{
18-
DeleteObject(hBitmap);
19-
DeleteObject(hBrush);
19+
if (hBitmap)
20+
{
21+
DeleteObject(hBitmap);
22+
}
23+
if (hBmpDc)
24+
{
25+
DeleteDC(hBmpDc);
26+
}
2027
}
2128

2229
BOOL SSPreview::run(void)
@@ -99,18 +106,77 @@ HBRUSH SSPreview::getBackgroundBrush(void)
99106

100107
void SSPreview::doPaint(void)
101108
{
102-
RECT rect = {x, y, width, height};
103-
104109
if (!hBitmap)
105110
{
106-
// hBitmap = LoadBitmap(getLanguageModule(),
107-
// MAKEINTRESOURCE(IDB_SS_PREVIEW));
108-
hBitmap = (HBITMAP)LoadImage(getLanguageModule(),
109-
MAKEINTRESOURCE(IDB_SS_PREVIEW), IMAGE_BITMAP, width, height,
110-
LR_DEFAULTCOLOR);
111-
hBrush = CreatePatternBrush(hBitmap);
111+
HRSRC hPngResource = FindResource(getLanguageModule(),
112+
MAKEINTRESOURCE(IDR_SS_PREVIEW), "PNG");
113+
114+
if (hPngResource)
115+
{
116+
HGLOBAL hPng = LoadResource(getLanguageModule(), hPngResource);
117+
118+
if (hPng)
119+
{
120+
TCByte *data = (TCByte *)LockResource(hPng);
121+
122+
if (data)
123+
{
124+
DWORD length = SizeofResource(getLanguageModule(),
125+
hPngResource);
126+
127+
if (length)
128+
{
129+
TCImage *image = new TCImage;
130+
BITMAPINFO bmInfo;
131+
TCByte *bmData;
132+
TCByte *imageData;
133+
int imageWidth;
134+
int imageHeight;
135+
int rowSize;
136+
int row;
137+
int col;
138+
139+
image->setFlipped(true);
140+
image->setLineAlignment(4);
141+
image->loadData(data, length);
142+
SetLastError(0);
143+
bmInfo.bmiHeader.biSize = sizeof(bmInfo.bmiHeader);
144+
bmInfo.bmiHeader.biWidth = image->getWidth();
145+
bmInfo.bmiHeader.biHeight = image->getHeight();
146+
bmInfo.bmiHeader.biPlanes = 1;
147+
bmInfo.bmiHeader.biBitCount = 24;
148+
bmInfo.bmiHeader.biCompression = BI_RGB;
149+
bmInfo.bmiHeader.biSizeImage = 0;
150+
bmInfo.bmiHeader.biXPelsPerMeter = 1;
151+
bmInfo.bmiHeader.biYPelsPerMeter = 1;
152+
bmInfo.bmiHeader.biClrUsed = 0;
153+
bmInfo.bmiHeader.biClrImportant = 0;
154+
hBitmap = CreateDIBSection(hdc, &bmInfo, DIB_RGB_COLORS,
155+
(void**)&bmData, NULL, 0);
156+
imageData = image->getImageData();
157+
imageWidth = image->getWidth();
158+
imageHeight = image->getHeight();
159+
rowSize = image->getRowSize();
160+
for (row = 0; row < imageHeight; row++)
161+
{
162+
for (col = 0; col < imageWidth; col++)
163+
{
164+
int offset = row * rowSize + col * 3;
165+
166+
bmData[offset] = imageData[offset + 2];
167+
bmData[offset + 1] = imageData[offset + 1];
168+
bmData[offset + 2] = imageData[offset];
169+
}
170+
}
171+
image->release();
172+
hBmpDc = CreateCompatibleDC(hdc);
173+
SelectObject(hBmpDc, hBitmap);
174+
}
175+
}
176+
}
177+
}
112178
}
113-
FillRect(hdc, &rect, hBrush);
179+
BitBlt(hdc, 0, 0, width, height, hBmpDc, 0, 0, SRCCOPY);
114180
}
115181

116182
LRESULT SSPreview::doDestroy(void)

SSPreview.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SSPreview: public CUIWindow
1818
virtual LRESULT doDestroy(void);
1919

2020
HBITMAP hBitmap;
21-
HBRUSH hBrush;
21+
HDC hBmpDc;
2222
};
2323

2424
#endif __SSPREVIEW_H__

TCFoundation/TCImage.h

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <TCFoundation/TCObject.h>
55
#include <TCFoundation/TCTypedObjectArray.h>
6+
#include <stdio.h>
67

78
class TCImageFormat;
89

0 commit comments

Comments
 (0)