//--------------------------------------------------------------------------- #include #pragma hdrstop #include "AutoRepeat_F.h" #include "FullView.h" #include "MainImage.h" #include "Palette.h" #include "Undo.h" #include "MainMenu.h" #include "StatusProgress.h" #include "Main.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "RzEdit" #pragma link "RzSpnEdt" #pragma link "RzButton" #pragma link "RzPanel" #pragma link "RzBckgnd" #pragma link "RzCmboBx" #pragma resource "*.dfm" //--------------------------------------------------------------------------- #define IDS_MATCHNORMAL StringTable[0] #define IDS_HALFDROPVER StringTable[1] #define IDS_MATCHVER StringTable[2] #define IDS_HALFDROPHOR StringTable[3] #define IDS_MATCHHOR StringTable[4] #define IDS_FALSE StringTable[5] #define IDS_TRUE StringTable[6] #define IDS_SIZE StringTable[7] #define IDS_MANUALREPEAT StringTable[8] #define IDS_AUTOREPEAT StringTable[9] #define IDS_REPEATMESSAGEBOX StringTable[10] #define IDS_REPEAT StringTable[11] #define IDS_MSG_01 StringTable[12] //--------------------------------------------------------------------------- TAutoRepeatForm *AutoRepeatForm; //--------------------------------------------------------------------------- __fastcall TAutoRepeatForm::TAutoRepeatForm(TComponent* Owner) : TForm(Owner) { hWnd = ((TWinControl *)Owner)->Handle; //============================= 2001.3.27 lhskys FormCreate(TObject *Sender)³»¿ë ¿Å±è //========================================================================== StringTable.Create(DirectoryBin, Language, "Repeat"); SetSmallFont(Font); SetSmallFont(LabelMax1->Font); LabelMax1->Caption = IDS_COMMON_MAX; rzbtANormal->Caption = IDS_COMMON_NORMAL; rzbtAVer->Caption = IDS_COMMON_HDVER; rzbtAHor->Caption = IDS_COMMON_HDHOR; rzbtStop->Caption = IDS_COMMON_EXIT; //========================================================================== MakeMenuHintByShortcut(); dncount = 0; // AutoLayerBU = NULL; //====================================== } //--------------------------------------------------------------------------- // Public Function //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::InitForm(bool second) { TCursor OldCursor; int w, h, hw, hh; /// °¢ Formµé µ¶¸³ÀûÀ¸·Î °ü¸®Çϱâ À§ÇØ ÁÖ¼®Ã³¸® if (!second) ParentHeight = Parent->Height+20; OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; Image = MainImageForm->iMainImage; window.s.x = MainImageForm->WorkArea->Range.left; window.s.y = MainImageForm->WorkArea->Range.top; window.e.x = MainImageForm->WorkArea->Range.right; window.e.y = MainImageForm->WorkArea->Range.bottom; window.size.x = window.e.x - window.s.x; window.size.y = window.e.y - window.s.y; if (Image->uBitmap->BitsPerPixel==8) { MainImageForm->Palette->ToRGBQUAD(rgb, 256); } if(MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { InitAuto_RepForm(); rzbtStop->Enabled = true; if (MainImageForm->iMainImage->LayerMask) { if(MainImageForm->LARSW == false)rzbtStop->Enabled = false; if(MainImageForm->LayerCNT != MainImageForm->ARLayerCnt)rzbtStop->Enabled = false; }else if(MainImageForm->LARSW)rzbtStop->Enabled = false; } Screen->Cursor = OldCursor; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::ExitForm(void) { BEGIN_LOG(""); MainImageForm->iMainImage->SubVisible = false; MainImageForm->iMainImage->SubEnabled = false; MainImageForm->iMainImage->SubMethod = false; MainImageForm->iMainImage->ExitBackGround(0x08); END_LOG; } //--------------------------------------------------------------------------- //============================================================================= // For Auto Repeat Functions //============================================================================= //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::sbRepClick(TObject *Sender) { BEGIN_LOG(""); HDC PreDC = NULL; TSpeedButton *sp = (TSpeedButton *)Sender; RECT rc; TCursor OldCursor; // for PFM by celberus OldCursor = Screen->Cursor; // for PFM by celberus Screen->Cursor = crHourGlass; // for PFM by celberus if (!sp->Tag == 0) { if (MainImageForm->AutoRepeat == false) { // Undo->RemoveAll(); rc = MainImageForm->WorkArea->Range; MainImageForm->UndoSave(UK_REPEAT, rc); // MainImageForm->UndoSave(UK_REPEAT, Rect(0, 0, 0, 0)); AutoRepeatView(); MainImageForm->arwindow.s.x = window.s.x; MainImageForm->arwindow.s.y = window.s.y; MainImageForm->arwindow.e.x = window.e.x;// + window.size.x%2; MainImageForm->arwindow.e.y = window.e.y;// + window.size.y%2; MainImageForm->WidthR = window.size.x%2; MainImageForm->HeightR = window.size.y%2; MainImageForm->arwindow.size.x = window.size.x;// + window.size.x%2; MainImageForm->arwindow.size.y = window.size.y;// + window.size.y%2; //========================================= Delete WorkArea for BitBlt MainImageForm->WorkArea->ResetRegion(MainImageForm->iMainImage); MainImageForm->WorkAreaChange(); MainForm->UpdateMenuItems(MainImageForm); //========================================== Image->SubVisible = false; // for PFM by celberus Image->SubEnabled = false; // for PFM by celberus Image->SubMethod = false; // for PFM by celberus InitCanvas(); } InitAuto_RepForm(); MainImageForm->AutoRepeat = true; } Screen->Cursor = OldCursor; // for PFM by celberus END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::rzbtAMethodClick(TObject *Sender) { BEGIN_LOG(""); TSpeedButton *sp = (TSpeedButton *)Sender; if (sp->Tag == 1) { MainImageForm->ARTItem = AREPEAT_NORMAL; rzbtANormal->Down = true; LabelMax1->Enabled = false; ComboBoxWH1->Enabled = false; }else if (sp->Tag == 2) { ARMaxSize = MainImageForm->arwindow.size.y - 1; rzbtAVer->Down = true; MainImageForm->ARTItem = AREPEAT_HDVER; LabelMax1->Enabled = true; ComboBoxWH1->Enabled = true; ComboBoxWH1->Text = Hdiv; LabelMax1->Caption = Format(IDS_COMMON_MAX + " : %d", OPENARRAY(TVarRec, (ARMaxSize))); }else{ ARMaxSize = MainImageForm->arwindow.size.x - 1; rzbtAHor->Down = true; MainImageForm->ARTItem = AREPEAT_HDHOR; LabelMax1->Enabled = true; ComboBoxWH1->Enabled = true; ComboBoxWH1->Text = Wdiv; LabelMax1->Caption = Format(IDS_COMMON_MAX + " : %d", OPENARRAY(TVarRec, (ARMaxSize))); } SpreadArea(); // MainImageForm->RedrawingRepeat(false, false); MainImageForm->iMainImage->Repaint(); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::InitAuto_RepForm() { BEGIN_LOG(""); ClientHeight = 180; /// °¢ Formµé µ¶¸³ÀûÀ¸·Î °ü¸®Çϱâ À§ÇØ ÁÖ¼®Ã³¸® //Parent->Height = ParentHeight+ClientHeight; /// °¢ Formµé µ¶¸³ÀûÀ¸·Î °ü¸®Çϱâ À§ÇØ ÁÖ¼®Ã³¸® Parent->Repaint(); // for PFM by celberus if (MainImageForm->AutoRepeat == false) { // MainImageForm->ARTItem = AREPEAT_NORMAL; //by maxleo21c (06.10.13) : ±âÁ¸ Çß´ø °ÍÀ» ±â¾ïÇϱâ À§Çؼ­ ±×³É ÁÖ¼® ó¸®ÇÔ // rzbtANormal->Down = true; SpreadArea(); FullViewForm->FormResize(this); // for PFM by celberus MainImage¿¡¼­ À̵¿ MainImageForm->iMainImage->OnPaintRange = MainImageForm->DrawARepeatArea; MainImageForm->iMainImage->isRepaintAll = true; // by celberus Image->SetPosition(0, 0); // ARÈ­¸é À§Ä¡ ¹®Á¦ ¶§¹®¿¡.. by celberus MainImageForm->iMainImage->Repaint(); } else { Hdiv = MainImageForm->MHdiv; Wdiv = MainImageForm->MWdiv; if (MainImageForm->ARTItem == AREPEAT_NORMAL) rzbtANormal->Down = true; else if (MainImageForm->ARTItem == AREPEAT_HDVER){ ARMaxSize = MainImageForm->arwindow.size.y - 1; rzbtAVer->Down = true; ComboBoxWH1->Text = Hdiv; LabelMax1->Caption = Format(IDS_COMMON_MAX + " : %d", OPENARRAY(TVarRec, (ARMaxSize))); }else { ARMaxSize = MainImageForm->arwindow.size.x - 1; rzbtAHor->Down = true; ComboBoxWH1->Text = Wdiv; LabelMax1->Caption = Format(IDS_COMMON_MAX + " : %d", OPENARRAY(TVarRec, (ARMaxSize))); } ComboBoxWH1->Enabled = true; LabelMax1->Enabled = true; } Wdiv = window.size.x / 2; Hdiv = window.size.y / 2; Image->SubVisible = false; Image->SubEnabled = false; Image->SubMethod = false; Image->ExitBackGround(0x08); MainImageForm->sbAutoRepView->Enabled = true; MainImageForm->AutoRepUpdateMenu(false); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::InitCanvas() { BEGIN_LOG(""); int w, h, www, hhh; int x, y, sx, sy; COLORREF C; RECT rt, st; // TUnionBitmap *MMask = NULL; // convert by celberus // TUnionBitmap *ARTemp = NULL, *LMask; // convert by celberus sx = MainImageForm->arwindow.s.x; sy = MainImageForm->arwindow.s.y; w = MainImageForm->arwindow.size.x; h = MainImageForm->arwindow.size.y; www = MainImageForm->iMainImage->uBitmap->Width; hhh = MainImageForm->iMainImage->uBitmap->Height; rt = Rect(sx, sy, sx+w, sy+h); st = Rect(0, 0, MainImageForm->iMainImage->uBitmap->Width, MainImageForm->iMainImage->uBitmap->Height); if (MainImageForm->iMainImage->uBitmap->BitsPerPixel == 8) { MainImageForm->Palette->ToRGBQUAD(rgb, 256);//by jeegeo //ÆÈ·¹Æ® º¯È­¸¦ ¾÷µ¥ÀÌÆ®ÇÑ´Ù // C = PaletteForm->DIB256Palette->GetBGCOLORREF(8); C = PALETTEINDEX(0x01); // 0xFF °¡ µÇ´Â ¿¡·¯°¡ À־.. by celberus MainImageForm->iMainImage->InitAutoRepeat(MainImageForm->LayerCNT-1,rt,C); } else { C = PaletteForm->DIB256Palette->GetBGCOLORREF(24); // MainImageForm->iMainImage->InitAutoRepeat(MainImageForm->LayerCNT-1,rt,2*w,2*h,C); MainImageForm->iMainImage->InitAutoRepeat(MainImageForm->LayerCNT-1,rt,C); } if ((2*w > www) || (2*h > hhh)) { //Move Bitmap // if (2*w > www) www = 2*w; www = 2*w; hhh = 2*h; // if (2*h > hhh) hhh = 2*h; //MainImageForm->EnlargeCanvas(www, hhh); MainImageForm->EnlargeCanvasInAutoRepeat(); } if ((sx < w/2) || ((sx+w) > (www-w/2)) || (sy < h/2) || ((sy+h) > (hhh-h/2))) { sx = www/2 - w/2; sy = hhh/2 - h/2; MainImageForm->arwindow.s.x = sx; MainImageForm->arwindow.s.y = sy; MainImageForm->arwindow.e.x = sx + w; MainImageForm->arwindow.e.y = sy + h; } END_LOG; return; fail: // if (MMask) {delete MMask; MMask = NULL;} // if (ARTemp) {delete ARTemp; ARTemp = NULL;} EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); END_LOG; /* int w, h, www, hhh; int x, y, sx, sy; COLORREF C; RECT rt, st; TUnionBitmap *MMask = NULL; // convert by celberus TUnionBitmap *ARTemp = NULL, *LMask; // convert by celberus sx = MainImageForm->arwindow.s.x; sy = MainImageForm->arwindow.s.y; w = MainImageForm->arwindow.size.x; h = MainImageForm->arwindow.size.y; www = MainImageForm->iMainImage->uBitmap->Width; hhh = MainImageForm->iMainImage->uBitmap->Height; rt = Rect(sx, sy, sx+w, sy+h); st = Rect(0, 0, MainImageForm->iMainImage->uBitmap->Width, MainImageForm->iMainImage->uBitmap->Height); if (MainImageForm->iMainImage->uBitmap->BitsPerPixel == 8) { MainImageForm->Palette->ToRGBQUAD(rgb, 256);//by jeegeo //ÆÈ·¹Æ® º¯È­¸¦ ¾÷µ¥ÀÌÆ®ÇÑ´Ù C = PaletteForm->DIB256Palette->GetBGCOLORREF(8); if ((ARTemp = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!ARTemp->Create(w, h, 8, rgb)) goto fail; ARTemp->CopyFromRect(MainImageForm->iMainImage->uBitmap, rt.left, rt.top, SRCCOPY); MainImageForm->iMainImage->uBitmap->FillRect(st, C); if (MainImageForm->iMainImage->Mask) { if ((MMask = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!MMask->Create(w, h, 8, rgb)) goto fail; MMask->CopyFromRect(MainImageForm->iMainImage->Mask, rt.left, rt.top, SRCCOPY); MainImageForm->iMainImage->Mask->FillRect(st, 0x00); } if (MainImageForm->iMainImage->LayerMask) { if ((LMask = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!LMask->Create(w, h, 8, rgb)) goto fail; LMask->CopyFromRect(MainImageForm->iMainImage->LayerMask, rt.left, rt.top, SRCCOPY); MainImageForm->iMainImage->LayerMask->FillRect(st, PALETTEINDEX(255)); } } else { C = PaletteForm->DIB256Palette->GetBGCOLORREF(24); if ((ARTemp = new TUnionBitmap) == NULL) goto fail; // covert by celberus if (!ARTemp->Create(w, h, 24)) goto fail; ARTemp->CopyFromRect(MainImageForm->iMainImage->uBitmap, rt.left, rt.top, SRCCOPY); MainImageForm->iMainImage->uBitmap->FillRect(st, C); if (MainImageForm->iMainImage->Mask) { if ((MMask = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!MMask->Create(w, h, 1)) goto fail; MMask->CopyFromRect(MainImageForm->iMainImage->Mask, rt.left, rt.top, SRCCOPY); MainImageForm->iMainImage->Mask->FillRect(st, 0x00); } if (MainImageForm->iMainImage->LayerMask) { if ((LMask = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!LMask->Create(w, h, 1)) goto fail; LMask->CopyFromRect(MainImageForm->iMainImage->LayerMask, rt.left, rt.top, SRCCOPY); MainImageForm->iMainImage->LayerMask->FillRect(st, clWhite); } } if ((2*w > www) || (2*h > hhh)) { //Move Bitmap if (2*w > www) www = 2*w; if (2*h > hhh) hhh = 2*h; MainImageForm->EnlargeCanvas(www, hhh); } if ((sx < w/2) || ((sx+w) > (www-w/2)) || (sy < h/2) || ((sy+h) > (hhh-h/2))) { sx = www/2 - w/2; sy = hhh/2 - h/2; MainImageForm->arwindow.s.x = sx; MainImageForm->arwindow.s.y = sy; MainImageForm->arwindow.e.x = sx + w; MainImageForm->arwindow.e.y = sy + h; } if (MainImageForm->iMainImage->LayerMask) { MainImageForm->iMainImage->LayerMask->CopyToRect(sx, sy, LMask, SRCCOPY); delete LMask; LMask = NULL; } if (MainImageForm->iMainImage->Mask) { MainImageForm->iMainImage->Mask->CopyToRect(sx, sy, MMask, SRCCOPY); delete MMask; MMask = NULL; } MainImageForm->iMainImage->uBitmap->CopyToRect(sx, sy, ARTemp, SRCCOPY); delete ARTemp; ARTemp = NULL; return; fail: if (MMask) {delete MMask; MMask = NULL;} if (ARTemp) {delete ARTemp; ARTemp = NULL;} EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); */ } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::makeSpreadImage_Normal(TUnionBitmap *aBitmap) { BEGIN_LOG(""); int ARWidthR = MainImageForm->WidthR, ARHeightR = MainImageForm->HeightR; int sx = MainImageForm->arwindow.s.x, sy = MainImageForm->arwindow.s.y; int ex = MainImageForm->arwindow.e.x, ey = MainImageForm->arwindow.e.y; int hw = (ex - sx)/2, hh = (ey - sy)/2; aBitmap->CopyToItself(sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, hh+ARHeightR, sx+hw, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(ex, sy-hh-ARHeightR, hw, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR,sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(ex, sy, hw, 2*hh+ARHeightR,sx, sy, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, ey, hw+ARWidthR, hh, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(sx, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); aBitmap->CopyToItself(ex, ey, hw, hh, sx, sy, SRCCOPY); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::makeSpreadImage_HDVer(TUnionBitmap *aBitmap) // half drop vertical { BEGIN_LOG(""); int ARWidthR = MainImageForm->WidthR, ARHeightR = MainImageForm->HeightR; int sx = MainImageForm->arwindow.s.x, sy = MainImageForm->arwindow.s.y; int ex = MainImageForm->arwindow.e.x, ey = MainImageForm->arwindow.e.y; int hw = (ex - sx)/2, hh = (ey - sy)/2; int Hdiv = MainImageForm->MHdiv; if(hh > Hdiv){ aBitmap->CopyToItself(sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, hh-Hdiv+ARHeightR, sx+hw, sy+hh+Hdiv, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, sy-Hdiv, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, ey-Hdiv, hw+ARWidthR, hh+Hdiv, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(ex, sy-hh-ARHeightR, hw, hh+Hdiv+ARHeightR, sx, sy+hh-Hdiv, SRCCOPY); aBitmap->CopyToItself(ex, sy+Hdiv, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); aBitmap->CopyToItself(ex, ey+Hdiv, hw, hh-Hdiv, sx, sy, SRCCOPY); aBitmap->CopyToItself(sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); }else if(hh == Hdiv){ aBitmap->CopyToItself(sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, sy+hh, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(ex, sy-hh-ARHeightR, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); aBitmap->CopyToItself(ex, sy+hh, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); aBitmap->CopyToItself(sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); }else if(hh < Hdiv){ aBitmap->CopyToItself(sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, 3*hh-Hdiv+2*ARHeightR, sx+hw, sy+Hdiv-hh-ARHeightR, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, ey-Hdiv, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, ey+2*hh-Hdiv+ARHeightR, hw+ARWidthR, Hdiv-hh-ARHeightR, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(ex, sy-hh-ARHeightR, hw, Hdiv-hh+ARHeightR, sx, ey+hh-Hdiv, SRCCOPY); aBitmap->CopyToItself(ex, sy-2*hh+Hdiv-ARHeightR, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); aBitmap->CopyToItself(ex, sy+Hdiv, hw, 3*hh-Hdiv+ARHeightR, sx, sy, SRCCOPY); aBitmap->CopyToItself(sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::makeSpreadImage_HDHor(TUnionBitmap *aBitmap) // half drop horizontal { BEGIN_LOG(""); int ARWidthR = MainImageForm->WidthR, ARHeightR = MainImageForm->HeightR; int sx = MainImageForm->arwindow.s.x, sy = MainImageForm->arwindow.s.y; int ex = MainImageForm->arwindow.e.x, ey = MainImageForm->arwindow.e.y; int hw = (ex - sx)/2, hh = (ey - sy)/2; int Wdiv = MainImageForm->MWdiv; if(hw > Wdiv){ aBitmap->CopyToItself(sx-hw-ARWidthR, sy-hh-ARHeightR, hw-Wdiv+ARWidthR, hh+ARHeightR, sx+hw+Wdiv, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(ex-Wdiv, sy-hh-ARHeightR, hw+Wdiv, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, ey, hw+Wdiv+ARWidthR, hh, sx+hw-Wdiv, sy, SRCCOPY); aBitmap->CopyToItself(sx+Wdiv, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); aBitmap->CopyToItself(ex+Wdiv, ey, hw-Wdiv, hh, sx, sy, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(ex, sy, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); }else if(hw == Wdiv){ aBitmap->CopyToItself(sx-hw-ARWidthR, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx+hw, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); aBitmap->CopyToItself(sx+hw, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(ex, sy, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); }else if(hw < Wdiv){ aBitmap->CopyToItself(sx-hw-ARWidthR, sy-hh-ARHeightR, 3*hw-Wdiv+2*ARWidthR, hh+ARHeightR, sx-hw+Wdiv-ARWidthR, sy+hh, SRCCOPY); aBitmap->CopyToItself(ex-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(ex+2*hw-Wdiv+ARWidthR, sy-hh-ARHeightR, Wdiv-hw-ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, ey, Wdiv-hw+ARWidthR, hh, ex+hw-Wdiv, sy, SRCCOPY); aBitmap->CopyToItself(sx-2*hw+Wdiv-ARWidthR, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); aBitmap->CopyToItself(sx+Wdiv, ey, 3*hw-Wdiv+ARWidthR, hh, sx, sy, SRCCOPY); aBitmap->CopyToItself(sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); aBitmap->CopyToItself(ex, sy, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::SpreadArea() // Fill_F ¿¡µµ °°Àº Äڵ尡.. { BEGIN_LOG(""); //========================================= Delete WorkArea for BitBlt if (MainImageForm->WorkArea->Mask) { MainImageForm->WorkArea->ResetRegion(MainImageForm->iMainImage); MainImageForm->WorkAreaChange(); } //========================================== MainImageForm->MWdiv = Wdiv; //by linuxjun MainImageForm->MHdiv = Hdiv; //by linuxjun if (MainImageForm->ARTItem == AREPEAT_NORMAL) { if (!rzbtANormal->Down) rzbtANormal->Down = true; //by maxleo21c (06.10.13) makeSpreadImage_Normal(MainImageForm->iMainImage->uBitmap); if (MainImageForm->iMainImage->Mask) { makeSpreadImage_Normal(MainImageForm->iMainImage->Mask); } if (MainImageForm->iMainImage->LayerMask) { makeSpreadImage_Normal(MainImageForm->iMainImage->LayerMask); } } else if (MainImageForm->ARTItem == AREPEAT_HDVER) { //¼¼·ÎºÐÇÒ if (!rzbtAVer->Down) rzbtAVer->Down = true; //by maxleo21c (06.10.13) makeSpreadImage_HDVer(MainImageForm->iMainImage->uBitmap); if (MainImageForm->iMainImage->Mask) { makeSpreadImage_HDVer(MainImageForm->iMainImage->Mask); } if (MainImageForm->iMainImage->LayerMask) { makeSpreadImage_HDVer(MainImageForm->iMainImage->LayerMask); } } else if (MainImageForm->ARTItem == AREPEAT_HDHOR) { //°¡·ÎºÐÇÒ if (!rzbtAHor->Down) rzbtAHor->Down = true; //by maxleo21c (06.10.13) makeSpreadImage_HDHor(MainImageForm->iMainImage->uBitmap); if (MainImageForm->iMainImage->Mask) { makeSpreadImage_HDHor(MainImageForm->iMainImage->Mask); } if (MainImageForm->iMainImage->LayerMask) { makeSpreadImage_HDHor(MainImageForm->iMainImage->LayerMask); } } END_LOG; return; fail: EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::ClearOutWorkArea() { BEGIN_LOG(""); int ww, hh, sx, sy, cnt, i; RECT Dst, Dst1; COLORREF C; TPItemImage *Image = MainImageForm->iMainImage; TUnionBitmap *Lmp, *Bmp, *TLbmp = NULL, *Tbmp = NULL, *TMbmp = NULL; // convert by celberus ww = MainImageForm->arwindow.size.x; hh = MainImageForm->arwindow.size.y; sx = MainImageForm->arwindow.s.x; sy = MainImageForm->arwindow.s.y; Dst = Rect(sx-ww/2, sy-hh/2, sx+3*ww/2, sy+3*hh/2); Dst1 = Rect(sx, sy, sx+ww, sy+hh); cnt = Image->LayerList->Count; if (MainImageForm->LARSW == false) { for (i = 0; i < cnt; i++) { Bmp = Image->GetLayerBitmap(i, &Lmp); if(Lmp){ // if ((AutoLayerBU = new TUnionBitmap)==NULL) goto fail; // convert by celberus // if (Image->uBitmap->BitsPerPixel==8) { // Image->uBitmap->GetColors(0, 256, rgb); // AutoLayerBU->Create(Image->uBitmap->Width, Image->uBitmap->Height, 8, rgb); // }else { // AutoLayerBU->Create(Image->uBitmap->Width, Image->uBitmap->Height, 24); // } // AutoLayerBU->ExactCopy(Image->uBitmap); // convert by celberus /* if (Image->uBitmap->BitsPerPixel==8) { MainImageForm->AutoLayerMask->Create(Image->uBitmap->Width, Image->uBitmap->Height, 8, rgb); }else { MainImageForm->AutoLayerMask->Create(Image->uBitmap->Width, Image->uBitmap->Height, 1); } MainImageForm->AutoLayerMask->CopyFromRect(Lmp, 0, 0, SRCCOPY);*/ } } } if (MainImageForm->WorkArea->Mask) { MainImageForm->WorkArea->ResetRegion(MainImageForm->iMainImage); MainImageForm->WorkAreaChange(); } if (cnt > 1) { if (Image->uBitmap->BitsPerPixel == 8) { if ((Tbmp = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!(Tbmp->Create(ww, hh, 8, rgb))) goto fail; if ((TLbmp = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!(TLbmp->Create(ww, hh, 8, rgb))) goto fail; /* if (Image->Mask) { if ((TMbmp = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!(TMbmp->Create(ww, hh, 8, rgb))) goto fail; TMbmp->CopyFromRect(Image->Mask, sx, sy, SRCCOPY); Image->Mask->FillRect(Dst, 0x00); Image->Mask->CopyToRect(sx, sy, TMbmp, SRCCOPY); } */ C = PaletteForm->DIB256Palette->GetBGCOLORREF(8); if (MainImageForm->LARSW) { for (i = 0; i < cnt; i++) { Bmp = Image->GetLayerBitmap(i, &Lmp); Tbmp->Copy(0, 0, Tbmp->Width, Tbmp->Height, Bmp, sx, sy, SRCCOPY); // convert by celberus Bmp->FillRect(Dst1, C); Bmp->CopyToRect(sx, sy, Tbmp, SRCCOPY); if (Lmp) { if(MainImageForm->LayerCNT == i+1){ TLbmp->CopyFromRect(Lmp, sx, sy, SRCCOPY); Lmp->FillRect(Dst, PALETTEINDEX(255)); Lmp->CopyToRect(sx, sy, TLbmp, SRCCOPY); // MainImageForm->AutoLayerMask->Create(Image->uBitmap->Width, Image->uBitmap->Height, 1); // MainImageForm->AutoLayerMask->CopyFromRect(Lmp, 0, 0, SRCCOPY); } } Image->SetLayerBitmap(i); } } Image->MakeBeforeBitmap(); } else { if ((Tbmp = new TUnionBitmap) == NULL) goto fail; if (!(Tbmp->Create(ww, hh, 24))) goto fail; if ((TLbmp = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!(TLbmp->Create(ww, hh, 1))) goto fail; /* if (Image->Mask) { if ((TMbmp = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!(TMbmp->Create(ww, hh, 1))) goto fail; TMbmp->CopyFromRect(Image->Mask, sx, sy, SRCCOPY); Image->Mask->FillRect(Dst, 0x00); Image->Mask->CopyToRect(sx, sy, TMbmp, SRCCOPY); } */ C = PaletteForm->DIB256Palette->GetBGCOLORREF(24); if (MainImageForm->LARSW) { for (i = 0; i < cnt; i++) { Bmp = Image->GetLayerBitmap(i, &Lmp); Tbmp->Copy(0, 0, Tbmp->Width, Tbmp->Height, Bmp, sx, sy, SRCCOPY); // convert by celberus Bmp->FillRect(Dst1, C); Bmp->CopyToRect(sx, sy, Tbmp, SRCCOPY); if (Lmp) { if(MainImageForm->LayerCNT == i+1){ TLbmp->CopyFromRect(Lmp, sx, sy, SRCCOPY); Lmp->FillRect(Dst, clWhite); Lmp->CopyToRect(sx, sy, TLbmp, SRCCOPY); // MainImageForm->AutoLayerMask->Create(Image->uBitmap->Width, Image->uBitmap->Height, 8, rgb); // MainImageForm->AutoLayerMask->CopyFromRect(Lmp, 0, 0, SRCCOPY); } } Image->SetLayerBitmap(i); } } Image->MakeBeforeBitmap(); } if (Image->Mask) {delete TMbmp; TMbmp = NULL;} delete TLbmp; TLbmp = NULL; delete Tbmp; Tbmp = NULL; } else { if (Image->uBitmap->BitsPerPixel == 8) { if ((Tbmp = new TUnionBitmap) == NULL) goto fail; // convert by celberus Image->uBitmap->GetColors(0, 256, rgb); if (!(Tbmp->Create(ww, hh, 8, rgb))) goto fail; Tbmp->Copy(0, 0, Tbmp->Width, Tbmp->Height, Image->uBitmap, sx, sy, SRCCOPY); // convet by celberus Image->uBitmap->FillRect(Dst, PaletteForm->DIB256Palette->GetBGCOLORREF(8)); Image->uBitmap->CopyToRect(sx, sy, Tbmp, SRCCOPY); /* if (Image->Mask) { if ((TMbmp = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!(TMbmp->Create(ww, hh, 8, rgb))) goto fail; TMbmp->CopyFromRect(Image->Mask, sx, sy, SRCCOPY); Image->Mask->FillRect(Dst, 0x00); Image->Mask->CopyToRect(sx, sy, TMbmp, SRCCOPY); } */ } else { if ((Tbmp = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!(Tbmp->Create(ww, hh, 24))) goto fail; Tbmp->Copy(0, 0, Tbmp->Width, Tbmp->Height, Image->uBitmap, sx, sy, SRCCOPY); // convert by celberus Image->uBitmap->FillRect(Dst, PaletteForm->DIB256Palette->GetBGCOLORREF(24)); Image->uBitmap->CopyToRect(sx, sy, Tbmp, SRCCOPY); /* if (Image->Mask) { if ((TMbmp = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (!(TMbmp->Create(ww, hh, 1))) goto fail; TMbmp->CopyFromRect(Image->Mask, sx, sy, SRCCOPY); Image->Mask->FillRect(Dst, 0x00); Image->Mask->CopyToRect(sx, sy, TMbmp, SRCCOPY); }*/ } if (Image->Mask) {delete TMbmp; TMbmp = NULL;} delete Tbmp; Tbmp = NULL; } // Image->Repaint(); END_LOG; return; fail: if (TLbmp) {delete TLbmp; TLbmp = NULL;} if (TMbmp) {delete TMbmp; TMbmp = NULL;} if (Tbmp) {delete Tbmp; Tbmp = NULL;} END_LOG; // if (AutoLayerBU) {delete AutoLayerBU; AutoLayerBU = NULL;} } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::ReturnWorkArea() { BEGIN_LOG(""); POINT sp, ep; sp = Point(MainImageForm->arwindow.s.x, MainImageForm->arwindow.s.y); ep = Point(MainImageForm->arwindow.e.x - 1, MainImageForm->arwindow.e.y - 1); MainImageForm->iMainImage->OnPaintRange = NULL; // MainImageForm->iMainImage->Repaint(); if (MainImageForm->WorkArea->Mask) MainImageForm->WorkArea->Reset(); MainImageForm->WorkArea->SetShapeRegion(MainImageForm->iMainImage, sp, ep, false); MainImageForm->WorkAreaChange(); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::AutoRepeatView() { BEGIN_LOG(""); int heightP, widthP; RECT r; pBITMAPHANDLE bh = MainImageForm->iMainImage->uBitmap->RgnBitmap->Handle; // convert by celberus TUnionBitmap *Lmp = NULL, *Bmp = NULL; // convert by celberus RGBQUAD rgb[256]; int cnt = Image->LayerList->Count; heightP = MainImageForm->iMainImage->uBitmap->Height; widthP = MainImageForm->iMainImage->uBitmap->Width; // if ((MainImageForm->AutoBitmap = new TUnionBitmap)==NULL) return; // convert by celberus // if ((MainImageForm->AutoLayerMask = new TUnionBitmap)==NULL) return; // convert by celberus if (MainImageForm->WorkArea->Mask) { if (MainImageForm->iMainImage->LayerMask) { for (int i = 0; i < cnt; i++) { Bmp = Image->GetLayerBitmap(i, &Lmp); if (Lmp) { MainImageForm->LARSW = true; if(MainImageForm->LayerCNT == i+1){ MainImageForm->ARLayerCnt = i+1; /* if (Image->uBitmap->BitsPerPixel==8) { Image->uBitmap->GetColors(0, 256, rgb); // MainImageForm->AutoBitmap->Create(widthP, heightP, 8, rgb); // MainImageForm->AutoBitmap->BackgroundColor = MainImageForm->iMainImage->uBitmap->BackgroundColor; // by celberus // MainImageForm->AutoLayerMask->Create(widthP, heightP, 8, rgb); // MainImageForm->AutoLayerMask->BackgroundColor = MainImageForm->iMainImage->LayerMask->BackgroundColor; // by celberus }else{ // MainImageForm->AutoBitmap->Create(widthP, heightP, 24); // MainImageForm->AutoBitmap->BackgroundColor = MainImageForm->iMainImage->uBitmap->BackgroundColor; // by celberus // MainImageForm->AutoLayerMask->Create(widthP, heightP, 1); // MainImageForm->AutoLayerMask->BackgroundColor = MainImageForm->iMainImage->LayerMask->BackgroundColor; // by celberus } // MainImageForm->AutoBitmap->CopyFromRect(Bmp, 0, 0, SRCCOPY); // MainImageForm->AutoLayerMask->CopyFromRect(Lmp, 0, 0, SRCCOPY); */ MainImageForm->WorkArea->SaveToFile(bh, String(DirectoryItem + "\\Repeat")); } } } }else{ MainImageForm->ARLayerCnt = 1; /* if (Image->uBitmap->BitsPerPixel==8) { Image->uBitmap->GetColors(0, 256, rgb); // MainImageForm->AutoBitmap->Create(widthP, heightP, 8, rgb); // MainImageForm->AutoBitmap->BackgroundColor = MainImageForm->iMainImage->uBitmap->BackgroundColor; // by celberus }else { // MainImageForm->AutoBitmap->Create(widthP, heightP, 24); // MainImageForm->AutoBitmap->BackgroundColor = MainImageForm->iMainImage->uBitmap->BackgroundColor; // by celberus } // MainImageForm->AutoBitmap->CopyFromRect(MainImageForm->iMainImage->uBitmap, 0, 0, SRCCOPY); */ MainImageForm->WorkArea->SaveToFile(bh, String(DirectoryItem + "\\Repeat")); /* for (int i = 0; i < cnt; i++) { Bmp = Image->GetLayerBitmap(i, &Lmp); if (Lmp) { if (Image->uBitmap->BitsPerPixel==8) { // MainImageForm->AutoLayerMask->Create(widthP, heightP, 8, rgb); }else { // MainImageForm->AutoLayerMask->Create(widthP, heightP, 1); } // MainImageForm->AutoLayerMask->CopyFromRect(Lmp, 0, 0, SRCCOPY); } } */ } } MainImageForm->BUWidth = Image->uBitmap->Width; MainImageForm->BUHeight = Image->uBitmap->Height; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::AutoRepeatViewEnd() { BEGIN_LOG(""); int heightP, widthP; TUnionBitmap *AutoBitmapUD = NULL; // convert by celberus TRect Src, SrcUD, Dst, ARrect; TUnionBitmap *ARLmp, *Lmp = NULL, *Bmp = NULL; // convert by celberus int cnt = Image->LayerList->Count; COLORREF C; RGBQUAD rgb[256]; TPLayer *lay = NULL; bool makeMask = false; if (Image->Mask && (Image->ARMaskPen == NULL)) makeMask = true; // if ((AutoBitmapUD = new TUnionBitmap)==NULL) return; // convert by celberus // if ((ARLmp = new TUnionBitmap)==NULL) return; Src = MainImageForm->WorkArea->Range; widthP = Src.Right-Src.Left; heightP = Src.Bottom-Src.Top; MainImageForm->Undo->RemoveAutoRepeatUndo(); Image->ReplaceAutoBitmap(MainImageForm->ARLayerCnt-1); if (MainImageForm->LARSW) { for (int i = 0; i < cnt; i++) { Bmp = Image->GetLayerBitmap(i, &Lmp); if (Lmp) { // if(MainImageForm->LayerCNT == i+1){ if(MainImageForm->ARLayerCnt == i+1){ // Dst = Rect(0, 0, Image->uBitmap->Width, Image->uBitmap->Height); // if (Image->uBitmap->BitsPerPixel==8) { // Image->uBitmap->GetColors(0, 256, rgb); // AutoBitmapUD->Create(widthP, heightP, 8, rgb); // ARLmp->Create(widthP, heightP, 8, rgb); // }else { // AutoBitmapUD->Create(widthP, heightP, 24); // ARLmp->Create(widthP, heightP, 1); // } // AutoBitmapUD->CopyFromRect(Bmp, Src.Left, Src.Top, SRCCOPY); // ARLmp->CopyFromRect(Lmp, Src.Left, Src.Top, SRCCOPY); // ARrect = Rect(0, 0, MainImageForm->iMainImage->uBitmap->Width, MainImageForm->iMainImage->uBitmap->Height); // if (Image->uBitmap->BitsPerPixel==8) C = PaletteForm->DIB256Palette->GetBGCOLORREF(8); // else C = PaletteForm->DIB256Palette->GetBGCOLORREF(24); // Bmp->FillRect(ARrect, C); // Bmp->CopyFromRect(MainImageForm->AutoBitmap, 0, 0, SRCCOPY); // Lmp->CopyToRect(0, 0, MainImageForm->AutoLayerMask, SRCCOPY); // if (Image->uBitmap->BitsPerPixel==8)ClearLayer(); pBITMAPHANDLE bh = Bmp->RgnBitmap->Handle; MainImageForm->WorkArea->LoadFromFile(bh, String(DirectoryItem + "\\Repeat")); SrcUD = MainImageForm->WorkArea->Range; lay = (TPLayer *)Image->LayerList->Items[i]; AutoBitmapUD = lay->ARLBitmap; ARLmp = lay->ARLMask; // Bmp->Copy(SrcUD.Left, SrcUD.Top, widthP, heightP, AutoBitmapUD, 0, 0, SRCCOPY); Bmp->Copy(SrcUD.Left, SrcUD.Top, widthP, heightP, AutoBitmapUD, Src.Left, Src.Top, SRCCOPY); //EAccessViolation try{ Lmp->Copy(SrcUD.Left, SrcUD.Top, widthP, heightP, ARLmp, Src.Left, Src.Top, SRCCOPY); // Lmp->CopyToRect(SrcUD.Left, SrcUD.Top, ARLmp, SRCCOPY); }catch(EAccessViolation &ec){ int temp = 0; // MainImageForm->Undo->UndoRead(); } MainImageForm->WorkArea->LoadFromFile(bh, String(DirectoryItem + "\\Repeat")); } } } }else { // if (Image->uBitmap->BitsPerPixel==8) { // Image->uBitmap->GetColors(0, 256, rgb); // AutoBitmapUD->Create(widthP, heightP, 8, rgb); // }else { // AutoBitmapUD->Create(widthP, heightP, 24); // } // AutoBitmapUD->CopyFromRect(MainImageForm->iMainImage->uBitmap, Src.Left, Src.Top, SRCCOPY); // ARrect = Rect(0, 0, MainImageForm->iMainImage->uBitmap->Width, MainImageForm->iMainImage->uBitmap->Height); // if (Image->uBitmap->BitsPerPixel==8) C = PaletteForm->DIB256Palette->GetBGCOLORREF(8); // else C = PaletteForm->DIB256Palette->GetBGCOLORREF(24); // MainImageForm->iMainImage->uBitmap->FillRect(ARrect, C); // MainImageForm->iMainImage->uBitmap->CopyFromRect(MainImageForm->AutoBitmap, 0, 0, SRCCOPY); pBITMAPHANDLE bh = MainImageForm->iMainImage->uBitmap->RgnBitmap->Handle; // convert by celberus MainImageForm->WorkArea->LoadFromFile(bh, (DirectoryItem + "\\Repeat")); SrcUD = MainImageForm->WorkArea->Range; lay = (TPLayer *)Image->LayerList->Items[MainImageForm->ARLayerCnt-1]; AutoBitmapUD = lay->ARLBitmap; ARLmp = lay->ARLMask; MainImageForm->iMainImage->uBitmap->Copy(SrcUD.Left, SrcUD.Top, widthP, heightP, AutoBitmapUD, Src.Left, Src.Top, SRCCOPY); MainImageForm->WorkArea->LoadFromFile(bh, String(DirectoryItem + "\\Repeat")); if (makeMask) MainImageForm->Undo->UndoSave(UK_MASK,Rect(0,0,MainImageForm->iMainImage->Mask->Width, MainImageForm->iMainImage->Mask->Height)); if (MainImageForm->iMainImage->Mask) { MainImageForm->iMainImage->Mask->Copy(SrcUD.Left, SrcUD.Top, widthP, heightP, MainImageForm->iMainImage->ARMaskPen, Src.Left, Src.Top, SRCCOPY); } } // if (AutoBitmapUD){ delete AutoBitmapUD; AutoBitmapUD = NULL;} // if (MainImageForm->AutoBitmap){ delete MainImageForm->AutoBitmap; MainImageForm->AutoBitmap = NULL;} // if (MainImageForm->AutoLayerMask){ delete MainImageForm->AutoLayerMask; MainImageForm->AutoLayerMask = NULL;} // if (ARLmp){ delete ARLmp; ARLmp = NULL;} Image->EndAutoRepeat(); MainImageForm->EnlargeCanvasInAutoRepeat(); // MainImageForm->EnlargeCanvas(MainImageForm->BUWidth, MainImageForm->BUHeight); MainImageForm->LARSW = false; Image->SetPosition(0, 0); // ARÁ¾·áÇÒ ¶§ È­¸é À§Ä¡ ¹®Á¦ ¶§¹®¿¡.. by celberus ::RepaintImage(); /* int heightP, widthP; TUnionBitmap *AutoBitmapUD = NULL; // convert by celberus TRect Src, SrcUD, Dst, ARrect; TUnionBitmap *ARLmp, *Lmp = NULL, *Bmp = NULL; // convert by celberus int cnt = Image->LayerList->Count; COLORREF C; RGBQUAD rgb[256]; if ((AutoBitmapUD = new TUnionBitmap)==NULL) return; // convert by celberus if ((ARLmp = new TUnionBitmap)==NULL) return; Src = MainImageForm->WorkArea->Range; widthP = Src.Right-Src.Left; heightP = Src.Bottom-Src.Top; if (MainImageForm->LARSW) { for (int i = 0; i < cnt; i++) { Bmp = Image->GetLayerBitmap(i, &Lmp); if (Lmp) { if(MainImageForm->LayerCNT == i+1){ Dst = Rect(0, 0, Image->uBitmap->Width, Image->uBitmap->Height); if (Image->uBitmap->BitsPerPixel==8) { Image->uBitmap->GetColors(0, 256, rgb); AutoBitmapUD->Create(widthP, heightP, 8, rgb); ARLmp->Create(widthP, heightP, 8, rgb); }else { AutoBitmapUD->Create(widthP, heightP, 24); ARLmp->Create(widthP, heightP, 1); } AutoBitmapUD->CopyFromRect(Bmp, Src.Left, Src.Top, SRCCOPY); ARLmp->CopyFromRect(Lmp, Src.Left, Src.Top, SRCCOPY); ARrect = Rect(0, 0, MainImageForm->iMainImage->uBitmap->Width, MainImageForm->iMainImage->uBitmap->Height); if (Image->uBitmap->BitsPerPixel==8) C = PaletteForm->DIB256Palette->GetBGCOLORREF(8); else C = PaletteForm->DIB256Palette->GetBGCOLORREF(24); Bmp->FillRect(ARrect, C); Bmp->CopyFromRect(MainImageForm->AutoBitmap, 0, 0, SRCCOPY); Lmp->CopyToRect(0, 0, MainImageForm->AutoLayerMask, SRCCOPY); if (Image->uBitmap->BitsPerPixel==8)ClearLayer(); pBITMAPHANDLE bh = Bmp->Handle; MainImageForm->WorkArea->LoadFromFile(bh, DirectoryItem + "\\Repeat"); SrcUD = MainImageForm->WorkArea->Range; Bmp->Copy(SrcUD.Left, SrcUD.Top, widthP, heightP, AutoBitmapUD, 0, 0, SRCCOPY); Lmp->CopyToRect(SrcUD.Left, SrcUD.Top, ARLmp, SRCCOPY); MainImageForm->WorkArea->LoadFromFile(bh, DirectoryItem + "\\Repeat"); } } } }else { if (Image->uBitmap->BitsPerPixel==8) { Image->uBitmap->GetColors(0, 256, rgb); AutoBitmapUD->Create(widthP, heightP, 8, rgb); }else { AutoBitmapUD->Create(widthP, heightP, 24); } AutoBitmapUD->CopyFromRect(MainImageForm->iMainImage->uBitmap, Src.Left, Src.Top, SRCCOPY); ARrect = Rect(0, 0, MainImageForm->iMainImage->uBitmap->Width, MainImageForm->iMainImage->uBitmap->Height); if (Image->uBitmap->BitsPerPixel==8) C = PaletteForm->DIB256Palette->GetBGCOLORREF(8); else C = PaletteForm->DIB256Palette->GetBGCOLORREF(24); MainImageForm->iMainImage->uBitmap->FillRect(ARrect, C); MainImageForm->iMainImage->uBitmap->CopyFromRect(MainImageForm->AutoBitmap, 0, 0, SRCCOPY); pBITMAPHANDLE bh = MainImageForm->iMainImage->uBitmap->RgnBitmap->Handle; // convert by celberus MainImageForm->WorkArea->LoadFromFile(bh, DirectoryItem + "\\Repeat"); SrcUD = MainImageForm->WorkArea->Range; MainImageForm->iMainImage->uBitmap->Copy(SrcUD.Left, SrcUD.Top, widthP, heightP, AutoBitmapUD, 0, 0, SRCCOPY); MainImageForm->WorkArea->LoadFromFile(bh, DirectoryItem + "\\Repeat"); } if (AutoBitmapUD){ delete AutoBitmapUD; AutoBitmapUD = NULL;} if (MainImageForm->AutoBitmap){ delete MainImageForm->AutoBitmap; MainImageForm->AutoBitmap = NULL;} if (MainImageForm->AutoLayerMask){ delete MainImageForm->AutoLayerMask; MainImageForm->AutoLayerMask = NULL;} if (ARLmp){ delete ARLmp; ARLmp = NULL;} MainImageForm->EnlargeCanvas(MainImageForm->BUWidth, MainImageForm->BUHeight); MainImageForm->LARSW = false; ::RepaintImage(); */ END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::ComboBoxWH1_Change(TObject *Sender) { BEGIN_LOG(""); bool RepeatSW = false; if (rzbtAHor->Down) { switch (ComboBoxWH1->ItemIndex) { case 0: Wdiv = MainImageForm->arwindow.size.x / 8; RepeatSW = true; break; case 1: Wdiv = MainImageForm->arwindow.size.x / 4; RepeatSW = true; break; case 2: Wdiv = MainImageForm->arwindow.size.x / 2; RepeatSW = true; break; case 3: Wdiv = 3 * MainImageForm->arwindow.size.x / 4; RepeatSW = true; break; case 4: Wdiv = 7 * MainImageForm->arwindow.size.x / 8; RepeatSW = true; break; } SpreadArea(); } else if (rzbtAVer->Down) { switch (ComboBoxWH1->ItemIndex) { case 0: Hdiv = MainImageForm->arwindow.size.y / 8; RepeatSW = true; break; case 1: Hdiv = MainImageForm->arwindow.size.y / 4; RepeatSW = true; break; case 2: Hdiv = MainImageForm->arwindow.size.y / 2; RepeatSW = true; break; case 3: Hdiv = 3 * MainImageForm->arwindow.size.y / 4; RepeatSW = true; break; case 4: Hdiv = 7 * MainImageForm->arwindow.size.y / 8; RepeatSW = true; break; } SpreadArea(); } if (!RepeatSW) { if (InvalidInput1() == false) { END_LOG; return; } if (ComboBoxWH1->Text == ""){ ComboBoxWH1->Text = 1; } int value = 0; if (TryStrToInt(ComboBoxWH1->Text, value)){ if (rzbtAVer->Down) { //Àӽà /* if (value > spEditH->Max) { value = spEditH->Max; ComboBoxWH1->Text = value; }else if (value < 0) { value = 1; ComboBoxWH1->Text = value; } */ Hdiv = value; //ÀÓ½ÃspEditH->Value = value; SpreadArea(); } if (rzbtAHor->Down) { //Àӽà /*if (value > spEditW->Max) { value = spEditW->Max; ComboBoxWH1->Text = value; }else if (value < 0) { value = 1; ComboBoxWH1->Text = value; } */ Wdiv = value; //ÀÓ½ÃspEditW->Value = value; SpreadArea(); } } else { ComboBoxWH1->Text = 0; } } MainImageForm->iMainImage->Repaint(); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::ComboBoxWH1_DblClick(TObject *Sender) { ComboBoxWH1->SetFocus(); ComboBoxWH1->SelectAll(); } //--------------------------------------------------------------------------- bool __fastcall TAutoRepeatForm::InvalidInput1() { String str = ComboBoxWH1->Text; for (int i = 0; i < ComboBoxWH1->Items->Count; i++) { if (str == ComboBoxWH1->Items->Strings[i]) return false; } return true; } //--------------------------------------------------------------------------- // added by maxleo21c (05.04.08) void __fastcall TAutoRepeatForm::iMainImageKeyDown(WORD Key, TShiftState Shift) { BEGIN_LOG(String(Key)); // edit by monkman (2005.08.04) switch (Key) { case '1': if (!rzbtANormal->Down) { rzbtAMethodClick(rzbtANormal); rzbtANormal->Down = true; } break; case '2': if (!rzbtAHor->Down) { rzbtAMethodClick(rzbtAHor); rzbtAHor->Down = true; } break; case '3': if (!rzbtAVer->Down) { rzbtAMethodClick(rzbtAVer); rzbtAVer->Down = true; } break; case VK_RETURN: int value; if (InvalidInput1() == false) { END_LOG; return; } if (ComboBoxWH1->Text == ""){ ComboBoxWH1->Text = 1; } if (rzbtAVer->Down) { if (TryStrToInt(ComboBoxWH1->Text, value)){ //Àӽà /* if (value > spEditH->Max) { value = spEditH->Max; ComboBoxWH1->Text = value; }else if (value < 0) { value = 1; ComboBoxWH1->Text = value; } */ Hdiv = value; //ÀÓ½ÃspEditH->Value = value; SpreadArea(); } } if (rzbtAHor->Down) { if (TryStrToInt(ComboBoxWH1->Text, value)){ //Àӽà /* if (value > spEditW->Max) { value = spEditW->Max; ComboBoxWH1->Text = value; }else if (value < 0) { value = 1; ComboBoxWH1->Text = value; } */ Wdiv = value; //ÀÓ½ÃspEditW->Value = value; SpreadArea(); } } MainImageForm->iMainImage->Repaint(); break; } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::Nomal2Click(TObject *Sender) { BEGIN_LOG(""); TSpeedButton *sp = (TSpeedButton *)Sender; switch(sp->Tag) { case 1: rzbtANormal->Down=true; rzbtAMethodClick(rzbtANormal); break; case 2: rzbtAVer->Down = true; rzbtAMethodClick(rzbtAVer); break; case 3: rzbtAHor->Down=true; rzbtAMethodClick(rzbtAHor); break; } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::Exit1Click(TObject *Sender) { rzbtStopClick(Sender); } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::rzbtStopClick(TObject *Sender) { BEGIN_LOG(""); if (MainImageForm->reflection){ Application->MessageBox(IDS_MSG_01.c_str(), L"Information", MB_OK); // ºñÆ®¸Ê ¹ÝÀü±×¸®±â¸¦ Á¾·áÇØÁֽʽÿÀ END_LOG; return; } if (MainImageForm->iMainImage->uBitmap->BitsPerPixel == 8) MainImageForm->Palette->ToRGBQUAD(rgb, 256); ClearOutWorkArea(); ReturnWorkArea(); MainImageForm->AutoRepeat = false; MainImageForm->sbAutoRepView->Enabled = false; MainImageForm->ARViewExitForm(); AutoRepeatViewEnd(); MainImageForm->AutoRepUpdateMenu(true); PostMessage(hWnd, TPM_EXITFUNCTION, 0, 0); MainMenuForm->close1->Enabled = false; MainMenuForm->ManualR->Enabled = true; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::MakeMenuHintByShortcut() { BEGIN_LOG(""); rzbtANormal->Hint = TexActionManager->GetHint("AutoRepeat", "Normal"); rzbtAVer->Hint = TexActionManager->GetHint("AutoRepeat", "VertDiv"); rzbtAHor->Hint = TexActionManager->GetHint("AutoRepeat", "HorzDiv"); rzbtStop->Hint = TexActionManager->GetHint("AutoRepeat", "Exit"); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::ExecuteHotKey(String command) { BEGIN_LOG(command); if (command == "Normal") { if (rzbtANormal->Down == false) { rzbtANormal->Down=true; rzbtAMethodClick(rzbtANormal); } } else if (command == "VertDiv") { if (rzbtAVer->Down == false) { rzbtAVer->Down=true; rzbtAMethodClick(rzbtAVer); } } else if (command == "HorzDiv") { if (rzbtAHor->Down == false) { rzbtAHor->Down=true; rzbtAMethodClick(rzbtAHor); } } else if (command == "Exit") { rzbtStopClick(rzbtStop); } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::InitAutoRepeatMode() { BEGIN_LOG(""); HDC PreDC = NULL; // TSpeedButton *sp = (TSpeedButton *)Sender; RECT rc; TCursor OldCursor; // for PFM by celberus OldCursor = Screen->Cursor; // for PFM by celberus Screen->Cursor = crHourGlass; // for PFM by celberus // if (!sp->Tag == 0) { if (MainImageForm->AutoRepeat == false) { // Undo->RemoveAll(); rc = MainImageForm->WorkArea->Range; MainImageForm->UndoSave(UK_REPEAT, rc); // MainImageForm->UndoSave(UK_REPEAT, Rect(0, 0, 0, 0)); AutoRepeatView(); MainImageForm->arwindow.s.x = window.s.x; MainImageForm->arwindow.s.y = window.s.y; MainImageForm->arwindow.e.x = window.e.x;// + window.size.x%2; MainImageForm->arwindow.e.y = window.e.y;// + window.size.y%2; MainImageForm->WidthR = window.size.x%2; MainImageForm->HeightR = window.size.y%2; MainImageForm->arwindow.size.x = window.size.x;// + window.size.x%2; MainImageForm->arwindow.size.y = window.size.y;// + window.size.y%2; //========================================= Delete WorkArea for BitBlt MainImageForm->WorkArea->ResetRegion(MainImageForm->iMainImage); MainImageForm->WorkAreaChange(); MainForm->UpdateMenuItems(MainImageForm); //========================================== Image->SubVisible = false; // for PFM by celberus Image->SubEnabled = false; // for PFM by celberus Image->SubMethod = false; // for PFM by celberus InitCanvas(); } InitAuto_RepForm(); MainImageForm->AutoRepeat = true; // } else { // InitMan_RepForm(); // } Screen->Cursor = OldCursor; // for PFM by celberus END_LOG; } //--------------------------------------------------------------------------- void __fastcall TAutoRepeatForm::FormClose(TObject *Sender, TCloseAction &Action) { BEGIN_LOG(""); PostMessage(hWnd, TPM_EXITFUNCTION, 0, 0); END_LOG; } //---------------------------------------------------------------------------