//--------------------------------------------------------------------------- #include #pragma hdrstop #include "ManualRepeat_F.h" #include "FullView.h" #include "MainImage.h" #include "Palette.h" #include "Undo.h" #include "MainMenu.h" #include "StatusProgress.h" #include "Main.h" #include "ShortcutDefine.h" // added by maxleo21c (05.04.01) //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "RzEdit" #pragma link "RzSpnEdt" #pragma link "RzButton" #pragma link "RzPanel" #pragma link "RzBckgnd" #pragma link "RzCmboBx" #pragma link "RzRadChk" #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] //--------------------------------------------------------------------------- TManualRepeatForm *ManualRepeatForm; //--------------------------------------------------------------------------- __fastcall TManualRepeatForm::TManualRepeatForm(TComponent* Owner) : TForm(Owner) { hWnd = ((TWinControl *)Owner)->Handle; //============================= 2001.3.27 lhskys FormCreate(TObject *Sender)³»¿ë ¿Å±è //========================================================================== StringTable.Create(DirectoryBin, Language, "Repeat"); SetSmallFont(Font); SetSmallFont(LabelW->Font); SetSmallFont(LabelH->Font); SetSmallFont(Label1->Font); SetSmallFont(LabelSize->Font); SetSmallFont(LabelMax->Font); // SetSmallFont(LabelMax1->Font); rzbtNormal->Caption = IDS_COMMON_NORMAL; rzbtMatchNormal->Caption = IDS_MATCHNORMAL; rzbtHDVer->Caption = IDS_COMMON_HDVER; rzbtMatchVer->Caption = IDS_MATCHVER; rzbtHDHor->Caption = IDS_COMMON_HDHOR; rzbtMatchHor->Caption = IDS_MATCHHOR; //Label1->Caption = String(IDS_SIZE) + " : "; RzCbIsSize->Caption = IDS_SIZE; //LabelSize->Caption = IDS_FALSE; LabelMax->Caption = IDS_COMMON_MAX; // LabelMax1->Caption = IDS_COMMON_MAX; // sbANormal->Caption = IDS_COMMON_NORMAL; // sbAVer->Caption = IDS_COMMON_HDVER; // sbAHor->Caption = IDS_COMMON_HDHOR; // sbARExit->Caption = IDS_COMMON_EXIT; //========================================================================== MakeMenuHintByShortcut(); dncount = 0; // AutoLayerBU = NULL; //====================================== } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::RepeatABCDDown(TObject *Sender) { BEGIN_LOG(""); if (MainImageForm->iMainImage->LayerMask) { RepeatABCDDown_layer(); } else { RepeatABCDDown_none(); } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::RepeatABCDDown_none() { BEGIN_LOG(""); int Wd, Hd; bool undoSw = false; TPoint half, rest, rWH; TTexpiaBitmap *TempImage = NULL; TCursor OldCursor; HDC /*imageDC = NULL,*/ TempDC = NULL; // convert by celberus TPException ec = EC_NONE; HRGN hRgn = NULL; RECT r; dncount++; OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; r = MainImageForm->WorkArea->Range; if ((undoSw = MainImageForm->UndoSave(UK_PATTERN, r)) == false) goto fail; Wdiv = spEditW->Value; Hdiv = spEditH->Value; half = Point(window.size.x / 2.0, window.size.y / 2.0); rest = Point(window.size.x - half.x, window.size.y - half.y); if (WInd == 0) { Wd = Wdiv - half.x; rWH.x = rest.x - Wd; } else { Wd = Wdiv; rWH.x = half.x - Wd; } if (HInd == 0) { Hd = Hdiv - half.y; rWH.y = rest.y - Hd; } else { Hd = Hdiv; rWH.y = half.y - Hd; } if ((TempImage = new TTexpiaBitmap) == NULL) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (Image->uBitmap->BitsPerPixel==8) { if (!TempImage->Create(window.size.x, window.size.y, 8, rgb)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} } else { if (!TempImage->Create(window.size.x, window.size.y, 24)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} } if ((TempDC = TempImage->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} hRgn = Image->uBitmap->RgnBitmap->GetRegion(true); // convert by celberus // if ((imageDC = Image->uBitmap->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} convert by celberus if (Item == TREPEAT_MNORMAL) { //A // BitBlt(TempDC, rest.x, rest.y, half.x, half.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, rest.y, half.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //B // BitBlt(TempDC, rest.x, 0, half.x, rest.y, // imageDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, 0, half.x, rest.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus //C // BitBlt(TempDC, 0, rest.y, rest.x, half.y, // imageDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rest.y, rest.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus //D // BitBlt(TempDC, 0, 0, rest.x, rest.y, // imageDC, window.s.x + half.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, rest.x, rest.y, window.s.x + half.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus stNormal->Caption = dncount; } else if (Item == TREPEAT_MHOR) { if (WInd == 0) { //A // BitBlt(TempDC, Wd, rest.y, half.x, half.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, Wd, rest.y, half.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //C1 // BitBlt(TempDC, half.x + Wd, rest.y, rWH.x, half.y, // imageDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x + Wd, rest.y, rWH.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus //C2 // BitBlt(TempDC, 0, rest.y, Wd, half.y, // imageDC, window.s.x + half.x + rWH.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rest.y, Wd, half.y, window.s.x + half.x + rWH.x, window.s.y, SRCCOPY, false); // convert by celberus } else { //A1 // BitBlt(TempDC, rest.x + Wd, rest.y, rWH.x, half.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x + Wd, rest.y, rWH.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //A2 // BitBlt(TempDC, 0, rest.y, Wd, half.y, // imageDC, window.s.x + rWH.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rest.y, Wd, half.y, window.s.x + rWH.x, window.s.y, SRCCOPY, false); // convert by celberus //C // BitBlt(TempDC, Wd, rest.y, rest.x, half.y, // imageDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, Wd, rest.y, rest.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus } //B // BitBlt(TempDC, rest.x, 0, half.x, rest.y, // imageDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, 0, half.x, rest.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus //D // BitBlt(TempDC, 0, 0, rest.x, rest.y, // imageDC, window.s.x + half.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, rest.x, rest.y, window.s.x + half.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus stHorizontal->Caption = dncount; } else if (Item == TREPEAT_MVER) { if (HInd == 0) { // if (HInd == 0) { //A // BitBlt(TempDC, rest.x, Hd, half.x, half.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, Hd, half.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //B1 // BitBlt(TempDC, rest.x, half.y + Hd, half.x, rWH.y, // imageDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, half.y + Hd, half.x, rWH.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus //B2 // BitBlt(TempDC, rest.x, 0, half.x, Hd, // imageDC, window.s.x, window.s.y + half.y + rWH.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, 0, half.x, Hd, window.s.x, window.s.y + half.y + rWH.y, SRCCOPY, false); // convert by celberus } else { //A1 // BitBlt(TempDC, rest.x, rest.y+Hd, half.x, rWH.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, rest.y+Hd, half.x, rWH.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //A2 // BitBlt(TempDC, rest.x, 0, half.x, Hd, // imageDC, window.s.x, window.s.y + rWH.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, 0, half.x, Hd, window.s.x, window.s.y + rWH.y, SRCCOPY, false); // convert by celberus //B // BitBlt(TempDC, rest.x, Hd, half.x, rest.y, // imageDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, Hd, half.x, half.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus } //C // BitBlt(TempDC, 0, rest.y, rest.x, half.y, // imageDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rest.y, rest.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus //D // BitBlt(TempDC, 0, 0, rest.x, rest.y, // imageDC, window.s.x + half.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, rest.x, rest.y, window.s.x + half.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus stVertical->Caption = dncount; } TempImage->DeleteDC(TempDC); // Image->uBitmap->DeleteDC(imageDC); if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } delete TempImage; ::RepaintImage(); Screen->Cursor = OldCursor; END_LOG; return; fail: if (undoSw == true) { if (TempImage) { if (TempDC) { // if (imageDC) Image->uBitmap->DeleteDC(imageDC); if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } TempImage->DeleteDC(TempDC); } delete TempImage; } MainImageForm->Undo->RemoveLast(); } Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(ec); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::RepeatABCDDown_layer() { BEGIN_LOG(""); int Wd, Hd; bool undoSw = false; TPoint half, rest, rWH; TTexpiaBitmap *TempImage = NULL, *TempMask = NULL; TCursor OldCursor; HDC /*imageDC = NULL,layerDC = NULL,*/ TempDC = NULL, MaskDC = NULL; // convert by celberus TPException ec = EC_NONE; HRGN hRgn = NULL; RECT r; dncount++; OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; r = MainImageForm->WorkArea->Range; if ((undoSw = MainImageForm->UndoSave(UK_PATTERN, r)) == false) goto fail; Wdiv = spEditW->Value; Hdiv = spEditH->Value; half = Point(window.size.x / 2.0, window.size.y / 2.0); rest = Point(window.size.x - half.x, window.size.y - half.y); if (WInd == 0) { Wd = Wdiv - half.x; rWH.x = rest.x - Wd; } else { Wd = Wdiv; rWH.x = half.x - Wd; } if (HInd == 0) { Hd = Hdiv - half.y; rWH.y = rest.y - Hd; } else { Hd = Hdiv; rWH.y = half.y - Hd; } if ((TempImage = new TTexpiaBitmap) == NULL) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if ((TempMask = new TTexpiaBitmap) == NULL) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (Image->uBitmap->BitsPerPixel==8) { if (!TempImage->Create(window.size.x, window.size.y, 8, rgb)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (!TempMask->Create(window.size.x, window.size.y, 8, rgb)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} } else { if (!TempImage->Create(window.size.x, window.size.y, 24)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (!TempMask->Create(window.size.x, window.size.y, 1)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} } if ((TempDC = TempImage->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} if ((MaskDC = TempMask->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} hRgn = Image->uBitmap->RgnBitmap->GetRegion(true); // convert by celberus // if ((imageDC = Image->uBitmap->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} convert by celberus // if ((layerDC = Image->LayerMask->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} if (Item == TREPEAT_MNORMAL) { //A // BitBlt(TempDC, rest.x, rest.y, half.x, half.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, rest.y, half.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x, rest.y, half.x, half.y, // layerDC, window.s.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x, rest.y, half.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //B // BitBlt(TempDC, rest.x, 0, half.x, rest.y, // imageDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, 0, half.x, rest.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x, 0, half.x, rest.y, // layerDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x, 0, half.x, rest.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus //C // BitBlt(TempDC, 0, rest.y, rest.x, half.y, // imageDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rest.y, rest.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, rest.y, rest.x, half.y, // layerDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, rest.y, rest.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus //D // BitBlt(TempDC, 0, 0, rest.x, rest.y, // imageDC, window.s.x + half.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, rest.x, rest.y, window.s.x + half.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, 0, rest.x, rest.y, // layerDC, window.s.x + half.x, window.s.y + half.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, 0, rest.x, rest.y, window.s.x + half.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus // BitBlt(layerDC, window.s.x, window.s.y, window.size.x, window.size.y, // MaskDC, 0, 0, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus stNormal->Caption = dncount; } else if (Item == TREPEAT_MHOR) { if (WInd == 0) { //A // BitBlt(TempDC, Wd, rest.y, half.x, half.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, Wd, rest.y, half.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, Wd, rest.y, half.x, half.y, // layerDC, window.s.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, Wd, rest.y, half.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //C1 // BitBlt(TempDC, half.x + Wd, rest.y, rWH.x, half.y, // imageDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x + Wd, rest.y, rWH.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, half.x + Wd, rest.y, rWH.x, half.y, // layerDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, half.x + Wd, rest.y, rWH.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus //C2 // BitBlt(TempDC, 0, rest.y, Wd, half.y, // imageDC, window.s.x + half.x + rWH.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rest.y, Wd, half.y, window.s.x + half.x + rWH.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, rest.y, Wd, half.y, // layerDC, window.s.x + half.x + rWH.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, rest.y, Wd, half.y, window.s.x + half.x + rWH.x, window.s.y, SRCCOPY, false); // convert by celberus } else { //A1 // BitBlt(TempDC, rest.x + Wd, rest.y, rWH.x, half.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x + Wd, rest.y, rWH.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x + Wd, rest.y, rWH.x, half.y, // layerDC, window.s.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x + Wd, rest.y, rWH.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //A2 // BitBlt(TempDC, 0, rest.y, Wd, half.y, // imageDC, window.s.x + rWH.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rest.y, Wd, half.y, window.s.x + rWH.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, rest.y, Wd, half.y, // layerDC, window.s.x + rWH.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, rest.y, Wd, half.y, window.s.x + rWH.x, window.s.y, SRCCOPY, false); // convert by celberus //C // BitBlt(TempDC, Wd, rest.y, rest.x, half.y, // imageDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, Wd, rest.y, rest.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, Wd, rest.y, rest.x, half.y, // layerDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, Wd, rest.y, rest.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus } //B // BitBlt(TempDC, rest.x, 0, half.x, rest.y, // imageDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, 0, half.x, rest.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x, 0, half.x, rest.y, // layerDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x, 0, half.x, rest.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus //D // BitBlt(TempDC, 0, 0, rest.x, rest.y, // imageDC, window.s.x + half.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, rest.x, rest.y, window.s.x + half.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, 0, rest.x, rest.y, // layerDC, window.s.x + half.x, window.s.y + half.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, 0, rest.x, rest.y, window.s.x + half.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus // BitBlt(layerDC, window.s.x, window.s.y, window.size.x, window.size.y, // MaskDC, 0, 0, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus stHorizontal->Caption = dncount; } else if (Item == TREPEAT_MVER) { if (HInd == 0) { // if (HInd == 0) { //A // BitBlt(TempDC, rest.x, Hd, half.x, half.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, Hd, half.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x, Hd, half.x, half.y, // layerDC, window.s.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x, Hd, half.x, half.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //B1 // BitBlt(TempDC, rest.x, half.y + Hd, half.x, rWH.y, // imageDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, rest.y + Hd, half.x, rWH.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x, half.y + Hd, half.x, rWH.y, // layerDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x, half.y + Hd, half.x, rWH.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus //B2 // BitBlt(TempDC, rest.x, 0, half.x, Hd, // imageDC, window.s.x, window.s.y + half.y + rWH.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, 0, half.x, Hd, window.s.x, window.s.y + half.y + rWH.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x, 0, half.x, Hd, // layerDC, window.s.x, window.s.y + half.y + rWH.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x, 0, half.x, Hd, window.s.x, window.s.y + half.y + rWH.y, SRCCOPY, false); // convert by celberus } else { //A1 // BitBlt(TempDC, rest.x, rest.y+Hd, half.x, rWH.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, rest.y + Hd, half.x, rWH.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x, rest.y+Hd, half.x, rWH.y, // layerDC, window.s.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x, rest.y+Hd, half.x, rWH.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus //A2 // BitBlt(TempDC, rest.x, 0, half.x, Hd, // imageDC, window.s.x, window.s.y + rWH.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, 0, half.x, Hd, window.s.x, window.s.y + rWH.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x, 0, half.x, Hd, // layerDC, window.s.x, window.s.y + rWH.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x, 0, half.x, Hd, window.s.x, window.s.y + rWH.y, SRCCOPY, false); //B // BitBlt(TempDC, rest.x, Hd, half.x, rest.y, // imageDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rest.x, Hd, half.x, rest.y, window.s.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rest.x, Hd, half.x, rest.y, // layerDC, window.s.x, window.s.y + half.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rest.x, Hd, half.x, rest.y, window.s.x, window.s.y + half.y, SRCCOPY, false); } //C // BitBlt(TempDC, 0, rest.y, rest.x, half.y, // imageDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rest.y, rest.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, rest.y, rest.x, half.y, // layerDC, window.s.x + half.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, rest.y, rest.x, half.y, window.s.x + half.x, window.s.y, SRCCOPY, false); //D // BitBlt(TempDC, 0, 0, rest.x, rest.y, // imageDC, window.s.x + half.x, window.s.y + half.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, rest.x, rest.y, window.s.x + half.x, window.s.y + half.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, 0, rest.x, rest.y, // layerDC, window.s.x + half.x, window.s.y + half.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, 0, rest.x, rest.y, window.s.x + half.x, window.s.y + half.y, SRCCOPY, false); // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus // BitBlt(layerDC, window.s.x, window.s.y, window.size.x, window.size.y, // MaskDC, 0, 0, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); stVertical->Caption = dncount; } TempMask->DeleteDC(MaskDC); // Image->LayerMask->DeleteDC(layerDC); TempImage->DeleteDC(TempDC); // Image->uBitmap->DeleteDC(imageDC); if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } delete TempImage; delete TempMask; ::RepaintImage(); Screen->Cursor = OldCursor; END_LOG; return; fail: if (TempImage) { if (TempDC) TempImage->DeleteDC(TempDC); delete TempImage; } if (TempMask) { if (MaskDC) TempMask->DeleteDC(TempDC); delete TempMask; } if (undoSw == true) MainImageForm->Undo->RemoveLast(); // if (imageDC) Image->uBitmap->DeleteDC(imageDC); // if (layerDC) Image->LayerMask->DeleteDC(layerDC); if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(ec); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::RecoverABCDDown(TObject *Sender) { BEGIN_LOG(""); if (Image->LayerMask) { RecoverABCDDown_layer(); } else { RecoverABCDDown_none(); } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::RecoverABCDDown_none() { BEGIN_LOG(""); int Wd, Hd; TPoint half, rest, rWH; TTexpiaBitmap *TempImage = NULL; TCursor OldCursor; HDC /*imageDC = NULL,*/ TempDC = NULL; // convert by celberus TPException ec = EC_NONE; bool undoSw = false; HRGN hRgn = NULL; RECT r; dncount--; OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; r = MainImageForm->WorkArea->Range; if ((undoSw = MainImageForm->UndoSave(UK_PATTERN, r)) == false) goto fail; Wdiv = spEditW->Value; Hdiv = spEditH->Value; half = Point(window.size.x / 2.0, window.size.y / 2.0); rest = Point(window.size.x - half.x, window.size.y - half.y); if (WInd == 0) { Wd = Wdiv - half.x; rWH.x = rest.x - Wd; } else { Wd = Wdiv; rWH.x = half.x - Wd; } if (HInd == 0) { Hd = Hdiv - half.y; rWH.y = rest.y - Hd; } else { Hd = Hdiv; rWH.y = half.y - Hd; } if ((TempImage = new TTexpiaBitmap) == NULL) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (Image->uBitmap->BitsPerPixel==8) { if (!TempImage->Create(window.size.x, window.size.y, 8, rgb)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} } else { if (!TempImage->Create(window.size.x, window.size.y, 24)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} } if ((TempDC = TempImage->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} hRgn = Image->uBitmap->RgnBitmap->GetRegion(true); // convert by celberus // if ((imageDC = Image->uBitmap->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} convert by celberus if (Item == TREPEAT_MNORMAL) { //A // BitBlt(TempDC, 0, 0, half.x, half.y, // imageDC, window.s.x + rest.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, half.x, half.y, window.s.x + rest.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus //B // BitBlt(TempDC, 0, half.y, half.x, rest.y, // imageDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y, half.x, rest.y, window.s.x + rest.x, window.s.y, SRCCOPY, false); // convert by celberus //C // BitBlt(TempDC, half.x, 0, rest.x, half.y, // imageDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, 0, rest.x, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus //D // BitBlt(TempDC, half.x, half.y, rest.x, rest.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, half.y, rest.x, rest.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus stNormal->Caption = dncount; } else if (Item == TREPEAT_MHOR) { if (WInd == 0) { //A // BitBlt(TempDC, 0, 0, half.x, half.y, // imageDC, window.s.x + Wd, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, half.x, half.y, window.s.x + Wd, window.s.y + rest.y, SRCCOPY, false); // convert by celberus //C1 // BitBlt(TempDC, half.x, 0, rWH.x, half.y, // imageDC, window.s.x + half.x + Wd, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, 0, rWH.x, half.y, window.s.x + half.x + Wd, window.s.y + rest.y, SRCCOPY, false); // convert by celberus //C2 // BitBlt(TempDC, half.x + rWH.x, 0, Wd, half.y, // imageDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x + rWH.x, 0, Wd, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus } else { //A1 // BitBlt(TempDC, 0, 0, rWH.x, half.y, // imageDC, window.s.x + Wd + rest.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, rWH.x, half.y, window.s.x + Wd + rest.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus //A2 // BitBlt(TempDC, rWH.x, 0, Wd, half.y, // imageDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rWH.x, 0, Wd, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus //C // BitBlt(TempDC, half.x, 0, rest.x, half.y, // imageDC, window.s.x + Wd, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, 0, rest.x, half.y, window.s.x + Wd, window.s.y + rest.y, SRCCOPY, false); // convert by celberus } //B // BitBlt(TempDC, 0, half.y, half.x, rest.y, // imageDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y, half.x, rest.y, window.s.x + rest.x, window.s.y, SRCCOPY, false); // convert by celberus //D // BitBlt(TempDC, half.x, half.y, rest.x, rest.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, half.y, rest.x, rest.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus stHorizontal->Caption = dncount; } else if (Item == TREPEAT_MVER) { if (HInd == 0) { // if (HInd == 0) { //A // BitBlt(TempDC, 0, 0, half.x, half.y, // imageDC, window.s.x + rest.x, window.s.y + Hd, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, half.x, half.y, window.s.x + rest.x, window.s.y + Hd, SRCCOPY, false); // convert by celberus //B1 // BitBlt(TempDC, 0, half.y, half.x, rWH.y, // imageDC, window.s.x + rest.x, window.s.y + half.y + Hd, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y, half.x, rWH.y, window.s.x + rest.x, window.s.y + half.y + Hd, SRCCOPY, false); // convert by celberus //B2 // BitBlt(TempDC, 0, half.y + rWH.y, half.x, Hd, // imageDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y + rWH.y, half.x, Hd, window.s.x + rest.x, window.s.y, SRCCOPY, false); // convert by celberus } else { //A1 // BitBlt(TempDC, 0, 0, half.x, rWH.y, // imageDC, window.s.x + rest.x, window.s.y + Hd + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, half.x, rWH.y, window.s.x + rest.x, window.s.y + Hd + rest.y, SRCCOPY, false); // convert by celberus //A2 // BitBlt(TempDC, 0, rWH.y, half.x, Hd, // imageDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rWH.y, half.x, Hd, window.s.x + rest.x, window.s.y, SRCCOPY, false); // convert by celberus //B // BitBlt(TempDC, 0, half.y, half.x, rest.y, // imageDC, window.s.x + rest.x, window.s.y + Hd, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y, half.x, rest.y, window.s.x + rest.x, window.s.y + Hd, SRCCOPY, false); // convert by celberus } //C // BitBlt(TempDC, half.x, 0, rest.x, half.y, // imageDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, 0, rest.x, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus //D // BitBlt(TempDC, half.x, half.y, rest.x, rest.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, half.y, rest.x, rest.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus stVertical->Caption = dncount; } TempImage->DeleteDC(TempDC); // Image->uBitmap->DeleteDC(imageDC); convert by celberus if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } delete TempImage; ::RepaintImage(); Screen->Cursor = OldCursor; END_LOG; return; fail: if (undoSw) { if (TempImage) { if (TempDC) { // if (imageDC) Image->uBitmap->DeleteDC(imageDC); convert by celberus if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } TempImage->DeleteDC(TempDC); } delete TempImage; } MainImageForm->Undo->RemoveLast(); } Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(ec); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::RecoverABCDDown_layer() { BEGIN_LOG(""); int Wd, Hd; TPoint half, rest, rWH; TTexpiaBitmap *TempImage = NULL, *TempMask = NULL; TCursor OldCursor; HDC /*imageDC = NULL, layerDC = NULL,*/ TempDC = NULL, MaskDC = NULL; // convert by celberus TPException ec = EC_NONE; bool undoSw = false; HRGN hRgn = NULL; RECT r; dncount--; OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; r = MainImageForm->WorkArea->Range; if ((undoSw = MainImageForm->UndoSave(UK_PATTERN, r)) == false) goto fail; Wdiv = spEditW->Value; Hdiv = spEditH->Value; half = Point(window.size.x / 2.0, window.size.y / 2.0); rest = Point(window.size.x - half.x, window.size.y - half.y); if (WInd == 0) { Wd = Wdiv - half.x; rWH.x = rest.x - Wd; } else { Wd = Wdiv; rWH.x = half.x - Wd; } if (HInd == 0) { Hd = Hdiv - half.y; rWH.y = rest.y - Hd; } else { Hd = Hdiv; rWH.y = half.y - Hd; } if ((TempImage = new TTexpiaBitmap) == NULL) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if ((TempMask = new TTexpiaBitmap) == NULL) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (Image->uBitmap->BitsPerPixel==8) { if (!TempImage->Create(window.size.x, window.size.y, 8, rgb)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (!TempMask->Create(window.size.x, window.size.y, 8, rgb)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} } else { if (!TempImage->Create(window.size.x, window.size.y, 24)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (!TempMask->Create(window.size.x, window.size.y, 1)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} } if ((TempDC = TempImage->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} if ((MaskDC = TempMask->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} hRgn = Image->uBitmap->RgnBitmap->GetRegion(true); // convert by celberus // if ((imageDC = Image->uBitmap->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} convert by celberus // if ((layerDC = Image->LayerMask->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; SAVE_EXCEPTION(ec); goto fail;} if (Item == TREPEAT_MNORMAL) { //A // BitBlt(TempDC, 0, 0, half.x, half.y, // imageDC, window.s.x + rest.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, half.x, half.y, window.s.x + rest.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, 0, half.x, half.y, // layerDC, window.s.x + rest.x, window.s.y + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, 0, half.x, half.y, window.s.x + rest.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus //B // BitBlt(TempDC, 0, half.y, half.x, rest.y, // imageDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y, half.x, rest.y, window.s.x + rest.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, half.y, half.x, rest.y, // layerDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, half.y, half.x, rest.y, window.s.x + rest.x, window.s.y, SRCCOPY, false); //C // BitBlt(TempDC, half.x, 0, rest.x, half.y, // imageDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, 0, rest.x, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, half.x, 0, rest.x, half.y, // layerDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, half.x, 0, rest.x, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); //D // BitBlt(TempDC, half.x, half.y, rest.x, rest.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, half.y, rest.x, rest.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, half.x, half.y, rest.x, rest.y, // layerDC, window.s.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, half.x, half.y, rest.x, rest.y, window.s.x, window.s.y, SRCCOPY, false); // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus // BitBlt(layerDC, window.s.x, window.s.y, window.size.x, window.size.y, // MaskDC, 0, 0, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); stNormal->Caption = dncount; } else if (Item == TREPEAT_MHOR) { if (WInd == 0) { //A // BitBlt(TempDC, 0, 0, half.x, half.y, // imageDC, window.s.x + Wd, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, half.x, half.y, window.s.x + Wd, window.s.y + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, 0, half.x, half.y, // layerDC, window.s.x + Wd, window.s.y + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, 0, half.x, half.y, window.s.x + Wd, window.s.y + rest.y, SRCCOPY, false); //C1 // BitBlt(TempDC, half.x, 0, rWH.x, half.y, // imageDC, window.s.x + half.x + Wd, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, 0, rWH.x, half.y, window.s.x + half.x + Wd, window.s.y + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, half.x, 0, rWH.x, half.y, // layerDC, window.s.x + half.x + Wd, window.s.y + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, half.x, 0, rWH.x, half.y, window.s.x + half.x + Wd, window.s.y + rest.y, SRCCOPY, false); //C2 // BitBlt(TempDC, half.x + rWH.x, 0, Wd, half.y, // imageDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x + rWH.x, 0, Wd, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, half.x + rWH.x, 0, Wd, half.y, // layerDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, half.x + rWH.x, 0, Wd, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); } else { //A1 // BitBlt(TempDC, 0, 0, rWH.x, half.y, // imageDC, window.s.x + Wd + rest.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, rWH.x, half.y, window.s.x + Wd + rest.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, 0, rWH.x, half.y, // layerDC, window.s.x + Wd + rest.x, window.s.y + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, 0, rWH.x, half.y, window.s.x + Wd + rest.x, window.s.y + rest.y, SRCCOPY, false); //A2 // BitBlt(TempDC, rWH.x, 0, Wd, half.y, // imageDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, rWH.x, 0, Wd, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, rWH.x, 0, Wd, half.y, // layerDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, rWH.x, 0, Wd, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); //C // BitBlt(TempDC, half.x, 0, rest.x, half.y, // imageDC, window.s.x + Wd, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, 0, rest.x, half.y, window.s.x + Wd, window.s.y + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, half.x, 0, rest.x, half.y, // layerDC, window.s.x + Wd, window.s.y + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, half.x, 0, rest.x, half.y, window.s.x + Wd, window.s.y + rest.y, SRCCOPY, false); // convert by celberus } //B // BitBlt(TempDC, 0, half.y, half.x, rest.y, // imageDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y, half.x, rest.y, window.s.x + rest.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, half.y, half.x, rest.y, // layerDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, half.y, half.x, rest.y, window.s.x + rest.x, window.s.y, SRCCOPY, false); //D // BitBlt(TempDC, half.x, half.y, rest.x, rest.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, half.y, rest.x, rest.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, half.x, half.y, rest.x, rest.y, // layerDC, window.s.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, half.x, half.y, rest.x, rest.y, window.s.x, window.s.y, SRCCOPY, false); // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus // BitBlt(layerDC, window.s.x, window.s.y, window.size.x, window.size.y, // MaskDC, 0, 0, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); stHorizontal->Caption = dncount; } else if (Item == TREPEAT_MVER) { if (HInd == 0) { // if (HInd == 0) { //A // BitBlt(TempDC, 0, 0, half.x, half.y, // imageDC, window.s.x + rest.x, window.s.y + Hd, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, half.x, half.y, window.s.x + rest.x, window.s.y + Hd, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, 0, half.x, half.y, // layerDC, window.s.x + rest.x, window.s.y + Hd, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, 0, half.x, half.y, window.s.x + rest.x, window.s.y + Hd, SRCCOPY, false); //B1 // BitBlt(TempDC, 0, half.y, half.x, rWH.y, // imageDC, window.s.x + rest.x, window.s.y + half.y + Hd, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y, half.x, rWH.y, window.s.x + rest.x, window.s.y + half.y + Hd, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, half.y, half.x, rWH.y, // layerDC, window.s.x + rest.x, window.s.y + half.y + Hd, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, half.y, half.x, rWH.y, window.s.x + rest.x, window.s.y + half.y + Hd, SRCCOPY, false); //B2 // BitBlt(TempDC, 0, half.y + rWH.y, half.x, Hd, // imageDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y + rWH.y, half.x, Hd, window.s.x + rest.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, half.y + rWH.y, half.x, Hd, // layerDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, half.y + rWH.y, half.x, Hd, window.s.x + rest.x, window.s.y, SRCCOPY, false); } else { //A1 // BitBlt(TempDC, 0, 0, half.x, rWH.y, // imageDC, window.s.x + rest.x, window.s.y + Hd + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, 0, half.x, rWH.y, window.s.x + rest.x, window.s.y + Hd + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, 0, half.x, rWH.y, // layerDC, window.s.x + rest.x, window.s.y + Hd + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, 0, half.x, rWH.y, window.s.x + rest.x, window.s.y + Hd + rest.y, SRCCOPY, false); //A2 // BitBlt(TempDC, 0, rWH.y, half.x, Hd, // imageDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, rWH.y, half.x, Hd, window.s.x + rest.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, rWH.y, half.x, Hd, // layerDC, window.s.x + rest.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, rWH.y, half.x, Hd, window.s.x + rest.x, window.s.y, SRCCOPY, false); //B // BitBlt(TempDC, 0, half.y, half.x, rest.y, // imageDC, window.s.x + rest.x, window.s.y + Hd, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, 0, half.y, half.x, rest.y, window.s.x + rest.x, window.s.y + Hd, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, 0, half.y, half.x, rest.y, // layerDC, window.s.x + rest.x, window.s.y + Hd, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, 0, half.y, half.x, rest.y, window.s.x + rest.x, window.s.y + Hd, SRCCOPY, false); } //C // BitBlt(TempDC, half.x, 0, rest.x, half.y, // imageDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, 0, rest.x, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, half.x, 0, rest.x, half.y, // layerDC, window.s.x, window.s.y + rest.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, half.x, 0, rest.x, half.y, window.s.x, window.s.y + rest.y, SRCCOPY, false); //D // BitBlt(TempDC, half.x, half.y, rest.x, rest.y, // imageDC, window.s.x, window.s.y, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, half.x, half.y, rest.x, rest.y, window.s.x, window.s.y, SRCCOPY, false); // convert by celberus // BitBlt(MaskDC, half.x, half.y, rest.x, rest.y, // layerDC, window.s.x, window.s.y, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, half.x, half.y, rest.x, rest.y, window.s.x, window.s.y, SRCCOPY, false); // BitBlt(imageDC, window.s.x, window.s.y, window.size.x, window.size.y, // TempDC, 0, 0, SRCCOPY); Image->uBitmap->UnionBitBlt(TempDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus // BitBlt(layerDC, window.s.x, window.s.y, window.size.x, window.size.y, // MaskDC, 0, 0, SRCCOPY); Image->LayerMask->UnionBitBlt(MaskDC, window.s.x, window.s.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); stVertical->Caption = dncount; } TempMask->DeleteDC(MaskDC); // Image->LayerMask->DeleteDC(layerDC); TempImage->DeleteDC(TempDC); // Image->uBitmap->DeleteDC(imageDC); // convert by celberus if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } delete TempMask; delete TempImage; ::RepaintImage(); Screen->Cursor = OldCursor; END_LOG; return; fail: if (undoSw) MainImageForm->Undo->RemoveLast(); if (TempImage) { if (TempDC) TempImage->DeleteDC(TempDC); delete TempImage; } if (TempMask) { if (MaskDC) TempMask->DeleteDC(MaskDC); delete TempMask; } // if (imageDC) Image->uBitmap->DeleteDC(imageDC); // convert by celberus // if (layerDC) Image->LayerMask->DeleteDC(layerDC); if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(ec); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::SelectFocus(TObject *Sender, TShiftState Shift, int X, int Y) { TImage *s; s = (TImage *)Sender; if (s == RepeatCell1) { StdArrowL->Visible = true; StdArrowR->Visible = false; } else if (s == RepeatCell2) { StdArrowL->Visible = false; StdArrowR->Visible = true; } else if (s == RepeatCell3) { HozArrowL->Visible = true; HozArrowR->Visible = false; } else if (s == RepeatCell4) { HozArrowL->Visible = false; HozArrowR->Visible = true; } else if (s == RepeatCell5) { VerArrowL->Visible = true; VerArrowR->Visible = false; } else if (s == RepeatCell6) { VerArrowL->Visible = false; VerArrowR->Visible = true; } else if (s == RepeatCell7) { HozArrowL->Visible = false; HozArrowR->Visible = true; } else if (s == RepeatCell8) { VerArrowL->Visible = false; VerArrowR->Visible = true; } } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::FunctionClick(TObject *Sender) { BEGIN_LOG(""); TRzButton *s; HRGN hRgn = NULL; TPException ec = EC_NONE; s = (TRzButton *)Sender; hRgn = Image->uBitmap->RgnBitmap->GetRegion(true); // convert by celberus if (s == rzbtNormal) { Item = TREPEAT_NORMAL; ComboBoxWH->Enabled = false; LabelMax->Enabled = false; // Panel5->SetFocus(); // ¸ÇõÀ½¿¡ setfocus¸¦ ÇÏ¸é ¿¢¼¼½º°¡ ¹ß»ýÇÑ´Ù. ¿ÖÀϱî? ±×·¡¼­ ÁÖ¼®~ // ÄÞº¸¹Ú½ºµîÀÌ Æ÷Ä¿½º¸¦ °¡Áø »óÅ¿¡¼­ ´Ù¸¥ ½ºÇǵå¹öưÀ» ´©¸£¸é Æ÷Ä¿½º¸¦ ÀÒ¾î ¹ö·¯¼­ // ´ÜÃà۰¡ ¸ÔÁö ¾Ê´Â ¹®Á¦ ¶§¹®¿¡ ÀÌ ºÎºÐÀÌ ÇÊ¿äÇß°í, ´Ù¸¥ ºÎºÐ¿¡µµ setfocus¸¦ ³Ö¾ú´Ù. } else if (s == rzbtHDVer) { Item = TREPEAT_HDVER; ComboBoxWH->Enabled = true; ComboBoxWH->Text = Hdiv; LabelMax->Enabled = true; LabelMax->Caption = Format(IDS_COMMON_MAX + " : %d", OPENARRAY(TVarRec, ((int)spEditH->Max))); // Panel5->SetFocus(); } else if (s == rzbtHDHor) { Item = TREPEAT_HDHOR; ComboBoxWH->Enabled = true; ComboBoxWH->Text = Wdiv; LabelMax->Enabled = true; LabelMax->Caption = Format(IDS_COMMON_MAX + " : %d", OPENARRAY(TVarRec, ((int)spEditW->Max))); // Panel5->SetFocus(); } if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } // if (sbManRep->Down == true) { // for PFM by celberus // ¹«Á¶°Ç manual repeat if (s == rzbtNormal || s == rzbtHDVer || s == rzbtHDHor) { PreViewPanel->BringToFront(); makePatternView(); } Image->SubVisible = true; SetRepeatImage(); // } ManualRepeatForm->Height = 190; m_type = 0; END_LOG; return; fail: if (hRgn) { Image->uBitmap->RgnBitmap->PutRegion(hRgn); // convert by celberus DeleteObject(hRgn); } EXCEPTION_MESSAGE_OK(ec); END_LOG; } //---------------------------------------------------------------------------- void __fastcall TManualRepeatForm::FunctionMatchClick(TObject *Sender) { BEGIN_LOG(""); TRzButton *s = (TRzButton *) Sender; if (s == rzbtMatchNormal) { Image->SubVisible = false; Item = TREPEAT_MNORMAL; NormalPanel->Top = 0; NormalPanel->Left = 0; ManualRepeatForm->Height = 177; NormalPanel->BringToFront(); if (bChange) dncount = 0; stNormal->Caption = dncount; m_type = 1; // Panel5->SetFocus(); } else if (s == rzbtMatchVer) { Image->SubVisible = false; Item = TREPEAT_MVER; VerPanel->Top = 0; VerPanel->Left = 0; ManualRepeatForm->Height = 210; VerPanel->BringToFront(); spEditH->Value = Hdiv; LabelH->Caption = String(IDS_COMMON_HEIGHT) + Format(" (0 - %d)", OPENARRAY (TVarRec, ((int)spEditH->Max))); if (bChange) dncount = 0; stVertical->Caption = dncount; m_type = 2; spEditH->SetFocus(); } else if (s == rzbtMatchHor) { Image->SubVisible = false; Item = TREPEAT_MHOR; HorPanel->Top = 0; HorPanel->Left = 0; ManualRepeatForm->Height = 210; HorPanel->BringToFront(); spEditW->Value = Wdiv; LabelW->Caption = String(IDS_COMMON_WIDTH) + Format(" (0 - %d)", OPENARRAY (TVarRec, ((int)spEditW->Max))); if (bChange) dncount = 0; stHorizontal->Caption = dncount; m_type = 3; spEditW->SetFocus(); } SetRepeatImage(); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::spEditClick(TObject *Sender) { ((TRzSpinEdit *) Sender)->SelectAll(); ((TRzSpinEdit *) Sender)->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::spEditChange(TObject *Sender) { TRzSpinEdit *s = (TRzSpinEdit *) Sender; if (s->Text.Length()>0) { int w = window.size.x / 2; int h = window.size.y / 2; int val = s->Value; // ÀÔ·Â ¹üÀ§¸¦ ³Ñ¾î¼¹À» °æ¿ìÀÇ Ã³¸® - by monkman (2005.08.04) if (s->Text.ToInt() > s->Max) { s->Text = IntToStr((int)(s->Max)); return; } // ¾Æ·¡ Äڵ尡 ¾ÆÁÖ È¿À²ÀûÀ̳ª ±âÁ¸ ÀÎÅÍÆäÀ̽º¿Í µ¿ÀÏÇÏ°Ô À¯ÁöÇϱâ À§ÇØ //if (s->Text.ToInt() > s->MaxValue) { // s->Text = s->Text.SubString(1, s->Text.Length()-1); // s->SelStart = s->Text.Length(); // return; //} if (s->Tag) { if (val < h) { HInd = 1; Panel3->Visible = false; Panel4->Visible = true; } else { HInd = 0; Panel3->Visible = true; Panel4->Visible = false; } Hdiv = val; } else { if (val < w) { WInd = 1; Panel1->Visible = false; Panel2->Visible = true; } else { WInd = 0; Panel1->Visible = true; Panel2->Visible = false; } Wdiv = val; } } } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::ComboBoxWH_Change(TObject *Sender) { BEGIN_LOG(""); bool RepeatSW = false; if (Item == TREPEAT_HDHOR) { switch (ComboBoxWH->ItemIndex) { case 0: Wdiv = window.size.x / 8; RepeatSW = true; break; case 1: Wdiv = window.size.x / 4; RepeatSW = true; break; case 2: Wdiv = window.size.x / 2; RepeatSW = true; break; case 3: Wdiv = 3 * window.size.x / 4; RepeatSW = true; break; case 4: Wdiv = 7 * window.size.x / 8; RepeatSW = true; break; } spEditW->Value = Wdiv; } else if (Item == TREPEAT_HDVER) { switch (ComboBoxWH->ItemIndex) { case 0: Hdiv = window.size.y / 8; RepeatSW = true; break; case 1: Hdiv = window.size.y / 4; RepeatSW = true; break; case 2: Hdiv = window.size.y / 2; RepeatSW = true; break; case 3: Hdiv = 3 * window.size.y / 4; RepeatSW = true; break; case 4: Hdiv = 7 * window.size.y / 8; RepeatSW = true; break; } spEditH->Value = Hdiv; } if (!RepeatSW) { if (InvalidInput() == false) { END_LOG; return; } int value = 0; if (TryStrToInt(ComboBoxWH->Text, value)){ if (rzbtHDVer->Down) { if (value > spEditH->Max) { value = spEditH->Max; ComboBoxWH->Text = value; } Hdiv = value; spEditH->Value = value; } if (rzbtHDHor->Down) { if (value > spEditW->Max) { value = spEditW->Max; ComboBoxWH->Text = value; } Wdiv = value; spEditW->Value = value; } SetRepeatImage(); } else { ComboBoxWH->Text = 0; } } if (ComboBoxWH->ItemIndex >= 0) SetRepeatImage(); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::ComboBoxWH_KeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { /* if (Key == VK_RETURN) { if (InvalidInput() == false) return; int value = StrToInt(ComboBoxWH->Text); if (rzbtHDVer->Down) { if (value > spEditH->MaxValue) { value = spEditH->MaxValue; ComboBoxWH->Text = value; } Hdiv = value; spEditH->Value = value; } if (rzbtHDHor->Down) { if (value > spEditW->MaxValue) { value = spEditW->MaxValue; ComboBoxWH->Text = value; } Wdiv = value; spEditW->Value = value; } SetRepeatImage(); } else if (Key == VK_F1) { if (!sbManRep->Down) { sbRepClick(sbManRep); sbManRep->Down = true; } } else if (Key == VK_F2) { if (!sbAutoRep->Down) { sbRepClick(sbAutoRep); sbAutoRep->Down = true; } } else if (Key == '1' && sbManRep->Down) { if (!rzbtNormal->Down) { FunctionClick(rzbtNormal); rzbtNormal->Down = true; } } else if (Key == '2' && sbManRep->Down) { if (!rzbtHDVer->Down) { FunctionClick(rzbtHDVer); rzbtHDVer->Down = true; } } else if (Key == '3' && sbManRep->Down) { if (!rzbtHDHor->Down) { FunctionClick(rzbtHDHor); rzbtHDHor->Down = true; } } else if (Key == '4' && sbManRep->Down) { if (!rzbtMatchNormal->Down) { FunctionMatchClick(rzbtMatchNormal); rzbtMatchNormal->Down = true; } } else if (Key == '5' && sbManRep->Down) { if (!rzbtMatchVer->Down) { FunctionMatchClick(rzbtMatchVer); rzbtMatchVer->Down = true; } } else if (Key == '6' && sbManRep->Down) { if (!rzbtMatchHor->Down) { FunctionMatchClick(rzbtMatchHor); rzbtMatchHor->Down = true; } } else if (Key == '1' && sbAutoRep->Down) { if (!sbANormal->Down) { sbAMethodClick(sbANormal); sbANormal->Down = true; } } else if (Key == '2' && sbAutoRep->Down) { if (!sbAHor->Down) { sbAMethodClick(sbAHor); sbAHor->Down = true; } } else if (Key == '3' && sbAutoRep->Down) { if (!sbAVer->Down) { sbAMethodClick(sbAVer); sbAVer->Down = true; } } */ } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::InvalidInput() { String str = ComboBoxWH->Text; for (int i = 0; i < ComboBoxWH->Items->Count; i++) { if (str == ComboBoxWH->Items->Strings[i]) return false; } return true; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::ComboBoxWH_DblClick(TObject *Sender) { ComboBoxWH->SetFocus(); ComboBoxWH->SelectAll(); } //--------------------------------------------------------------------------- // Private Function //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::DrawRepeat(int X, int Y) { BEGIN_LOG(""); Byte *IP = 0, *RP = 0, *MP = 0; COLORREF color, ic, rc, bgc; int i, j; TPException ec = EC_NONE; if (MainImageForm->MaskArea) { if (!Image->uBitmap->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Image->Mask->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Image->SubBitmap->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (FullViewForm->Super==sOverlap) { MainImageForm->InitOverlap(); if (Image->uBitmap->BitsPerPixel==8) { if (MainImageForm->Protect) { StatusProgress->Maximum = RepeatRect.size.y; for (i=RepeatRect.s.y; iPosition = i - RepeatRect.s.y; IP = Image->uBitmap->GetScanLine(i)+RepeatRect.s.x; MP = Image->Mask->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; jPalette->ColorData[*IP]->Protect==0 && (*MP == 0)) { if (*IP > 1) { color = MainImageForm->Overlap(*IP, *RP); if (color==0xFF) { MainImageForm->ExitOverlap(); Image->SubBitmap->StopScanLine(); Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); FullViewForm->ExitOverlapChange(); MainImageForm->Undo->UndoRead(); EXCEPTION_MESSAGE_OK(EC_COLOR_OVERFLOW); END_LOG; return false; } else { *IP = color; } } else { *IP = *RP; } } } Image->uBitmap->PutScanLine(i); } StatusProgress->End(); } else { StatusProgress->Maximum = RepeatRect.size.y; for (i=RepeatRect.s.y; iPosition = i - RepeatRect.s.y; IP = Image->uBitmap->GetScanLine(i)+RepeatRect.s.x; MP = Image->Mask->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; j 1) { color = MainImageForm->Overlap(*IP, *RP); if (color==0xFF) { MainImageForm->ExitOverlap(); Image->SubBitmap->StopScanLine(); Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); FullViewForm->ExitOverlapChange(); MainImageForm->Undo->UndoRead(); EXCEPTION_MESSAGE_OK(EC_COLOR_OVERFLOW); END_LOG; return false; } else { *IP = color; } } else { *IP = *RP; } } } Image->uBitmap->PutScanLine(i); } } StatusProgress->End(); } else { StatusProgress->Maximum = RepeatRect.size.y; bgc = MainImageForm->Palette->Color[1]; for (i=RepeatRect.s.y; iPosition = i - RepeatRect.s.y; IP = Image->uBitmap->GetScanLine(i)+3*RepeatRect.s.x; MP = Image->Mask->GetScanLine(i); RP = Image->SubBitmap->GetScanLine(i)+3*RepeatRect.s.x; for (j=RepeatRect.s.x; j> 3] & (0x80 >> (j & 7))) == 0) { GetPixel24(IP, ic); if (ic != bgc) { GetPixel24(RP, rc); color = MainImageForm->Overlap(ic, rc); SetPixel24(IP, color); } else { CopyPixel24(IP, RP); } } } Image->uBitmap->PutScanLine(i); } StatusProgress->End(); } MainImageForm->ExitOverlap(); } else { if (Image->uBitmap->BitsPerPixel==8) { StatusProgress->Maximum = RepeatRect.size.y; for (i=RepeatRect.s.y; iPosition = i - RepeatRect.s.y; IP = Image->uBitmap->GetScanLine(i)+RepeatRect.s.x; MP = Image->Mask->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; juBitmap->PutScanLine(i); } StatusProgress->End(); } else { StatusProgress->Maximum = RepeatRect.size.y; for (i=RepeatRect.s.y; iPosition = i - RepeatRect.s.y; IP = Image->uBitmap->GetScanLine(i)+3*RepeatRect.s.x; MP = Image->Mask->GetScanLine(i); RP = Image->SubBitmap->GetScanLine(i)+3*RepeatRect.s.x; for (j=RepeatRect.s.x; j> 3] & (0x80 >> (j & 7))) == 0) { CopyPixel24(IP, RP); } } Image->uBitmap->PutScanLine(i); } StatusProgress->End(); } } Image->SubBitmap->StopScanLine(); Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); } else { if (FullViewForm->Super==sOverlap) { if (!Image->uBitmap->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Image->SubBitmap->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } MainImageForm->InitOverlap(); if (Image->uBitmap->BitsPerPixel==8) { if (MainImageForm->Protect) { StatusProgress->Maximum = RepeatRect.size.y; for (i=RepeatRect.s.y; iPosition = i - RepeatRect.s.y; IP = Image->uBitmap->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; jPalette->ColorData[*IP]->Protect==0) { if (*IP > 1) { color = MainImageForm->Overlap(*IP, *RP); if (color==0xFF) { MainImageForm->ExitOverlap(); Image->SubBitmap->StopScanLine(); Image->uBitmap->StopScanLine(); FullViewForm->ExitOverlapChange(); MainImageForm->Undo->UndoRead(); EXCEPTION_MESSAGE_OK(EC_COLOR_OVERFLOW); END_LOG; return false; } else { *IP = color; } } else { *IP = *RP; } } } Image->uBitmap->PutScanLine(i); } StatusProgress->End(); } else { StatusProgress->Maximum = RepeatRect.size.y; Image->SubMask->StartScanLine(); for (i=RepeatRect.s.y; iPosition = i - RepeatRect.s.y; IP = Image->uBitmap->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; MP = Image->SubMask->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; j 1) { color = MainImageForm->Overlap(*IP, *RP); if (color==0xFF) { MainImageForm->ExitOverlap(); Image->SubBitmap->StopScanLine(); Image->uBitmap->StopScanLine(); Image->SubMask->StopScanLine(); FullViewForm->ExitOverlapChange(); // MainImageForm->Undo->UndoRead(); EXCEPTION_MESSAGE_OK(EC_COLOR_OVERFLOW); END_LOG; return false; } else { *IP = color; } } else { *IP = *RP; } } } Image->uBitmap->PutScanLine(i); } Image->SubMask->StopScanLine(); StatusProgress->End(); } } else { StatusProgress->Maximum = RepeatRect.size.y; Image->SubMask->StartScanLine(); bgc = MainImageForm->Palette->Color[1]; for (i=RepeatRect.s.y; iPosition = i - RepeatRect.s.y; IP = Image->uBitmap->GetScanLine(i)+3*RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+3*RepeatRect.s.x; MP = Image->SubMask->GetScanLine(i); for (j=RepeatRect.s.x; j> 3)) & (0x80 >> (j & 7))) == 0) { GetPixel24(IP, ic); if (ic != bgc) { GetPixel24(RP, rc); color = MainImageForm->Overlap(ic, rc); SetPixel24(IP, color); } else { CopyPixel24(IP, RP); } } } Image->uBitmap->PutScanLine(i); } Image->SubMask->StopScanLine(); StatusProgress->End(); } MainImageForm->ExitOverlap(); Image->SubBitmap->StopScanLine(); Image->uBitmap->StopScanLine(); } else { Image->uBitmap->Copy(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.size.x, RepeatRect.size.y, Image->SubMask, RepeatRect.s.x, RepeatRect.s.y, SRCAND, StatusProgress); Image->uBitmap->Copy(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.size.x, RepeatRect.size.y, Image->SubBitmap, RepeatRect.s.x, RepeatRect.s.y, SRCPAINT, StatusProgress); } if (Image->LayerMask) Image->LayerMask->Copy(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.size.x, RepeatRect.size.y, Image->SubMask, RepeatRect.s.x, RepeatRect.s.y, SRCAND); } END_LOG; return true; fail: Image->SubBitmap->StopScanLine(); Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); EXCEPTION_MESSAGE_OK(ec); END_LOG; return false; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::DrawRepeat_BG(int X, int Y) { BEGIN_LOG(""); Byte *IP = 0, *RP = 0, *MP = 0, *PP = 0; bool undoSw = false; COLORREF color, ic, rc, bgc; int i, j; TPException ec = EC_NONE; if (MainImageForm->MaskArea) { if (!Image->uBitmap->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Image->Mask->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Image->SubBitmap->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Image->BackGround->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (FullViewForm->Super==sOverlap) { MainImageForm->InitOverlap(); if (Image->uBitmap->BitsPerPixel==8) { if (MainImageForm->Protect) { for (i=RepeatRect.s.y; iuBitmap->GetScanLine(i)+RepeatRect.s.x; MP = Image->Mask->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; PP = Image->BackGround->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; jPalette->ColorData[*IP/**PP*/]->Protect==0 && (*MP == 0)) { if (*IP/**PP*/ > 1) { color = MainImageForm->Overlap(*IP/**PP*/, *RP); if (color==0xFF) { MainImageForm->ExitOverlap(); Image->SubBitmap->StopScanLine(); Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); Image->BackGround->StopScanLine(); FullViewForm->ExitOverlapChange(); EXCEPTION_MESSAGE_OK(EC_COLOR_OVERFLOW); END_LOG; return false; } else { *IP = color; } } else { *IP = *RP; } } } Image->uBitmap->PutScanLine(i); } } else { for (i=RepeatRect.s.y; iuBitmap->GetScanLine(i)+RepeatRect.s.x; MP = Image->Mask->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; PP = Image->BackGround->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; j 1) { color = MainImageForm->Overlap(*IP/**PP*/, *RP); if (color==0xFF) { MainImageForm->ExitOverlap(); Image->SubBitmap->StopScanLine(); Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); Image->BackGround->StopScanLine(); FullViewForm->ExitOverlapChange(); EXCEPTION_MESSAGE_OK(EC_COLOR_OVERFLOW); END_LOG; return false; } else { *IP = color; } } else { *IP = *RP; } } } Image->uBitmap->PutScanLine(i); } } } else { bgc = MainImageForm->Palette->Color[1]; for (i=RepeatRect.s.y; iuBitmap->GetScanLine(i)+3*RepeatRect.s.x; MP = Image->Mask->GetScanLine(i); RP = Image->SubBitmap->GetScanLine(i)+3*RepeatRect.s.x; PP = Image->BackGround->GetScanLine(i) + 3*RepeatRect.s.x; for (j=RepeatRect.s.x; j> 3] & (0x80 >> (j & 7))) == 0) { GetPixel24(PP, ic); if (ic != bgc) { GetPixel24(RP, rc); color = MainImageForm->Overlap(ic, rc); SetPixel24(IP, color); } else { CopyPixel24(IP, RP); } } } Image->uBitmap->PutScanLine(i); } } MainImageForm->ExitOverlap(); } else { if (Image->uBitmap->BitsPerPixel==8) { for (i=RepeatRect.s.y; iuBitmap->GetScanLine(i)+RepeatRect.s.x; MP = Image->Mask->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; PP = Image->BackGround->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; juBitmap->PutScanLine(i); } } else { for (i=RepeatRect.s.y; iuBitmap->GetScanLine(i)+3*RepeatRect.s.x; MP = Image->Mask->GetScanLine(i); RP = Image->SubBitmap->GetScanLine(i)+3*RepeatRect.s.x; PP = Image->BackGround->GetScanLine(i)+3*RepeatRect.s.x; for (j=RepeatRect.s.x; j> 3] & (0x80 >> (j & 7))) == 0) { CopyPixel24(IP, RP); } } Image->uBitmap->PutScanLine(i); } } } Image->BackGround->StopScanLine(); Image->SubBitmap->StopScanLine(); Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); } else { if (FullViewForm->Super==sOverlap) { if (!Image->uBitmap->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Image->SubBitmap->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Image->BackGround->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } MainImageForm->InitOverlap(); if (Image->uBitmap->BitsPerPixel==8) { if (MainImageForm->Protect) { for (i=RepeatRect.s.y; iuBitmap->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; PP = Image->BackGround->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; jPalette->ColorData[*IP/**PP*/]->Protect==0) { if (*IP/**PP*/ > 1) { color = MainImageForm->Overlap(*IP/**PP*/, *RP); if (color==0xFF) { MainImageForm->ExitOverlap(); Image->BackGround->StopScanLine(); Image->SubBitmap->StopScanLine(); Image->uBitmap->StopScanLine(); FullViewForm->ExitOverlapChange(); EXCEPTION_MESSAGE_OK(EC_COLOR_OVERFLOW); END_LOG; return false; } else { *IP = color; } } else { *IP = *RP; } } } Image->uBitmap->PutScanLine(i); } } else { for (i=RepeatRect.s.y; iuBitmap->GetScanLine(i)+RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+RepeatRect.s.x; PP = Image->BackGround->GetScanLine(i)+RepeatRect.s.x; for (j=RepeatRect.s.x; j 1) { color = MainImageForm->Overlap(*IP/**PP*/, *RP); if (color==0xFF) { MainImageForm->ExitOverlap(); Image->BackGround->StopScanLine(); Image->SubBitmap->StopScanLine(); Image->uBitmap->StopScanLine(); FullViewForm->ExitOverlapChange(); EXCEPTION_MESSAGE_OK(EC_COLOR_OVERFLOW); END_LOG; return false; } else { *IP = color; } } else { *IP = *RP; } } Image->uBitmap->PutScanLine(i); } } } else { bgc = MainImageForm->Palette->Color[1]; for (i=RepeatRect.s.y; iuBitmap->GetScanLine(i)+3*RepeatRect.s.x; RP = Image->SubBitmap->GetScanLine(i)+3*RepeatRect.s.x; PP = Image->BackGround->GetScanLine(i)+3*RepeatRect.s.x; for (j=RepeatRect.s.x; jOverlap(ic, rc); SetPixel24(IP, color); } else { CopyPixel24(IP, RP); } } Image->uBitmap->PutScanLine(i); } } MainImageForm->ExitOverlap(); Image->BackGround->StopScanLine(); Image->SubBitmap->StopScanLine(); Image->uBitmap->StopScanLine(); } else { Image->uBitmap->Copy(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.size.x, RepeatRect.size.y, Image->SubMask, RepeatRect.s.x, RepeatRect.s.y, SRCAND); Image->uBitmap->Copy(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.size.x, RepeatRect.size.y, Image->SubBitmap, RepeatRect.s.x, RepeatRect.s.y, SRCPAINT); } } if (Image->LayerMask) Image->LayerMask->Copy(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.size.x, RepeatRect.size.y, Image->SubMask, RepeatRect.s.x, RepeatRect.s.y, SRCAND); END_LOG; return true; fail: Image->SubBitmap->StopScanLine(); Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); Image->BackGround->StopScanLine(); if (undoSw == true) MainImageForm->Undo->RemoveLast(); EXCEPTION_MESSAGE_OK(ec); END_LOG; return false; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::SubMouseDown(int X, int Y) { BEGIN_LOG(""); bool undoSw = false; MainImageForm->WorkArea->PushUndo(); if ((undoSw = MainImageForm->UndoSave(UK_ALL, Rect(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.e.x, RepeatRect.e.y))) == false) goto fail; switch (Image->IsBackGround()) { case 0: if (FullViewForm->Super==sOverlap) { if (MainImageForm->MaskArea || MainImageForm->Protect) { FullViewForm->ReadyToOverlapChange(Image->SubBitmap, Rect(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.e.x, RepeatRect.e.y), MainImageForm->Palette->UseColor, true); } else { FullViewForm->ReadyToOverlapChange(Image->SubBitmap, Rect(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.e.x, RepeatRect.e.y), MainImageForm->Palette->UseColor, true, Image->SubMask); } } if (!DrawRepeat(X, Y)) goto fail; break; case 1: if (FullViewForm->Super==sOverlap) { FullViewForm->ReadyToOverlapChange(Image->SubBitmap, Rect(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.e.x, RepeatRect.e.y), MainImageForm->Palette->UseColor, true); } if (!DrawRepeat_BG(X, Y)) goto fail; break; default: goto fail; } MainImageForm->WorkArea->SetRectangle(Rect(RepeatRect.s.x, RepeatRect.s.y, RepeatRect.e.x, RepeatRect.e.y)); MainImageForm->WorkAreaChange(); END_LOG; return true; fail: // if (undoSw == true) MainImageForm->Undo->RemoveLast(); if (undoSw) MainImageForm->Undo->UndoRead(); //by linuxjun _ColorOverflow END_LOG; return false; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::SubMouseMove(int X, int Y) { int valueX = 1, valueY = 1; int limX = 0, limY = 0; if ((Item == TREPEAT_NORMAL) || (Item == TREPEAT_HDHOR) || (Item == TREPEAT_HDVER)) { if (X < 0) X = 0; else if (X > Image->uBitmap->Width) X = Image->uBitmap->Width; if (Y < 0) Y = 0; else if (Y > Image->uBitmap->Height) Y = Image->uBitmap->Height; if (selectsize) { valueX = spEditX->Value; valueY = spEditY->Value; if (X < (window.s.x + window.size.x / 2)) { limX = window.s.x - (window.size.x * (valueX - 1)); if (limX < 0) limX = 0; RepeatRect.s.x = limX; RepeatRect.e.x = window.e.x; } else { limX = window.s.x + (window.size.x * valueX); if (limX > Image->uBitmap->Width) limX = Image->uBitmap->Width; RepeatRect.s.x = window.s.x; RepeatRect.e.x = limX; } if (Y < (window.s.y + window.size.y / 2)) { limY = window.s.y - (window.size.y * (valueY - 1)); if (limY < 0) limY = 0; RepeatRect.s.y = limY; RepeatRect.e.y = window.e.y; } else { limY = window.s.y + (window.size.y * valueY); if (limY > Image->uBitmap->Height) limY = Image->uBitmap->Height; RepeatRect.s.y = window.s.y; RepeatRect.e.y = limY; } } else { if (X < window.s.x) { RepeatRect.s.x = X; RepeatRect.e.x = window.e.x; } else { RepeatRect.s.x = window.s.x; RepeatRect.e.x = X+1; } if (Y < window.s.y) { RepeatRect.s.y = Y; RepeatRect.e.y = window.e.y; } else { RepeatRect.s.y = window.s.y; RepeatRect.e.y = Y+1; } } RepeatRect.size.x = RepeatRect.e.x - RepeatRect.s.x; RepeatRect.size.y = RepeatRect.e.y - RepeatRect.s.y; paintrect = Image->SubRange; Image->SubRange.left = RepeatRect.s.x; Image->SubRange.top = RepeatRect.s.y; Image->SubRange.right = RepeatRect.e.x; Image->SubRange.bottom = RepeatRect.e.y; } } //--------------------------------------------------------------------------- // Public Function //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::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)) { } else { ManualPanel->Visible = true; ManualPanel->BringToFront(); Item = TREPEAT_NORMAL; RepeatRect.s = window.s; RepeatRect.e = window.e; RepeatRect.size = window.size; RepeatRect.Bitmap = 0; RepeatRect.Mask = 0; RepeatRect.Back = 0; Image->SubRange.left = 0; Image->SubRange.top = 0; Image->SubRange.right = 0; Image->SubRange.bottom = 0; InitMan_RepForm(); } Screen->Cursor = OldCursor; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::ExitForm(void) { BEGIN_LOG(""); WriteIniFile(); MainImageForm->iMainImage->SubVisible = false; MainImageForm->iMainImage->SubEnabled = false; MainImageForm->iMainImage->SubMethod = false; MainImageForm->iMainImage->ExitBackGround(0x08); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::ReadIniFile(int &mw, int &mh) { BEGIN_LOG(""); TIniFile *RepeatIni = NULL; int sx, sy, w, h, index; RepeatIni = new TIniFile(AppDataItem + "\\Repeat.ini"); if (RepeatIni) { index = RepeatIni->ReadInteger("Key", "Index", -1); sx = RepeatIni->ReadInteger("WorkArea", "Left", 0); sy = RepeatIni->ReadInteger("WorkArea", "Top", 0); w = RepeatIni->ReadInteger("WorkArea", "Width", 0); h = RepeatIni->ReadInteger("WorkArea", "Height", 0); m_type = RepeatIni->ReadInteger("Match", "Type", 0); mw = RepeatIni->ReadInteger("Match", "Width", 0); mh = RepeatIni->ReadInteger("Match", "Height", 0); dncount = RepeatIni->ReadInteger("Match", "Count", 0); delete RepeatIni; } if (MainImageForm->Number == index && sx == window.s.x && sy == window.s.y && w == window.size.x && h == window.size.y) { bChange = false; } else { bChange = true; m_type = mw = mh = dncount = 0; } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::WriteIniFile() { BEGIN_LOG(""); TIniFile *RepeatIni = NULL; RepeatIni = new TIniFile(AppDataItem + "\\Repeat.ini"); if (RepeatIni) { RepeatIni->WriteInteger("Key", "Index", MainImageForm->Number); RepeatIni->WriteInteger("WorkArea", "Left", window.s.x); RepeatIni->WriteInteger("WorkArea", "Top", window.s.y); RepeatIni->WriteInteger("WorkArea", "Width", window.size.x); RepeatIni->WriteInteger("WorkArea", "Height", window.size.y); RepeatIni->WriteInteger("Match", "Type", m_type); RepeatIni->WriteInteger("Match", "Width", Wdiv); RepeatIni->WriteInteger("Match", "Height", Hdiv); RepeatIni->WriteInteger("Match", "Count", dncount); delete RepeatIni; } END_LOG; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::ReadyToMakeRepeatImage() { BEGIN_LOG(""); int ww, hh; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; if (Image->uBitmap->BitsPerPixel == 8) { if (!Image->SubBitmap->Create(ww, hh, 8, rgb)) goto fail;; if (!Image->SubMask->Create(ww, hh, 8, rgb)) goto fail; } else { if (!Image->SubBitmap->Create(ww, hh, 24)) goto fail; if (!Image->SubMask->Create(ww, hh, 1)) goto fail; } END_LOG; return true; fail: END_LOG; return false; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::MakeUnitBitmap_none(TTexpiaBitmap *Bitmap, TTexpiaBitmap *Mask) { BEGIN_LOG(""); Byte *isp, *idp, *msp, *mdp, mm; int x, y; COLORREF bgc, c; if (!Bitmap->StartScanLine()) goto fail; if (!MainImageForm->WorkArea->Mask->StartScanLine()) goto fail; if (!Image->uBitmap->StartScanLine()) goto fail; if (Image->uBitmap->BitsPerPixel == 8) { switch (FullViewForm->Super) { case sOff: for (y=0; yuBitmap->GetScanLine(window.s.y+y)+window.s.x; idp = Bitmap->GetScanLine(y); msp = MainImageForm->WorkArea->Mask->GetScanLine(y); for (x=0; xPutScanLine(y); } break; case sOverlap: case sNormal: case sGauze: for (y=0; yuBitmap->GetScanLine(window.s.y+y)+window.s.x; idp = Bitmap->GetScanLine(y); msp = MainImageForm->WorkArea->Mask->GetScanLine(y); for (x=0; x1) { *idp = *isp; } else { *idp = 0; } } Bitmap->PutScanLine(y); } break; } } else { Mask->StartScanLine(); switch (FullViewForm->Super) { case sOff: for (y=0; yuBitmap->GetScanLine(window.s.y+y)+3*window.s.x; idp = Bitmap->GetScanLine(y); mdp = Mask->GetScanLine(y); msp = MainImageForm->WorkArea->Mask->GetScanLine(y); mm = 0x80; *mdp = 0; x = 0; while(1) { if (*msp&mm) { CopyPixel24(idp, isp); } else { SetPixel24(idp, 0); *mdp |= mm; } x++; if (x >= window.size.x) break; isp += 3; idp += 3; if (mm==1) { msp++; mdp++; *mdp = 0; mm = 0x80; } else mm >>= 1; } Mask->PutScanLine(y); Bitmap->PutScanLine(y); } break; case sOverlap: case sNormal: case sGauze: bgc = MainImageForm->Palette->Color[1]; for (y=0; yuBitmap->GetScanLine(window.s.y+y)+3*window.s.x; idp = Bitmap->GetScanLine(y); mdp = Mask->GetScanLine(y); msp = MainImageForm->WorkArea->Mask->GetScanLine(y); mm = 0x80; *mdp = 0; x = 0; while(1) { GetPixel24(isp, c); if ((*msp&mm) && c!=bgc) { CopyPixel24(idp, isp); } else { SetPixel24(idp, 0); *mdp |= mm; } x++; if (x >= window.size.x) break; isp += 3; idp += 3; if (mm==1) { msp++; mdp++; *mdp = 0; mm = 0x80; } else mm >>= 1; } Mask->PutScanLine(y); Bitmap->PutScanLine(y); } break; } Mask->StopScanLine(); } Bitmap->StopScanLine(); MainImageForm->WorkArea->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); END_LOG; return; fail: Bitmap->StopScanLine(); MainImageForm->WorkArea->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::MakeUnitBitmap_layer(TTexpiaBitmap *Bitmap, TTexpiaBitmap *Mask) { BEGIN_LOG(""); Byte *isp, *idp, *msp, *mdp, *lmp, mm; int x, y, lx; COLORREF bgc, c; if (!Bitmap->StartScanLine()) goto fail; if (!MainImageForm->WorkArea->Mask->StartScanLine()) goto fail; if (!Image->uBitmap->StartScanLine()) goto fail; if (!Image->LayerMask->StartScanLine()) goto fail; if (Image->uBitmap->BitsPerPixel == 8) { switch (FullViewForm->Super) { case sOff: for (y=0; yuBitmap->GetScanLine(window.s.y+y)+window.s.x; lmp = Image->LayerMask->GetScanLine(window.s.y+y)+window.s.x; idp = Bitmap->GetScanLine(y); msp = MainImageForm->WorkArea->Mask->GetScanLine(y); for (x=0; xPutScanLine(y); } break; case sOverlap: case sNormal: case sGauze: for (y=0; yuBitmap->GetScanLine(window.s.y+y)+window.s.x; lmp = Image->LayerMask->GetScanLine(window.s.y+y)+window.s.x; idp = Bitmap->GetScanLine(y); msp = MainImageForm->WorkArea->Mask->GetScanLine(y); for (x=0; x1 && *lmp == 0) { *idp = *isp; } else { *idp = 0; } } Bitmap->PutScanLine(y); } break; } } else { Mask->StartScanLine(); switch (FullViewForm->Super) { case sOff: for (y=0; yuBitmap->GetScanLine(window.s.y+y)+3*window.s.x; lmp = Image->LayerMask->GetScanLine(window.s.y+y); idp = Bitmap->GetScanLine(y); mdp = Mask->GetScanLine(y); msp = MainImageForm->WorkArea->Mask->GetScanLine(y); mm = 0x80; *mdp = 0; x = 0; while(1) { lx = x + window.s.x; if ((*msp&mm) && (lmp[lx >> 3] & (0x80 >> (lx & 7))) == 0) { CopyPixel24(idp, isp); } else { SetPixel24(idp, 0); *mdp |= mm; } x++; if (x >= window.size.x) break; isp += 3; idp += 3; if (mm==1) { msp++; mdp++; *mdp = 0; mm = 0x80; } else mm >>= 1; } Mask->PutScanLine(y); Bitmap->PutScanLine(y); } break; case sOverlap: case sNormal: case sGauze: bgc = MainImageForm->Palette->Color[1]; for (y=0; yuBitmap->GetScanLine(window.s.y+y)+3*window.s.x; lmp = Image->LayerMask->GetScanLine(window.s.y+y); idp = Bitmap->GetScanLine(y); mdp = Mask->GetScanLine(y); msp = MainImageForm->WorkArea->Mask->GetScanLine(y); mm = 0x80; *mdp = 0; x = 0; while(1) { lx = x + window.s.x; GetPixel24(isp, c); if ((*msp&mm) && c!=bgc && (lmp[lx >> 3] & (0x80 >> (lx & 7))) == 0) { CopyPixel24(idp, isp); } else { SetPixel24(idp, 0); *mdp |= mm; } x++; if (x >= window.size.x) break; isp += 3; idp += 3; if (mm==1) { msp++; mdp++; *mdp = 0; mm = 0x80; } else mm >>= 1; } Mask->PutScanLine(y); Bitmap->PutScanLine(y); } break; } Mask->StopScanLine(); } Bitmap->StopScanLine(); MainImageForm->WorkArea->Mask->StopScanLine(); Image->LayerMask->StopScanLine(); Image->uBitmap->StopScanLine(); END_LOG; return; fail: Bitmap->StopScanLine(); MainImageForm->WorkArea->Mask->StopScanLine(); Image->LayerMask->StopScanLine(); Image->uBitmap->StopScanLine(); END_LOG; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Copy(TTexpiaBitmap *Bitmap, TTexpiaBitmap *Mask) { BEGIN_LOG(""); HDC dcMask = NULL, dcBitmap = NULL; int x, y, p, Gap, w, h; w = Image->SubBitmap->Width; h = Image->SubBitmap->Height; if ((dcMask = Mask->CreateDC()) == NULL) goto fail; if ((dcBitmap = Bitmap->CreateDC()) == NULL) goto fail; if (Item == TREPEAT_NORMAL) { y = window.s.y%window.size.y; if (y) y -= window.size.y; x = window.s.x; StatusProgress->Maximum = w * h; /* TODO : Progress Bar 󸮸¦ ´Ù¸¥ °÷¿¡¼­µµ ÇØÁà¾ßÇÔ */ for (; y < h; y+=window.size.y) { StatusProgress->Position = y * window.size.x; Image->SubBitmap->UnionBitBlt(dcBitmap, x, y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus Image->SubMask->UnionBitBlt(dcMask, x, y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus } x = window.s.x%window.size.x; if (x) x -= window.size.x; for (; x< w; x+=window.size.x) { StatusProgress->Position = x * h; if(x != window.s.x) { Image->SubBitmap->CopyToItself(x, 0, window.size.x, h, window.s.x, 0, SRCCOPY); // convert by celberus Image->SubMask->CopyToItself(x, 0, window.size.x, h, window.s.x, 0, SRCCOPY); // convert by celberus } } StatusProgress->End(); } else if (Item == TREPEAT_HDHOR) { Gap = spEditW->Value; x = window.s.x%window.size.x; // if (x) x -= window.size.x; //at 7_22 by linuxjun for error correction if ((!window.s.x&&!window.s.y)||x) x -= window.size.x; //at 7_22 by linuxjun for error correction // x -= window.size.x; //at 7_22 by linuxjun for error correction y = window.s.y; for (; x < w; x+=window.size.x) { Image->SubBitmap->UnionBitBlt(dcBitmap, x, y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus Image->SubMask->UnionBitBlt(dcMask, x, y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus } p = window.s.x-((window.s.y-1)/window.size.y+1)*Gap; y = window.s.y%window.size.y; // if (y) y -= window.size.y; //at 7_22 by linuxjun for error correction if (!window.s.y||y) y -= window.size.y; //at 7_22 by linuxjun for error correction // y -= window.size.y; //at 7_22 by linuxjun for error correction for (; y < h; y+=window.size.y, p+=Gap) { if(y != window.s.y) { x = p%window.size.x; Image->SubBitmap->CopyToItself(x, y, w - window.s.x % window.size.x, window.size.y, window.s.x % window.size.x, window.s.y, SRCCOPY); // convert by celberus Image->SubMask->CopyToItself(x, y, w - window.s.x % window.size.x, window.size.y, window.s.x % window.size.x, window.s.y, SRCCOPY); // convert by celberus Image->SubBitmap->UnionBitBlt(dcBitmap, x - window.size.x, y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); Image->SubBitmap->CopyToItself(w - window.s.x % window.size.x + x, y, window.size.x, window.size.y, w - window.size.x, window.s.y, SRCCOPY); Image->SubMask->UnionBitBlt(dcMask, x - window.size.x, y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); Image->SubMask->CopyToItself(w - window.s.x % window.size.x + x, y, window.size.x, window.size.y, w - window.size.x, window.s.y, SRCCOPY); } } } else if (Item == TREPEAT_HDVER) { Gap = spEditH->Value; x = window.s.x; y = window.s.y%window.size.y; // if (y) y -= window.size.y; //at 7_22 by linuxjun for error correction if ((!window.s.x&&!window.s.y)||y) y -= window.size.y; //at 7_22 by linuxjun for error correction // y -= window.size.y; //at 7_22 by linuxjun for error correction for (; y < h; y+=window.size.y) { Image->SubBitmap->UnionBitBlt(dcBitmap, x, y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus Image->SubMask->UnionBitBlt(dcMask, x, y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); // convert by celberus } p = window.s.y-((window.s.x-1)/window.size.x+1)*Gap; x = window.s.x%window.size.x; // if (x) x -= window.size.x; //at 7_22 by linuxjun for error correction if (!window.s.x||x) x -= window.size.x; //at 7_22 by linuxjun for error correction // x -= window.size.x; //at 7_22 by linuxjun for error correction for (; x < w; x+=window.size.x, p+=Gap) { if(x != window.s.x) { y = p%window.size.y; Image->SubBitmap->CopyToItself(x, y, window.size.x, h - window.s.y % window.size.y, window.s.x, window.s.y % window.size.y, SRCCOPY); // convert by celberus Image->SubMask->CopyToItself(x, y, window.size.x, h - window.s.y % window.size.y, window.s.x, window.s.y % window.size.y, SRCCOPY); // convert by celberus Image->SubBitmap->UnionBitBlt(dcBitmap, x, y - window.size.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); Image->SubBitmap->CopyToItself(x, h - window.s.y % window.size.y + y, window.size.x, window.size.y, window.s.x, h - window.size.y, SRCCOPY); Image->SubMask->UnionBitBlt(dcMask, x, y - window.size.y, window.size.x, window.size.y, 0, 0, SRCCOPY, true); Image->SubMask->CopyToItself(x, h - window.s.y % window.size.y + y, window.size.x, window.size.y, window.s.x, h - window.size.y, SRCCOPY); } } } Bitmap->DeleteDC(dcBitmap); Mask->DeleteDC(dcMask); END_LOG; return true; fail: if (dcBitmap) Bitmap->DeleteDC(dcBitmap); if (dcMask) Mask->DeleteDC(dcMask); END_LOG; return false; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::MakeRepeat_Default8(TTexpiaBitmap *Bitmap, TTexpiaBitmap *Mask) { BEGIN_LOG(""); int x, y; Byte *idp, *sdp; Bitmap->StartScanLine(); Mask->StartScanLine(); StatusProgress->Maximum = Bitmap->Height; for (y = 0; y < Bitmap->Height; y++) { StatusProgress->Position = y; idp = Bitmap->GetScanLine(y); sdp = Mask->GetScanLine(y); for (x = 0; x < Bitmap->Width; x++, idp++, sdp++) { if (*idp) *sdp = 0; else *sdp = 0xFF; } Mask->PutScanLine(y); } StatusProgress->End(); Mask->StopScanLine(); Bitmap->StopScanLine(); END_LOG; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Gauze8(TTexpiaBitmap *Bitmap, TUnionBitmap *BackBitmap) { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *wp; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; x 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; x 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (y=0; yGetScanLine(y); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xGetScanLine(ly); if (wp[lx]) { if (*isp > 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Mask_Gauze8(TTexpiaBitmap *Bitmap, TUnionBitmap *BackBitmap) { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *wp, *mp; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; x 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; x 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xGetScanLine(ly); if (wp[lx] && (*mp == 0)) { if (*isp > 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Mask_Default8(TTexpiaBitmap *Bitmap, TUnionBitmap *BackBitmap) { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *wp, *mp; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xSubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xSubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xGetScanLine(ly); if (wp[lx] && (*mp == 0)) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Protect_Gauze8(TTexpiaBitmap *Bitmap , TUnionBitmap *BackBitmap) { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *wp; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xPalette->ColorData[*isp]->Protect==0)) { if (*isp > 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xPalette->ColorData[*isp]->Protect==0)) { if (*isp > 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (x=0; xGetScanLine(x); idp = Image->SubBitmap->GetScanLine(x); sdp = Image->SubBitmap->GetScanLine(x); for (y=0; yGetScanLine(ly); if (wp[lx] && (MainImageForm->Palette->ColorData[*isp]->Protect==0)) { if (*isp > 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(x); Image->SubBitmap->PutScanLine(x); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Protect_Default8(TTexpiaBitmap *Bitmap , TUnionBitmap *BackBitmap) { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *wp; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xPalette->ColorData[*isp]->Protect==0)) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xPalette->ColorData[*isp]->Protect==0)) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (x=0; xGetScanLine(x); idp = Image->SubBitmap->GetScanLine(x); sdp = Image->SubMask->GetScanLine(x); for (y=0; yGetScanLine(ly); if (wp[lx] && (MainImageForm->Palette->ColorData[*isp]->Protect==0)) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(x); Image->SubBitmap->PutScanLine(x); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Mask_Protect_Gauze8(TTexpiaBitmap *Bitmap, TUnionBitmap *BackBitmap) // convert by celberus { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *wp, *mp; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xPalette->ColorData[*isp]->Protect==0) && (*mp == 0)) { if (*isp > 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xPalette->ColorData[*isp]->Protect==0) && (*mp == 0)) { if (*isp > 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (x=0; xGetScanLine(x); mp = Image->Mask->GetScanLine(x); idp = Image->SubBitmap->GetScanLine(x); sdp = Image->SubMask->GetScanLine(x); for (y=0; yGetScanLine(ly); if (wp[lx] && (MainImageForm->Palette->ColorData[*isp]->Protect==0) && (*mp == 0)) { if (*isp > 1) { if ((x+y)&1) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } else { *idp = wp[lx]; *sdp = 0; } } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(x); Image->SubBitmap->PutScanLine(x); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Mask_Protect_Default8(TTexpiaBitmap *Bitmap, TUnionBitmap *BackBitmap) { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *wp, *mp; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xPalette->ColorData[*isp]->Protect==0) && (*mp == 0)) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); for (x=0; xPalette->ColorData[*isp]->Protect==0) && (*mp == 0)) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (x=0; xGetScanLine(x); mp = Image->Mask->GetScanLine(x); idp = Image->SubBitmap->GetScanLine(x); sdp = Image->SubMask->GetScanLine(x); for (y=0; yGetScanLine(ly); if (wp[lx] && (MainImageForm->Palette->ColorData[*isp]->Protect==0) && (*mp == 0)) { *idp = wp[lx]; *sdp = 0; } else { *idp = *isp; *sdp = 0xFF; } } Image->SubMask->PutScanLine(x); Image->SubBitmap->PutScanLine(x); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Gauze24(TTexpiaBitmap *Bitmap, TTexpiaBitmap *Mask, TUnionBitmap *BackBitmap) { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *msp, *mdp, *wp, mm; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; COLORREF c, bgc; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; bgc = MainImageForm->Palette->Color[1]; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Mask->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); wp = Bitmap->GetScanLine(ly); mdp = Mask->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); mm = 0x80; *sdp = 0; x = 0; while(1) { lx = (x-window.s.x)%window.size.x; if (lx<0) lx = window.size.x+lx; if ((mdp[lx >> 3] & (0x80 >> (lx & 7))) == 0) { GetPixel24(isp, c); if (c != bgc) { if ((x+y)&1) { msp = wp + 3*lx; CopyPixel24(idp, msp); } else { CopyPixel24(idp, isp); *sdp |= mm; } } else { msp = wp + 3*lx; CopyPixel24(idp, msp); } } else { CopyPixel24(idp, isp); *sdp |= mm; } x++; if (x >= ww) break; isp += 3; idp += 3; if (mm == 1) { sdp++; *sdp = 0; mm = 0x80; } else mm >>= 1; } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); wp = Bitmap->GetScanLine(ly); mdp = Mask->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); mm = 0x80; *sdp = 0; x = 0; while (1) { lx = (x-xx)%window.size.x; if (lx<0) lx = window.size.x+lx; if ((mdp[lx >> 3] & (0x80 >> (lx & 7))) == 0) { GetPixel24(isp, c); if (c != bgc) { if ((x+y)&1) { msp = wp + 3*lx; CopyPixel24(idp, msp); } else { CopyPixel24(idp, isp); *sdp |= mm; } } else { msp = wp + 3*lx; CopyPixel24(idp, msp); } } else { CopyPixel24(idp, isp); *sdp |= mm; } x++; if (x >= ww) break; isp += 3; idp += 3; if (mm == 1) { sdp++; *sdp = 0; mm = 0x80; } else mm >>= 1; } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (y=0; yGetScanLine(y); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); mm = 0x80; *sdp = 0; x = 0; while(1) { lx = (x-window.s.x)%window.size.x; cx = (x-window.s.x)/window.size.x; if ((xGetScanLine(ly); mdp = Mask->GetScanLine(ly); if ((mdp[lx >> 3] & (0x80 >> (lx & 7))) == 0) { GetPixel24(isp, c); if (c != bgc) { if ((x+y)&1) { msp = wp + 3*lx; CopyPixel24(idp, msp); } else { CopyPixel24(idp, isp); *sdp |= mm; } } else { msp = wp + 3*lx; CopyPixel24(idp, msp); } } else { CopyPixel24(idp, isp); *sdp |= mm; } x++; if (x >= ww) break; isp += 3; idp += 3; if (mm == 1) { sdp++; *sdp = 0; mm = 0x80; } else mm >>= 1; } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Mask->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Mask_Gauze24(TTexpiaBitmap *Bitmap, TTexpiaBitmap *Mask, TUnionBitmap *BackBitmap) { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *msp, *mdp, *wp, *mp, mm; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; COLORREF c, bgc; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; bgc = MainImageForm->Palette->Color[1]; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Mask->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); mdp = Mask->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); mm = 0x80; *sdp = 0; x = 0; while (1) { lx = (x-window.s.x)%window.size.x; if (lx<0) lx = window.size.x+lx; if ((mdp[lx >> 3] & (0x80 >> (lx & 7))) == 0 && (mp[x >> 3] & (0x80 >> (x & 7))) == 0) { GetPixel24(isp, c); if (c != bgc) { if ((x+y)&1) { msp = wp + 3*lx; CopyPixel24(idp, msp); } else { CopyPixel24(idp, isp); *sdp |= mm; } } else { msp = wp + 3*lx; CopyPixel24(idp, msp); } } else { CopyPixel24(idp, isp); *sdp |= mm; } x++; if (x >= ww) break; isp += 3; idp += 3; if (mm == 1) { sdp++; *sdp = 0; mm = 0x80; } else mm >>= 1; } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); mdp = Mask->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); mm = 0x80; *sdp = 0; x = 0; while (1) { lx = (x-xx)%window.size.x; if (lx<0) lx = window.size.x+lx; if ((mdp[lx >> 3] & (0x80 >> (lx & 7))) == 0 && ((mp[x >> 3] & (0x80 >> (x & 7))) == 0)) { GetPixel24(isp, c); if (c != bgc) { if ((x+y)&1) { msp = wp + 3*lx; CopyPixel24(idp, msp); } else { CopyPixel24(idp, isp); *sdp |= mm; } } else { msp = wp + 3*lx; CopyPixel24(idp, msp); } } else { CopyPixel24(idp, isp); *sdp |= mm; } x++; if (x >= ww) break; isp += 3; idp += 3; if (mm == 1) { sdp++; *sdp = 0; mm = 0x80;} else mm >>= 1; } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); mm = 0x80; *sdp = 0; x = 0; while (1) { lx = (x-window.s.x)%window.size.x; cx = (x-window.s.x)/window.size.x; if ((xGetScanLine(ly) + 3*lx; mdp = Mask->GetScanLine(ly); if ((mdp[lx >> 3] & (0x80 >> (lx & 7))) == 0 && (mp[x >> 3] & (0x80 >> (x & 7))) == 0) { GetPixel24(isp, c); if (c != bgc) { if ((x+y) & 1) { CopyPixel24(idp, wp); } else { CopyPixel24(idp, isp); *sdp |= mm; } } else { CopyPixel24(idp, wp); } } else { CopyPixel24(idp, isp); *sdp |= mm; } x++; if (x >= ww) break; isp += 3; idp += 3; if (mm == 1) { sdp++; *sdp = 0; mm = 0x80; } else mm >>= 1; } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Mask->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::MakeRepeat_Mask_Default24(TTexpiaBitmap *Bitmap, TTexpiaBitmap *Mask, TUnionBitmap *BackBitmap) { BEGIN_LOG(""); Byte *isp, *idp, *sdp, *msp, *mdp, *wp, *mp, mm; int cx, cy, lx, ly, xx, yy, ww, hh, x, y, Gap; COLORREF c; ww = Image->uBitmap->Width; hh = Image->uBitmap->Height; if (!Bitmap->StartScanLine()) { END_LOG; return false; } if (!Mask->StartScanLine()) { END_LOG; return false; } if (!Image->SubBitmap->StartScanLine()) { END_LOG; return false; } if (!Image->SubMask->StartScanLine()) { END_LOG; return false; } if (Item==TREPEAT_NORMAL) { for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); mdp = Mask->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); mm = 0x80; *sdp = 0; x = 0; while (1) { lx = (x-window.s.x)%window.size.x; if (lx<0) lx = window.size.x+lx; if ((mdp[lx >> 3] & (0x80 >> (lx & 7))) == 0 && (mp[x >> 3] & (0x80 >> (x & 7))) == 0) { msp = wp + 3*lx; CopyPixel24(idp, msp); } else { CopyPixel24(idp, isp); *sdp |= mm; } x++; if (x >= ww) break; isp += 3; idp += 3; if (mm == 1) { sdp++; *sdp = 0; mm = 0x80;} else mm >>= 1; } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDHOR) { Gap = spEditW->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); wp = Bitmap->GetScanLine(ly); mdp = Mask->GetScanLine(ly); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); mm = 0x80; *sdp = 0; x = 0; while (1) { lx = (x-xx)%window.size.x; if (lx<0) lx = window.size.x+lx; if ((mdp[lx >> 3] & (0x80 >> (lx & 7))) == 0 && (mp[x >> 3] & (0x80 >> (x & 7))) == 0) { msp = wp + 3*lx; CopyPixel24(idp, msp); } else { CopyPixel24(idp, isp); *sdp |= mm; } x++; if (x >= ww) break; isp += 3; idp += 3; if (mm == 1) { sdp++; *sdp = 0; mm = 0x80;} else mm >>= 1; } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } else if (Item==TREPEAT_HDVER) { Gap = spEditH->Value; for (y=0; yGetScanLine(y); mp = Image->Mask->GetScanLine(y); idp = Image->SubBitmap->GetScanLine(y); sdp = Image->SubMask->GetScanLine(y); mm = 0x80; *sdp = 0; x = 0; while (1) { lx = (x-window.s.x)%window.size.x; cx = (x-window.s.x)/window.size.x; if ((xGetScanLine(ly); mdp = Mask->GetScanLine(ly); if ((mdp[lx >> 3] & (0x80 >> (lx & 7))) == 0 && (mp[x >> 3] & (0x80 >> (x & 7))) == 0) { msp = wp + 3*lx; CopyPixel24(idp, msp); } else { CopyPixel24(idp, isp); *sdp |= mm; } x++; if (x >= ww) break; isp += 3; idp += 3; if (mm == 1) { sdp++; *sdp = 0; mm = 0x80;} else mm >>= 1; } Image->SubMask->PutScanLine(y); Image->SubBitmap->PutScanLine(y); } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); Mask->StopScanLine(); Bitmap->StopScanLine(); END_LOG; return true; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::SetRepeatImage() { BEGIN_LOG(""); TCursor OldCursor; TTexpiaBitmap *Bitmap = NULL, *Mask = NULL; TUnionBitmap *BackBitmap; // convert by celberus TPException ec = EC_NONE; OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; if (!ReadyToMakeRepeatImage()) { MessageDlg(IDS_MESSAGE_NOTENOUGHSPACE, mtError, TMsgDlgButtons() << mbOK, 0); PostMessage(hWnd, TPM_EXITFUNCTION, 0, 0); } else { if (Image->uBitmap->BitsPerPixel==8) { if ((Bitmap = new TTexpiaBitmap) == NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (!Bitmap->Create(window.size.x, window.size.y, 8, rgb)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} switch (Image->IsBackGround()) { case 0: BackBitmap = Image->uBitmap; MakeUnitBitmap_none(Bitmap); break; case 1: BackBitmap = Image->uBitmap;/*Image->BackGround;*/ MakeUnitBitmap_layer(Bitmap);break; // case 1: BackBitmap = Image->uBitmap; MakeUnitBitmap_none(Bitmap); break; // convert by celberus default: goto fail; } BackBitmap->StartScanLine(); if (MainImageForm->MaskArea) { Image->Mask->StartScanLine(); if (MainImageForm->Protect) { if (FullViewForm->Super == sGauze) { if (!MakeRepeat_Mask_Protect_Gauze8(Bitmap, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } else { if (!MakeRepeat_Mask_Protect_Default8(Bitmap, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } } else { if (FullViewForm->Super == sGauze) { if (!MakeRepeat_Mask_Gauze8(Bitmap, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } else { if (!MakeRepeat_Mask_Default8(Bitmap, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } } Image->Mask->StopScanLine(); } else { if (MainImageForm->Protect) { /* 8bit No Mask Yes Protect */ if (FullViewForm->Super == sGauze) { if (!MakeRepeat_Protect_Gauze8(Bitmap, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } else { if (!MakeRepeat_Protect_Default8(Bitmap, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } } else { if (FullViewForm->Super == sGauze) { if (!MakeRepeat_Gauze8(Bitmap, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } else { if ((Mask = new TTexpiaBitmap) == NULL) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} if (!Mask->Create(window.size.x, window.size.y, 8, rgb)) {ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail;} MakeRepeat_Default8(Bitmap, Mask); if (!MakeRepeat_Copy(Bitmap, Mask)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } delete Mask; Mask = NULL; } } } BackBitmap->StopScanLine(); delete Bitmap; Bitmap = NULL; } else { if ((Bitmap = new TTexpiaBitmap) == NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Bitmap->Create(window.size.x, window.size.y, 24)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if ((Mask = new TTexpiaBitmap) == NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!Mask->Create(window.size.x, window.size.y, 1)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } switch (Image->IsBackGround()) { case 0: BackBitmap = Image->uBitmap; MakeUnitBitmap_none(Bitmap, Mask); break; case 1: BackBitmap = Image->BackGround; MakeUnitBitmap_layer(Bitmap, Mask); break; // case 1: BackBitmap = Image->uBitmap; MakeUnitBitmap_none(Bitmap, Mask); break; // convert by celberus default: goto fail; } BackBitmap->StartScanLine(); if (MainImageForm->MaskArea) { Image->Mask->StartScanLine(); if (FullViewForm->Super==sGauze) { if (!MakeRepeat_Mask_Gauze24(Bitmap, Mask, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } else { if (!MakeRepeat_Mask_Default24(Bitmap, Mask, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } Image->Mask->StopScanLine(); } else { if (FullViewForm->Super==sGauze) { if (!MakeRepeat_Gauze24(Bitmap, Mask, BackBitmap)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } else { if (!MakeRepeat_Copy(Bitmap, Mask)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } } BackBitmap->StopScanLine(); delete Bitmap; Bitmap = NULL; delete Mask; Mask = NULL; } } Screen->Cursor = OldCursor; END_LOG; return; fail: if (Bitmap) delete Bitmap; if (Mask) delete Mask; Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(ec); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::RepeatMouseDown(int X, int Y) { BEGIN_LOG(""); TCursor OldCursor; if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { END_LOG; return; } if ((Item == TREPEAT_NORMAL) || (Item == TREPEAT_HDHOR) || (Item == TREPEAT_HDVER)) { OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; if (SubMouseDown(X, Y)) { PostMessage(hWnd, TPM_EXITFUNCTION, 0, 0); } else { PostMessage(hWnd, TPM_EXITFUNCTION, 0, 0); // Undo->Read(); //BeConverted by linuxjun Don't Forget!! Undo_Method // MainImageForm->Undo->UndoRead(); //BeConverted by linuxjun Don't Forget!! Undo_Method UndoReadÇÒ°æ¿ì ÀÛ¾÷±¸¿ªÀÌ ¾ø¾îÁü } // ::RepaintColor(); Screen->Cursor = OldCursor; } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::RepeatMouseMove(int X, int Y) { RECT r; if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) return; SubMouseMove(X, Y); if (paintrect.left < Image->SubRange.left) r.left = paintrect.left; else r.left = Image->SubRange.left; if (paintrect.right > Image->SubRange.right) r.right = paintrect.right; else r.right = Image->SubRange.right; if (paintrect.top < Image->SubRange.top) r.top = paintrect.top; else r.top = Image->SubRange.top; if (paintrect.bottom > Image->SubRange.bottom) r.bottom = paintrect.bottom; else r.bottom = Image->SubRange.bottom; Image->RectPaint(r); } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::iMainImageChange(void) { // Image->SubVisible = false; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::spEditX_Change(TObject *Sender) { if (spEditX->Text.Length() > 0) { if (spEditX->Value > spEditX->Max) spEditX->Value = spEditX->Max; else if (spEditX->Value < spEditX->Min) spEditX->Value = spEditX->Min; } } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::spEditY_Change(TObject *Sender) { if (spEditY->Text.Length() > 0) { if (spEditY->Value > spEditY->Max) spEditY->Value = spEditY->Max; else if (spEditY->Value < spEditY->Min) spEditY->Value = spEditY->Min; } } //--------------------------------------------------------------------------- //============================================================================= // For Auto Repeat Functions //============================================================================= //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::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; } else { InitMan_RepForm(); } Screen->Cursor = OldCursor; // for PFM by celberus END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::sbAMethodClick(TObject *Sender) { // BEGIN_LOG(""); // // AutoPanel->SetFocus(); // TSpeedButton *sp = (TSpeedButton *)Sender; // // if (sp->Tag == 1) { // MainImageForm->ARTItem = AREPEAT_NORMAL; // sbANormal->Down = true; // LabelMax1->Enabled = false; // ComboBoxWH1->Enabled = false; // }else if (sp->Tag == 2) { // ARMaxSize = MainImageForm->arwindow.size.y - 1; // sbAVer->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; // sbAHor->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 TManualRepeatForm::sbARExitClick(TObject *Sender) { BEGIN_LOG(""); 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 TManualRepeatForm::InitMan_RepForm() { BEGIN_LOG(""); int w, h; TPException ec = EC_NONE; //ClientHeight = 232; /// °¢ Formµé µ¶¸³ÀûÀ¸·Î °ü¸®Çϱâ À§ÇØ ÁÖ¼®Ã³¸® //Parent->Height = ParentHeight+ClientHeight; //Parent->Repaint(); // parent ÀÇ height¸¦ ¹Ù²Û ÈÄ¿¡´Â parent¸¦ ¸®ÆäÀÎÆ® ÇØÁØ´Ù. by celberus ManualPanel->Visible = true; ManualPanel->BringToFront(); //selectsize = false; RzCbIsSize->Checked = false; LabelSize->Caption = IDS_FALSE; spEditX->Enabled = false; spEditY->Enabled = false; LabelCross->Enabled = false; WInd = HInd = 0; spEditW->Max = window.size.x - 1; spEditH->Max = window.size.y - 1; Wdiv = window.size.x / 2; Hdiv = window.size.y / 2; ReadIniFile(w, h); Image->InitBackGround(0x08); Image->SubVisible = true; Image->SubEnabled = true; Image->SubMethod = true; if (bChange == false) { switch (m_type) { case 1: rzbtMatchNormal->Down = true; rzbtMatchNormal->Click(); break; case 2: Hdiv = h; rzbtMatchVer->Down = true; rzbtMatchVer->Click(); break; case 3: Wdiv = w; rzbtMatchHor->Down = true; rzbtMatchHor->Click(); break; default: rzbtNormal->Down = true; rzbtNormal->Click(); } } else { rzbtNormal->Down = true; rzbtNormal->Click(); } bChange = true; spEditW->Value = Wdiv; spEditH->Value = Hdiv; END_LOG; return; fail: EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::InitAuto_RepForm() { // BEGIN_LOG(""); // // ClientHeight = 180; // /// °¢ Formµé µ¶¸³ÀûÀ¸·Î °ü¸®Çϱâ À§ÇØ ÁÖ¼®Ã³¸® // //Parent->Height = ParentHeight+ClientHeight; // // AutoPanel->Visible = true; // AutoPanel->BringToFront(); // /// °¢ Formµé µ¶¸³ÀûÀ¸·Î °ü¸®Çϱâ À§ÇØ ÁÖ¼®Ã³¸® // Parent->Repaint(); // for PFM by celberus // // if (MainImageForm->AutoRepeat == false) { //// MainImageForm->ARTItem = AREPEAT_NORMAL; //by maxleo21c (06.10.13) : ±âÁ¸ Çß´ø °ÍÀ» ±â¾ïÇϱâ À§Çؼ­ ±×³É ÁÖ¼® ó¸®ÇÔ //// sbANormal->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 { // spEditW->Max = MainImageForm->arwindow.size.x - 1; // spEditH->Max = MainImageForm->arwindow.size.y - 1; //// spEditW->MaxValue = MainImageForm->DrawARepeatArea->right - MainImageForm->DrawARepeatArea->left - 1; //// spEditH->MaxValue = MainImageForm->DrawARepeatArea->bottom - MainImageForm->DrawARepeatArea->top - 1; // Hdiv = MainImageForm->MHdiv; // Wdiv = MainImageForm->MWdiv; // // if (MainImageForm->ARTItem == AREPEAT_NORMAL) // sbANormal->Down = true; // else if (MainImageForm->ARTItem == AREPEAT_HDVER){ // ARMaxSize = MainImageForm->arwindow.size.y - 1; // sbAVer->Down = true; // ComboBoxWH1->Text = Hdiv; // LabelMax1->Caption = Format(IDS_COMMON_MAX + " : %d", OPENARRAY(TVarRec, (ARMaxSize))); // }else { // ARMaxSize = MainImageForm->arwindow.size.x - 1; // sbAHor->Down = true; // ComboBoxWH1->Text = Wdiv; // LabelMax1->Caption = Format(IDS_COMMON_MAX + " : %d", OPENARRAY(TVarRec, (ARMaxSize))); // } // ComboBoxWH1->Enabled = true; // LabelMax1->Enabled = true; // } // sbManRep->Enabled = false; // Image->SubVisible = false; // Image->SubEnabled = false; // Image->SubMethod = false; // Image->ExitBackGround(0x08); // MainImageForm->sbAutoRepView->Enabled = true; // MainImageForm->AutoRepUpdateMenu(false); // // END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::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 TManualRepeatForm::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 TManualRepeatForm::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 TManualRepeatForm::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 TManualRepeatForm::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 (!sbANormal->Down) sbANormal->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 (!sbAVer->Down) sbAVer->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 (!sbAHor->Down) sbAHor->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 TManualRepeatForm::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 TManualRepeatForm::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 TManualRepeatForm::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 TManualRepeatForm::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 TManualRepeatForm::ComboBoxWH1Change(TObject *Sender) { // BEGIN_LOG(""); // // bool RepeatSW = false; // if (sbAHor->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 (sbAVer->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 (sbAVer->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 (sbAHor->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 TManualRepeatForm::ComboBoxWH1DblClick(TObject *Sender) { // ComboBoxWH1->SetFocus(); // ComboBoxWH1->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::ComboBoxWH1KeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { /* if (Key == VK_RETURN) { if (InvalidInput1() == false) return; if (ComboBoxWH1->Text == ""){ ComboBoxWH1->Text = 1; } int value = StrToInt(ComboBoxWH1->Text); if (sbAVer->Down) { if (value > spEditH->MaxValue) { value = spEditH->MaxValue; ComboBoxWH1->Text = value; }else if (value < 0) { value = 1; ComboBoxWH1->Text = value; } Hdiv = value; spEditH->Value = value; SpreadArea(); } if (sbAHor->Down) { if (value > spEditW->MaxValue) { value = spEditW->MaxValue; ComboBoxWH1->Text = value; }else if (value < 0) { value = 1; ComboBoxWH1->Text = value; } Wdiv = value; spEditW->Value = value; SpreadArea(); } } MainImageForm->iMainImage->Repaint(); */ } //--------------------------------------------------------------------------- bool __fastcall TManualRepeatForm::InvalidInput1() { // String str = ComboBoxWH1->Text; // for (int i = 0; i < ComboBoxWH1->Items->Count; i++) { // if (str == ComboBoxWH1->Items->Strings[i]) return false; // } // return true; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::ClearLayer() { BEGIN_LOG(""); TCursor cursor; TPoint Size; TUnionBitmap *bp; // convert by celberus int x, y; Byte *pp, *lp; COLORREF c; TPException ec = EC_NONE; cursor = Screen->Cursor; Screen->Cursor = crHourGlass; Size.x = Image->uBitmap->Width; Size.y = Image->uBitmap->Height; bp = MainImageForm->iMainImage->uBitmap; if (!bp->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!MainImageForm->iMainImage->LayerMask->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } c = PaletteForm->DIB256Palette->GetBGCOLORREF(8); for (y=0; yGetScanLine(y); lp = MainImageForm->iMainImage->LayerMask->GetScanLine(y); for (x=0; xPutScanLine(y); MainImageForm->iMainImage->LayerMask->PutScanLine(y); } MainImageForm->iMainImage->LayerMask->StopScanLine(); bp->StopScanLine(); Screen->Cursor = cursor; END_LOG; return; fail: bp->StopScanLine(); Screen->Cursor = cursor; EXCEPTION_MESSAGE_OK(ec); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::makePatternView() { if (Image->uBitmap->BitsPerPixel==8) { Image1->Picture->Bitmap->PixelFormat = pf8bit; Image1->Picture->Bitmap->Width = window.size.x; Image1->Picture->Bitmap->Height = window.size.y; SetDIBColorTable(Image1->Picture->Bitmap->Canvas->Handle, 0, 256, rgb); } else { Image1->Picture->Bitmap->PixelFormat = pf24bit; Image1->Picture->Bitmap->Width = window.size.x; Image1->Picture->Bitmap->Height = window.size.y; } Image->uBitmap->UnionBitBlt(Image1->Picture->Bitmap->Canvas->Handle, 0, 0, window.size.x, window.size.y, window.s.x, window.s.y, SRCCOPY, false); } //--------------------------------------------------------------------------- // added by maxleo21c (05.04.08) void __fastcall TManualRepeatForm::iMainImageKeyDown(WORD Key, TShiftState Shift) { BEGIN_LOG(String(Key)); // edit by monkman (2005.08.04) switch (Key) { case '1': if (!rzbtNormal->Down) { FunctionClick(rzbtNormal); rzbtNormal->Down = true; } break; case '2': if (!rzbtHDVer->Down) { FunctionClick(rzbtHDVer); rzbtHDVer->Down = true; } break; case '3': if (!rzbtHDHor->Down) { FunctionClick(rzbtHDHor); rzbtHDHor->Down = true; } break; case '4': if (!rzbtMatchNormal->Down) { FunctionMatchClick(rzbtMatchNormal); rzbtMatchNormal->Down = true; } break; case '5': if (!rzbtMatchVer->Down) { FunctionMatchClick(rzbtMatchVer); rzbtMatchVer->Down = true; } break; case '6': if (!rzbtMatchHor->Down) { FunctionMatchClick(rzbtMatchHor); rzbtMatchHor->Down = true; } break; case VK_RETURN: int value; if (InvalidInput() == false) { END_LOG; return; } if (rzbtHDVer->Down) { if (TryStrToInt(ComboBoxWH->Text, value)){ if (value > spEditH->Max) { value = spEditH->Max; ComboBoxWH->Text = value; } Hdiv = value; spEditH->Value = value; } } if (rzbtHDHor->Down) { if (TryStrToInt(ComboBoxWH->Text, value)){ if (value > spEditW->Max) { value = spEditW->Max; ComboBoxWH->Text = value; } Wdiv = value; spEditW->Value = value; } } SetRepeatImage(); MainImageForm->iMainImage->Repaint(); break; } END_LOG; } //--------------------------------------------------------------------------- // added by maxleo21c (05.04.08) bool __fastcall TManualRepeatForm::OperationShortcutsOnKeyDown(int ShortcutData) { BEGIN_LOG(IntToStr(ShortcutData)); if (ShortcutData == StrToInt(IDS_SHORTCUT_REPEATMNOMAL)) { if (!rzbtNormal->Down) { rzbtNormal->Down = true; FunctionClick(rzbtNormal); } } else if (ShortcutData == StrToInt(IDS_SHORTCUT_REPEATMHDV)) { if (!rzbtHDVer->Down) { rzbtHDVer->Down = true; FunctionClick(rzbtHDVer); } } else if (ShortcutData == StrToInt(IDS_SHORTCUT_REPEATMHDH)) { if (!rzbtHDHor->Down) { rzbtHDHor->Down = true; FunctionClick(rzbtHDHor); } } else if (ShortcutData == StrToInt(IDS_SHORTCUT_REPEATMMNOMAL)) { if (!rzbtMatchNormal->Down) { rzbtMatchNormal->Down = true; FunctionMatchClick(rzbtMatchNormal); } } else if (ShortcutData == StrToInt(IDS_SHORTCUT_REPEATMMV)) { if (!rzbtMatchVer->Down) { rzbtMatchVer->Down = true; FunctionMatchClick(rzbtMatchVer); } } else if (ShortcutData == StrToInt(IDS_SHORTCUT_REPEATMMH)) { if (!rzbtMatchHor->Down) { rzbtMatchHor->Down = true; FunctionMatchClick(rzbtMatchHor); } } else { END_LOG; return false; } END_LOG; return true; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::Nomal1Click(TObject *Sender) { BEGIN_LOG(""); TSpeedButton *sp = (TSpeedButton *)Sender; switch(sp->Tag) { case 1: FunctionClick(ManualRepeatForm->rzbtNormal); rzbtNormal->Down = true; break; case 2: FunctionClick(ManualRepeatForm->rzbtHDVer); rzbtHDVer->Down = true; break; case 3: FunctionClick(ManualRepeatForm->rzbtHDHor); rzbtHDHor->Down = true; break; case 4: FunctionMatchClick(ManualRepeatForm->rzbtMatchNormal); rzbtMatchNormal->Down = true; break; case 5: FunctionMatchClick(ManualRepeatForm->rzbtMatchVer); rzbtMatchVer->Down = true; break; case 6: FunctionMatchClick(ManualRepeatForm->rzbtMatchHor); rzbtMatchHor->Down = true; break; } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::MakeMenuHintByShortcut() { BEGIN_LOG(""); rzbtNormal->Hint = TexActionManager->GetHint("ManualRepeat", "Normal"); rzbtHDVer->Hint = TexActionManager->GetHint("ManualRepeat", "VertDiv"); rzbtHDHor->Hint = TexActionManager->GetHint("ManualRepeat", "HorzDiv"); rzbtMatchNormal->Hint = TexActionManager->GetHint("ManualRepeat", "NormalFitIn"); rzbtMatchVer->Hint = TexActionManager->GetHint("ManualRepeat", "VertFitIn"); rzbtMatchHor->Hint = TexActionManager->GetHint("ManualRepeat", "HorzFitIn"); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::ExecuteHotKey(String command) { BEGIN_LOG(command); if (command == "Normal") { if (rzbtNormal->Down == false) { rzbtNormal->Down = true; FunctionClick(rzbtNormal); } } else if (command == "VertDiv") { if (rzbtHDVer->Down == false) { rzbtHDVer->Down = true; FunctionClick(rzbtHDVer); } } else if (command == "HorzDiv") { if (rzbtHDHor->Down == false) { rzbtHDHor->Down = true; FunctionClick(rzbtHDHor); } } else if (command == "NormalFitIn") { if (rzbtMatchNormal->Down == false) { rzbtMatchNormal->Down = true; FunctionMatchClick(rzbtMatchNormal); } } else if (command == "VertFitIn") { if (rzbtMatchVer->Down == false) { rzbtMatchVer->Down = true; FunctionMatchClick(rzbtMatchVer); } } else if (command == "HorzFitIn") { if (rzbtMatchHor->Down == false) { rzbtMatchHor->Down = true; FunctionMatchClick(rzbtMatchHor); } } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::FormClose(TObject *Sender, TCloseAction &Action) { BEGIN_LOG(""); PostMessage(hWnd, TPM_EXITFUNCTION, 0, 0); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TManualRepeatForm::RzCbIsSizeClick(TObject *Sender) { selectsize = RzCbIsSize->Checked; if (selectsize) { //LabelSize->Caption = IDS_TRUE; spEditX->Enabled = true; spEditY->Enabled = true; LabelCross->Enabled = true; } else { //LabelSize->Caption = IDS_FALSE; spEditX->Enabled = false; spEditY->Enabled = false; LabelCross->Enabled = false; } } //---------------------------------------------------------------------------