291 lines
6.9 KiB
Plaintext
291 lines
6.9 KiB
Plaintext
|
|
#if 0
|
|
Point xyPoint;
|
|
|
|
|
|
GDIPoint gdiPoint;
|
|
getDimensions(guiWindow,gdiPoint);
|
|
|
|
for(int index=0;index<mThumbNails.size();index++)
|
|
{
|
|
SmartPointer<ThumbNail> &ptrThumbNail=mThumbNails[index];
|
|
if(xyPoint.x()+ptrThumbNail->width()>=guiWindow.width())
|
|
{
|
|
xyPoint.x(0);
|
|
xyPoint.y(xyPoint.y()+ptrThumbNail->height()+Separator);
|
|
}
|
|
ptrThumbNail->draw(pureDevice,xyPoint);
|
|
xyPoint.x(xyPoint.x()+ptrThumbNail->width()+Separator);
|
|
}
|
|
#endif
|
|
|
|
|
|
|
|
// cursorControl.waitCursor(TRUE);
|
|
// setTitle(strPathDirectory);
|
|
// getDirectoryFileNames(strPathDirectory,strPathFileNames);
|
|
// int usage;
|
|
// for(int index=0;index<strPathFileNames.size();index++)
|
|
// {
|
|
// String strPathFileName(strPathDirectory+String("\\")+strPathFileNames[index]);
|
|
// mThumbPage.insert(strPathFileName,pureDevice);
|
|
// if(index>3)break;
|
|
// }
|
|
// cursorControl.waitCursor(FALSE);
|
|
|
|
|
|
|
|
// pureDevice.colorRect(Rect(xyPoint.x()+1,xyPoint.y()+1,(xyPoint.x()+width())-2,(xyPoint.y()+height())-2),getFillColor());
|
|
|
|
|
|
// String strCaption;
|
|
// String strString;
|
|
// windowText(strCaption);
|
|
// strString=strCaption;
|
|
// strCaption=strCaption.betweenString(0,' ');
|
|
// if(strCaption.isNull())strCaption=strString;
|
|
/// strCaption+=String(" - [")+strTitle+String("]");
|
|
// setCaption(strCaption);
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
if(mMediaPak.entries())
|
|
{
|
|
GlobalData<BYTE> pakData;
|
|
PakEntry pakEntry;
|
|
for(int index=0;index<mMediaPak.entries();index++)
|
|
{
|
|
mMediaPak.getEntry(pakEntry,index);
|
|
mThumbPage.insert(pakEntry,pureDevice);
|
|
}
|
|
merge(mMediaPak,strPathFileNames,strPathDirectory,pureDevice);
|
|
}
|
|
else
|
|
{
|
|
// setTitle(strPathDirectory);
|
|
// getDirectoryFileNames(strPathDirectory,strPathFileNames);
|
|
for(int index=0;index<strPathFileNames.size();index++)
|
|
{
|
|
GlobalData<BYTE> rawData;
|
|
PakEntry pakEntry;
|
|
|
|
String strPathFileName(strPathDirectory+String("\\")+strPathFileNames[index]);
|
|
mThumbPage.insert(strPathFileName,pureDevice);
|
|
mThumbPage[mThumbPage.entries()-1].getRawData(rawData);
|
|
pakEntry.type(PakEntry::Blob);
|
|
pakEntry.name(strPathFileNames[index]);
|
|
pakEntry.id(mMediaPak.entries());
|
|
pakEntry.rawData(rawData);
|
|
mMediaPak.add(pakEntry);
|
|
}
|
|
}
|
|
#endif
|
|
|
|
|
|
// merge(mMediaPak,strPathFileNames,strPathDirectory,pureDevice);
|
|
// for(int index=0;index<mMediaPak.entries();index++)
|
|
// {
|
|
// mMediaPak.getEntry(pakEntry,index);
|
|
// mThumbPage.insert(pakEntry,pureDevice);
|
|
// }
|
|
|
|
|
|
|
|
|
|
void BrowseView::analyze(PakEntry &pakEntry)
|
|
{
|
|
GlobalData<BYTE> &rawData=pakEntry.rawData();
|
|
int span=0;
|
|
int maxSpan=0;
|
|
int numSpans=0;
|
|
int totalSpans=0;
|
|
int avgSpans;
|
|
BYTE currByte;
|
|
|
|
for(int index=0;index<rawData.size();index++)
|
|
{
|
|
if(!index)currByte=rawData[index];
|
|
else
|
|
{
|
|
if(rawData[index]==currByte)span++;
|
|
else
|
|
{
|
|
if(span>maxSpan)maxSpan=span;
|
|
totalSpans+=span;
|
|
span=0;
|
|
currByte=rawData[index];
|
|
numSpans++;
|
|
}
|
|
}
|
|
}
|
|
avgSpans=totalSpans/numSpans;
|
|
}
|
|
|
|
|
|
analyze(pakEntry);
|
|
|
|
|
|
|
|
void BrowseView::analyze(PakEntry &pakEntry)
|
|
{
|
|
GlobalData<BYTE> &rawData=pakEntry.rawData();
|
|
int span=0;
|
|
int maxSpan=0;
|
|
int numSpans=0;
|
|
int totalSpans=0;
|
|
int avgSpans;
|
|
BYTE currByte;
|
|
|
|
for(int index=0;index<rawData.size();index++)
|
|
{
|
|
if(!index)currByte=rawData[index];
|
|
else
|
|
{
|
|
if(rawData[index]==currByte)span++;
|
|
else
|
|
{
|
|
if(span>maxSpan)maxSpan=span;
|
|
totalSpans+=span;
|
|
span=0;
|
|
currByte=rawData[index];
|
|
numSpans++;
|
|
}
|
|
}
|
|
}
|
|
avgSpans=totalSpans/numSpans;
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef _BROWSE_IMAGERAW_HPP_
|
|
#define _BROWSE_IMAGERAW_HPP_
|
|
|
|
class DIB24Raw
|
|
{
|
|
public:
|
|
DIB24Raw(void);
|
|
DIB24Raw(const DIB24Raw &someDIB24Raw);
|
|
DIB24Raw &operator=(const DIB24Raw &someDIB24Raw);
|
|
BitmapInfo &getBitmapInfo(void);
|
|
void setBitmapInfo(const BitmapInfo &someBitmapInfo);
|
|
Array<RGB888> &getRGBArray(void);
|
|
void setRGBArray(Array<RGB888> &someRGBArray);
|
|
private:
|
|
BitmapInfo mBitmapInfo;
|
|
Array<RGB888> mRGBArray;
|
|
};
|
|
|
|
|
|
|
|
|
|
bool getRawData(GlobalData<BYTE> &rawData);
|
|
bool setRawData(GlobalData<BYTE> &rawData,PureDevice &pureDevice);
|
|
RGB888 getAt(DWORD row,DWORD col)const;
|
|
private:
|
|
JPGImage(const JPGImage &someJPGImage);
|
|
JPGImage &operator=(const JPGImage &someJPGImage);
|
|
void verifyDimensions(BitmapInfo &someBitmapInfo);
|
|
void destroy(void);
|
|
|
|
HBITMAP mhBitmap;
|
|
BitmapInfo mBitmapInfo;
|
|
Array<RGB888> mRGBArray;
|
|
|
|
|
|
#endif
|
|
|
|
#include <mediapak/mediapak.hpp>
|
|
|
|
|
|
|
|
String strPathFileName("d:\\download\\altbin~1.den.pak");
|
|
String strString;
|
|
MediaPak mediaPak;
|
|
PakEntry pakEntry;
|
|
DWORD elapsedTime;
|
|
DWORD entries;
|
|
|
|
mediaPak.open(strPathFileName,MediaPak::OpenAlways);
|
|
entries=mediaPak.entries();
|
|
if(!entries)return 0;
|
|
elapsedTime=::GetTickCount();
|
|
for(int index=0;index<entries;index++)
|
|
{
|
|
mediaPak.getEntry(pakEntry,index);
|
|
}
|
|
::sprintf(strString,"time:%d seconds\n",(::GetTickCount()-elapsedTime)/1000);
|
|
::OutputDebugString(strString);
|
|
|
|
|
|
if(xyPoint.x()+ptrThumbNail->width()>=mDIB24.width()||xyPoint.y()+ptrThumbNail->height()>=mDIB24.height())break;
|
|
|
|
bool ThumbPage::createBitmap(GUIWindow &guiWindow)
|
|
{
|
|
PureDevice pureDevice(guiWindow);
|
|
// PureDevice compatibleDevice;
|
|
GDIPoint gdiPoint;
|
|
|
|
if(!mThumbNails.size()||!guiWindow.isValid())return false;
|
|
if(!getDimensions(guiWindow,gdiPoint))return false;
|
|
mDIB24.create(gdiPoint.x(),-gdiPoint.y(),pureDevice);
|
|
mDIB24.setBits(BkColorBits);
|
|
// compatibleDevice.compatibleDevice(pureDevice);
|
|
// compatibleDevice.select(mDIB24.getBitmap());
|
|
drawThumbNails(compatibleDevice,guiWindow);
|
|
isDirty(false);
|
|
return mDIB24.isOkay();
|
|
}
|
|
|
|
|
|
|
|
bool DIB24::setAt(DWORD row,DWORD col,JPGImage &jpgImage)
|
|
{
|
|
DWORD srcWidth;
|
|
DWORD srcHeight;
|
|
DWORD dstWidth;
|
|
DWORD dstHeight;
|
|
RGB888 rgb888;
|
|
|
|
if(!isOkay())return false;
|
|
srcWidth=jpgImage.width();
|
|
srcHeight=jpgImage.height();
|
|
dstWidth=mBitmapInfo.width();
|
|
dstHeight=mBitmapInfo.height()<0?-mBitmapInfo.height():mBitmapInfo.height();
|
|
for(int srcRow=0,dstRow=row;srcRow<srcHeight;srcRow++,dstRow++)
|
|
{
|
|
RGB888 *ptrSrcCol;
|
|
RGB888 *ptrDstCol;
|
|
|
|
DWORD srcCol=0;
|
|
DWORD dstCol=col;
|
|
|
|
if(jpgImage.mBitmapInfo.height()<0)ptrSrcCol=&jpgImage.mRGBArray[srcRow*jpgImage.width()+srcCol];
|
|
else ptrSrcCol=&jpgImage.mRGBArray[(jpgImage.mBitmapInfo.width()*(-jpgImage.mBitmapInfo.height()))-(((srcRow*jpgImage.mBitmapInfo.width())+jpgImage.mBitmapInfo.width()))+srcCol];
|
|
if(mBitmapInfo.height()<0)ptrDstCol=&mpRGBArray[dstRow*width()+dstCol];
|
|
else ptrDstCol=&mpRGBArray[(mBitmapInfo.width()*(-mBitmapInfo.height()))-(((dstRow*mBitmapInfo.width())+mBitmapInfo.width()))+dstCol];
|
|
::memcpy(ptrDstCol,ptrSrcCol,srcWidth*sizeof(RGB888));
|
|
// for(int srcCol=0,dstCol=col;srcCol<srcWidth;srcCol++,dstCol++)
|
|
// {
|
|
// jpgImage.getAt(srcRow,srcCol,rgb888);
|
|
// setAt(dstRow,dstCol,rgb888);
|
|
// }
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
bool ThumbNail::setImage(const String &strPathFileName,PureDevice &pureDevice)
|
|
{
|
|
mImage.decode(strPathFileName,pureDevice);
|
|
if(!mImage.isOkay())return false;
|
|
mStrPathFileName=strPathFileName;
|
|
// mImage.resample(pureDevice,DefaultResampleWidth);
|
|
mImage.resample(pureDevice,DefaultResampleWidth,DefaultResampleWidth);
|
|
return true;
|
|
}
|