bufferx[i/2+xs/2]=temp2: for(k=O:k<x img[n][k]=bufferx[k]: //***Filter in the vertical direction***// for(n=0:n<xs:n++) for(i=0:i<ys:i+=2) temnl=0. templ=templ+h[j+(DD-1)/2]*img[a(i+j,ys)][n]: for(j=-(DD-1)/2+1:j=(DD-1)/2+1;j+) temp2=temp2+g[j+(DD-1)/2-1]*img[a(i+j,ys)][n]: buffery「i/2]=temn1 buffery[i/2+ys/2]=temp2: for (k=0:k<ys:k++) img[k][n]=buffery[k]: /*林二维小波重构********/ void iwt(int xs,int ys,long xsize,long ysize) int i.i.k.n: //**Filter in the vertical direction******// for(n=0:n<xs:n++) for (k=0:k<ys/2:k++) buffer1[k*2]=img[k][n] bufferl[k*2+1]=0: for(i=0:i<vs:i++) temp1-0 for(Gj=-(DD-1)/2:jK=(DD-1)/2:j+) templ=temp1+hi[j+(DD-1)/2]*bufferl[a(i+j,ys)]: buffer2[i]=templ:
bufferx[i/2+xs/2]=temp2; } for(k=0;k<xs;k++) img[n][k]=bufferx[k]; } //*****Filter in the vertical direction*****// for(n=0;n<xs;n++) { for(i=0;i<ys;i+=2) { temp1=0; temp2=0; for(j=-(DD-1)/2;j<=(DD-1)/2;j++) temp1=temp1+h[j+(DD-1)/2]*img[a(i+j,ys)][n]; for(j=-(DD-1)/2+1;j<=(DD-1)/2+1;j++) temp2=temp2+g[j+(DD-1)/2-1]*img[a(i+j,ys)][n]; buffery[i/2]=temp1; buffery[i/2+ys/2]=temp2; } for(k=0;k<ys;k++) img[k][n]=buffery[k]; } } //*****二维小波重构*********************// void iwt(int xs,int ys,long xsize,long ysize) { int i,j,k,n; float temp1,temp2; float buffer1[SIZE], buffer2[SIZE]; //**Filter in the vertical direction******// for(n=0;n<xs;n++) { for(k=0;k<ys/2;k++) { buffer1[k*2]=img[k][n]; buffer1[k*2+1]=0; } for(i=0;i<ys;i++) { temp1=0; for(j=-(DD-1)/2;j<=(DD-1)/2;j++) temp1=temp1+hi[j+(DD-1)/2]*buffer1[a(i+j,ys)]; buffer2[i]=temp1;
for(k=0:k<ys/2:k++) buffer1[k*2]=img[k+ys/2][n]: bufferl[k#2+1]=0: for(i=0:i(ys:i++) templ=0: for(j=-(DD-1)/2-1:i=(①D-1)/2-1:i++) templ=templ+gi[j+(DD-1)/2+l]*bufferl[a(i+j.ys)]: temp2=templ+buffer2[i]: buffer2[i]-temp2 for (k=0:k<ys:k++) img[k][n]=buffer2[k] 1 //**Filter in the horizontal direction*// for(n=0:n<ys:n++ for(k=0:k<xs/2:k++) bufferl[k*2]=img[n][k] bufferl[k*2+l]-0 for(i=0:i<xs:i++) templ=O: for(-(DD-1)/2:(DD-1)/2:+) templ=templ+hi[j+(DD-1)/2]*bufferl[a(i+j,xs)] buffer2[i]=templ: for (k=0:k<xs/2:k++) buffer1[k*2]=img[n][k+xs/2] bufferl[k*2+l]=0: for (i=0:i<xs:i++) templ-0 for(j=-(DD-1)/2-1:j=(0D-1)/2-1:j+ templ=templ+gi[j+(DD-1)/2+l]*bufferl[a(i+j,xs)]: temp2=templ+buffer2[i]: buffer2[i]=temp2:
} for(k=0;k<ys/2;k++) { buffer1[k*2]=img[k+ys/2][n]; buffer1[k*2+1]=0; } for(i=0;i<ys;i++) { temp1=0; for(j=-(DD-1)/2-1;j<=(DD-1)/2-1;j++) temp1=temp1+gi[j+(DD-1)/2+1]*buffer1[a(i+j,ys)]; temp2=temp1+buffer2[i]; buffer2[i]=temp2; } for(k=0;k<ys;k++) img[k][n]=buffer2[k]; } //*****Filter in the horizontal direction*****// for(n=0;n<ys;n++) { for(k=0;k<xs/2;k++) { buffer1[k*2]=img[n][k]; buffer1[k*2+1]=0; } for(i=0;i<xs;i++) { temp1=0; for(j=-(DD-1)/2;j<=(DD-1)/2;j++) temp1=temp1+hi[j+(DD-1)/2]*buffer1[a(i+j,xs)]; buffer2[i]=temp1; } for(k=0;k<xs/2;k++) { buffer1[k*2]=img[n][k+xs/2]; buffer1[k*2+1]=0; } for(i=0;i<xs;i++) { temp1=0; for(j=-(DD-1)/2-1;j<=(DD-1)/2-1;j++) temp1=temp1+gi[j+(DD-1)/2+1]*buffer1[a(i+j,xs)]; temp2=temp1+buffer2[i]; buffer2[i]=temp2;
for(k=0:k<xs:k++) img[n][k]=buffer2[k]*4 //Constructor for a TBmpViewWindow,sets scroll styles and constructs /the Scroller obje ect. Also sets the Rop based on whether the displa is monochrome (two-color)or polychrome void TBmpViewWindow:ShowSubWindow (TWindow*parent) if (!SubWinPtr) (SubWinPtr new TSubWindow(parent))->Create(); else SubWinPtr->SetFocus(: SubWinPtr->SetActiveWindow(: SubWinPtr->Invalidate(1); TBmpViewWindow::TBmpViewWindow( TWindow(0,0,0),TClipboardviewer( /Init TWindow since TClipboardviewer is usually a mixin and doesn't do it // /Init(0,0,0) Attr.Stvle =WS VSCROLL I WS HSCROLL Attr.W=640:Attr.H=480: Dib =0; Bitmap 0; pMemDC=0: Palette 0: BkgndBrush new TBrush(::GetSysColor(COLOR WINDOW)) Scroller=new TScroller(this,1,1 200,200); Fit FALSE: AutoClipview FALSE: TScreenDC screenDC;
} for(k=0;k<xs;k++) img[n][k]=buffer2[k]*4; } } // // Constructor for a TBmpViewWindow, sets scroll styles and constructs // the Scroller object. Also sets the Rop based on whether the display // is monochrome (two-color) or polychrome. // void TBmpViewWindow::ShowSubWindow(TWindow* parent) { if (!SubWinPtr) (SubWinPtr = new TSubWindow(parent))->Create(); else { SubWinPtr->SetFocus(); SubWinPtr->SetActiveWindow(); } SubWinPtr->Invalidate(1); } TBmpViewWindow::TBmpViewWindow() : TWindow(0, 0, 0), TClipboardViewer() { // Init TWindow since TClipboardViewer is usually a mixin and doesn't do it // // Init(0, 0, 0); Attr.Style |= WS_VSCROLL | WS_HSCROLL; Attr.W=640;Attr.H=480; Dib = 0; Bitmap = 0; pMemDC=0; Palette = 0; BkgndBrush = new TBrush(::GetSysColor(COLOR_WINDOW)); Scroller = new TScroller(this, 1, 1, 200, 200); Fit = FALSE; AutoClipView = FALSE; TScreenDC screenDC;
if (screenDC.GetDeviceCaps(NUMCOLORS)3 Rop NOTSRCCOPY: else Rop SRCCOPY: SetCaption(0) TBmpViewWindow::TBmpViewWindowO if(Bitman!=0) delete Bitmapi if(Palette!-0) delete Palette: if(Dib!=0) delete dib if(pMemDC!=0) delete pMemDC delete BkgndBrush: //Build up a caption based on a filename,and set it into the title. void [BmpViewWindow::SetCaption(const char*name) char caption [MAXPATH MAXAPPNAME +2+1] strcpy ame name e:(Untitled)' strepy(caption,GetApplication()->GetName() strcat(caption. strcat(caption,FileName): if (Parent) Parent->SetCaption(caption) /Make a metafile put it on the clipboard. //Make a copy of each of the objects place the copies on the clipboard void TBmpViewWindow::CmCopy()
if (screenDC.GetDeviceCaps(NUMCOLORS) < 3 ) Rop = NOTSRCCOPY; else Rop = SRCCOPY; SetCaption(0); } TBmpViewWindow::~TBmpViewWindow() { if(Bitmap!=0) delete Bitmap; if(Palette!=0) delete Palette; if(Dib!=0) delete Dib; if(pMemDC!=0) delete pMemDC; delete BkgndBrush; } // // Build up a caption based on a filename, and set it into the title. // void TBmpViewWindow::SetCaption(const char* name) { char caption[MAXPATH + MAXAPPNAME + 2 + 1]; strcpy(FileName, name ? name : "(Untitled)"); strcpy(caption, GetApplication()->GetName()); strcat(caption, " - "); strcat(caption, FileName); if (Parent) Parent->SetCaption(caption); } // // Make a metafile & put it on the clipboard. // Make a copy of each of the objects & place the copies on the clipboard // void TBmpViewWindow::CmCopy() { }
void ce.Enable(Dib !=0); //When a user selects edit.paste,get the data from the clipboard.This //routine prefers CF_META over CF_DIB over CF_BITMAP // void TBmpViewWindow::CmPaste( void TBmpViewWindow::CePaste(TCommandEnabler&ce) / //Toggle Fit member variable&adjust scroller as needed void TBmpViewWindow::CmFit() Fit IFit AdjustScroller() / /The fit menu item is checked if the Fit member is true void TBmpViewWindow:CeFit(TCommandEnabler&ce) ce.SetCheck(Fit TCommandEnabler::Checked TCommandEnabler::Unchecked): /Toggle AutoAutoClipView member variable
void TBmpViewWindow::CeCopy(TCommandEnabler& ce) { ce.Enable(Dib != 0); } // // When a user selects edit.paste, get the data from the clipboard. This // routine prefers CF_META over CF_DIB over CF_BITMAP // void TBmpViewWindow::CmPaste() { } void TBmpViewWindow::CePaste(TCommandEnabler& ce) { } // // // Toggle Fit member variable & adjust scroller as needed // void TBmpViewWindow::CmFit() { Fit = !Fit; AdjustScroller(); } // // The fit menu item is checked if the Fit member is true // void TBmpViewWindow::CeFit(TCommandEnabler& ce) { ce.SetCheck(Fit ? TCommandEnabler::Checked : TCommandEnabler::Unchecked); } // // Toggle AutoAutoClipView member variable //