//--------------------------------------------------------------------------- #include #include #pragma hdrstop #include "Fill_F.h" #include "FullView.h" #include "MainImage.h" #include "Palette.h" #include "Rotation.h" #include "PenManager.h" #include "StatusProgress.h" #if !(defined(ACADEMY) || defined(KNIT)) #include "CaptureEdit.h" #endif //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "Selector" #pragma link "TPSpin" #pragma resource "*.dfm" //--------------------------------------------------------------------------- #define IDS_FROMSINGLE StringTable[0] #define IDS_TOSINGLE StringTable[1] #define IDS_FROMMULTI StringTable[2] #define IDS_TONORMALPAT StringTable[3] #define IDS_TOMULTI StringTable[4] #define IDS_TOROTATEPAT StringTable[5] #define IDS_AIR StringTable[6] #define IDS_DENSITY StringTable[7] #define IDS_NOZZLE StringTable[8] #define IDS_DEGREE StringTable[9] #define IDS_BEFOREDEGREE StringTable[10] #define IDS_EXPANSION StringTable[11] #define IDS_INAUTOREP StringTable[12] //======================================== by hjs 00.09.14 #define IDS_BEFORESHAPE StringTable[13] //======================================== #define R 0 #define G 1 #define B 2 //--------------------------------------------------------------------------- TFillForm *FillForm; static COLORREF clFillData; static Byte clLayerData; //--------------------------------------------------------------------------- __fastcall TFillForm::TFillForm(TComponent* Owner) : TForm(Owner) { //=========================================== StringTable.Create(DirectoryCommon, Language, "Fill"); SetSmallFont(Font); SetSmallFont(lDensity->Font); SetSmallFont(lNozzle->Font); SetSmallFont(Label1->Font); sbFSingle->Caption = IDS_FROMSINGLE; sbTSingle->Caption = IDS_TOSINGLE; sbFMulti->Caption = IDS_FROMMULTI; sbTNPattern->Caption = IDS_TONORMALPAT; sbTMulti->Caption = IDS_TOMULTI; sbTRPattern->Caption = IDS_TOROTATEPAT; rgAir->Caption = IDS_AIR; rgAir->Items->Strings[0] = IDS_COMMON_BUTTONNO; rgAir->Items->Strings[1] = IDS_COMMON_BUTTONYES; lDensity->Caption = IDS_DENSITY; lNozzle->Caption = IDS_NOZZLE; Label1->Caption = IDS_DEGREE; sbBeforeDeg->Hint = IDS_BEFOREDEGREE; // ³ªÁß¿¡ ¿µ¾î Çѱ¹¾î¸¦ Á¦¿ÜÇÑ ´Ù¸¥¾ð¾î tdw ÆÄÀÏÀ» ¹Ýµå½Ã ¼öÁ¤ÇØ¾ß ÇÔ... //======================================== by hjs 00.09.14 sbBeforeShape->Caption = IDS_BEFORESHAPE; //========================================= sbNew->Hint = IDS_COMMON_NEW; sbAll->Hint = IDS_COMMON_ALL; sbBlock->Hint = IDS_COMMON_BLOCKCOLOR; sbDelete->Hint = IDS_COMMON_INSERTCOLOR; sbBefore->Hint = IDS_COMMON_BEFORECOLOR; lbType->Caption = IDS_COMMON_REPEAT; cbExp->Caption = IDS_EXPANSION; cbAutoRep->Caption = IDS_INAUTOREP; cbRepeatType->Items->Clear(); cbRepeatType->Items->Add(IDS_COMMON_NORMAL); cbRepeatType->Items->Add(IDS_COMMON_HDVER); cbRepeatType->Items->Add(IDS_COMMON_HDHOR); cbRepeatType->Text = IDS_COMMON_NORMAL; //=========================================== } //--------------------------------------------------------------------------- void __fastcall TFillForm::FormCreate(TObject *Sender) { // BeforeTheta = 0; rgAir->ItemIndex = 0; COLOROVERFLOW = false; } //--------------------------------------------------------------------------- void __fastcall TFillForm::FunctionClick(TObject *Sender) { TSpeedButton *s; // HDC vDC = NULL; int ec = EC_NONE; TPItemImage *Image = MainImageForm->iMainImage; if (IsRDraw) Rotate_Rect(); s = (TSpeedButton *)Sender; if (s == sbFSingle) { changefrom = TFF_SINGLE; changeto = TFT_NONE; Image->SubEnabled = false; if (Image->uBitmap->BitsPerPixel==8) { Selector->Initial(); sbTMulti->Enabled = false; } sbTSingle->Down = false; sbTMulti->Down = false; sbTNPattern->Down = false; sbTRPattern->Down = false; TSPanel->Visible = false; PatternPanel->Visible = false; MultiPanel->Visible = false; SSPanel->Visible = true; } else if (s == sbFMulti) { changefrom = TFF_MULTI; Image->SubEnabled = false; if (Image->uBitmap->BitsPerPixel==8) { Selector->Initial(); sbTMulti->Enabled = true; } changeto = TFT_NONE; sbTSingle->Down = false; sbTMulti->Down = false; sbTNPattern->Down = false; sbTRPattern->Down = false; TSPanel->Visible = false; PatternPanel->Visible = false; SSPanel->Visible = false; MultiPanel->Visible = true; } else if (s == sbTSingle) { changeto = TFT_SINGLE; PatternPanel->Visible = false; TSPanel->Visible = true; Image->SubEnabled = false; if (Image->uBitmap->BitsPerPixel==8) { FTarget = PaletteForm->DIB256Palette->ChoiceIndex; TSColor->Brush->Color = MainImageForm->Palette->Color[FTarget]; } else { FTarget = PaletteForm->DIB256Palette->GetFGCOLORREF(24); TSColor->Brush->Color = (TColor) FTarget; } } else if (s == sbTMulti) { changeto = TFT_MULTI; PatternPanel->Visible = false; TSPanel->Visible = true; Image->SubEnabled = false; if (Image->uBitmap->BitsPerPixel==8) { FTarget = PaletteForm->DIB256Palette->ChoiceIndex; TSColor->Brush->Color = MainImageForm->Palette->Color[FTarget]; if (mul_fill_sw == 1) mul_fill_sw = 0; if (mul_fill_sw == 0) { mul_fill_sw = 1; } memset(ctable, 0, sizeof(ctable)); /* if(PaletteForm->DIB256Palette->UseColor + Selector->Count > MAX_COLOR) PaletteForm->DIB256Palette->UseColor -= Selector->Count;*/ for (int l = 0; l < MAX_COLOR; l++) { if (Selector->Number[l] < 255) { UseColorNUM = l - 1; break; } } colorptr = PaletteForm->DIB256Palette->UseColor; if (Selector->Count + colorptr > MAX_COLOR) { if (mul_fill_sw == 1) mul_fill_sw = 0; } } else { FTarget = PaletteForm->DIB256Palette->GetFGCOLORREF(24); TSColor->Brush->Color = (TColor) FTarget; } } else if ((s == sbTNPattern) || (s == sbTRPattern)) { if (s == sbTNPattern) { changeto = TFT_NORMALP; } else if (s == sbTRPattern) { changeto = TFT_ROTATEP; sw = false; } TSPanel->Visible = false; PatternPanel->Visible = true; Image->SubEnabled = true; cbPattern->Items->Clear(); if (Image->uBitmap->BitsPerPixel==8) { cbPattern->Visible = false; //lhskys PatternImage->Height = 80; //256 À϶§ MainImageForm->Palette->ToRGBQUAD(rgb, 256); if (!(viewp->Create(window.size.x, window.size.y, Image->uBitmap->BitsPerPixel, rgb))) { ec = EC_MEMORY_LACK; goto fail; } viewp->CopyFromRect(Image->uBitmap, window.s.x, window.s.y, SRCCOPY); // if ((vDC = viewp->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; goto fail;} // // Image->uBitmap->UnionBitBlt(vDC, 0, 0, viewp->Width, viewp->Height, window.s.x, window.s.y, SRCCOPY, false); // // viewp->DeleteDC(vDC); // convert by celberus PatternImage->Picture->Bitmap->PixelFormat = pf8bit; PatternImage->Picture->Bitmap->Width = PatternImage->Width; PatternImage->Picture->Bitmap->Height = PatternImage->Height; SetDIBColorTable(PatternImage->Picture->Bitmap->Canvas->Handle, 0, 256, rgb); // if ((vDC = viewp->CreateDC()) == NULL) {ec = EC_RESOURCE_LACK; goto fail;} // SetStretchBltMode(vDC, COLORONCOLOR); // StretchBlt(PatternImage->Picture->Bitmap->Canvas->Handle, 0, 0, // PatternImage->Width, PatternImage->Height, vDC, 0, 0, window.size.x, // window.size.y, SRCCOPY); viewp->UnionStretchBlt(PatternImage->Picture->Bitmap->Canvas->Handle, 0, 0, PatternImage->Width, PatternImage->Height, 0, 0, window.size.x, window.size.y, SRCCOPY); // convert by celberus // viewp->DeleteDC(vDC); MakeFillImage(0); } else { cbPattern->Visible = true; //lhskys cbPattern->Enabled = true; //lhskys PatternImage->Height = 57; //full À϶§ #if !(defined(ACADEMY) || defined(KNIT)) for (int i=0; iCount; i++) { cbPattern->Items->Add(Format("Capture %d", OPENARRAY(TVarRec, (i+1)))); } if (CaptureData->Count <= captureindex) captureindex = CaptureData->Count ? CaptureData->Count - 1 : 0; cbPattern->ItemIndex = captureindex; cbPatternChange(cbPattern); #endif } } if(s == sbTNPattern) { //============================= by hjs 00.09.15 //ClientHeight = 298; ClientHeight = 320; //============================= Parent->Height = ParentHeight+ClientHeight; RepeatView(); if (cbExp->Checked) sbBeforeShape->Enabled = true; else sbBeforeShape->Enabled = false; } else { //============================= by hjs 00.09.15 //ClientHeight = 245; ClientHeight = /*320;*/ 266; //lhskys ¹Ýº¹,Æø ºÎºÐ »èÁ¦ ÆÐÅÏÀ¸·Î¸¸»ý¼º //============================= Parent->Height = ParentHeight+ClientHeight; } if (s == sbTRPattern) { spDeg->Enabled = true; Label1->Enabled = true; //======================================== by hjs 00.09.14 if (cbExp->Checked) sbBeforeDeg->Enabled = false; else sbBeforeDeg->Enabled = true; //======================================== if (cbExp->Checked) sbBeforeShape->Enabled = true; else sbBeforeShape->Enabled = false; } else { spDeg->Enabled = false; Label1->Enabled = false; sbBeforeDeg->Enabled = false; //======================================== by hjs 00.09.14 if (cbExp->Checked) sbBeforeShape->Enabled = true; else sbBeforeShape->Enabled = false; // sbBeforeShape->Enabled = false; //======================================== } if ((s == sbTNPattern) || (s == sbTRPattern)) { cbExp->Enabled = true; // sbBeforeShape->Enabled = true; MousePointPlace = 5; DrawMousePoint(MousePointPlace); } else { cbExp->Enabled = false; } Image->SubVisible = false; step = 0; rstep = 0; expStep = 0; IsRDraw = false; PatternImage->Repaint(); MainImageForm->ResetDraw(true); FillForm->SetFocus(); return; fail: if (viewp) viewp->Destroy(); EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TFillForm::FunctionClick2(int s) // ¼­ºê ¸Þ´º¿¡¼­ ÇÔ¼ö Á¢±ÙÀ» À§ÇØ ¶È°°Àº ÇÔ¼ö¸¦ ¸¸µë. { // ³Ê¹« ¹«½ÄÇÑ ¹æ¹ý (sorry.....) by playzzang int ec = EC_NONE; TPItemImage *Image = MainImageForm->iMainImage; if (IsRDraw) Rotate_Rect(); if (s == 1) { changefrom = TFF_SINGLE; changeto = TFT_NONE; Image->SubEnabled = false; if (Image->uBitmap->BitsPerPixel==8) { Selector->Initial(); sbTMulti->Enabled = false; } sbTSingle->Down = false; sbTMulti->Down = false; sbTNPattern->Down = false; sbTRPattern->Down = false; TSPanel->Visible = false; PatternPanel->Visible = false; MultiPanel->Visible = false; SSPanel->Visible = true; } else if (s == 2) { changefrom = TFF_MULTI; Image->SubEnabled = false; if (Image->uBitmap->BitsPerPixel==8) { Selector->Initial(); sbTMulti->Enabled = true; } changeto = TFT_NONE; sbTSingle->Down = false; sbTMulti->Down = false; sbTNPattern->Down = false; sbTRPattern->Down = false; TSPanel->Visible = false; PatternPanel->Visible = false; SSPanel->Visible = false; MultiPanel->Visible = true; } else if (s == 3) { changeto = TFT_SINGLE; PatternPanel->Visible = false; TSPanel->Visible = true; Image->SubEnabled = false; if (Image->uBitmap->BitsPerPixel==8) { FTarget = PaletteForm->DIB256Palette->ChoiceIndex; TSColor->Brush->Color = MainImageForm->Palette->Color[FTarget]; } else { FTarget = PaletteForm->DIB256Palette->GetFGCOLORREF(24); TSColor->Brush->Color = (TColor) FTarget; } } else if (s == 4) { changeto = TFT_MULTI; PatternPanel->Visible = false; TSPanel->Visible = true; Image->SubEnabled = false; if (Image->uBitmap->BitsPerPixel==8) { FTarget = PaletteForm->DIB256Palette->ChoiceIndex; TSColor->Brush->Color = MainImageForm->Palette->Color[FTarget]; if (mul_fill_sw == 1) mul_fill_sw = 0; if (mul_fill_sw == 0) { mul_fill_sw = 1; } memset(ctable, 0, sizeof(ctable)); /* if(PaletteForm->DIB256Palette->UseColor + Selector->Count > MAX_COLOR) PaletteForm->DIB256Palette->UseColor -= Selector->Count;*/ for (int l = 0; l < MAX_COLOR; l++) { if (Selector->Number[l] < 255) { UseColorNUM = l - 1; break; } } colorptr = PaletteForm->DIB256Palette->UseColor; if (Selector->Count + colorptr > MAX_COLOR) { if (mul_fill_sw == 1) mul_fill_sw = 0; } } else { FTarget = PaletteForm->DIB256Palette->GetFGCOLORREF(24); TSColor->Brush->Color = (TColor) FTarget; } } else if ((s == 5) || (s == 6)) { if (s == 5) { changeto = TFT_NORMALP; } else if (s == 6) { changeto = TFT_ROTATEP; sw = false; } TSPanel->Visible = false; PatternPanel->Visible = true; Image->SubEnabled = true; cbPattern->Items->Clear(); if (Image->uBitmap->BitsPerPixel==8) { cbPattern->Visible = false; //lhskys PatternImage->Height = 80; //256 À϶§ MainImageForm->Palette->ToRGBQUAD(rgb, 256); if (!(viewp->Create(window.size.x, window.size.y, Image->uBitmap->BitsPerPixel, rgb))) { ec = EC_MEMORY_LACK; goto fail; } viewp->CopyFromRect(Image->uBitmap, window.s.x, window.s.y, SRCCOPY); PatternImage->Picture->Bitmap->PixelFormat = pf8bit; PatternImage->Picture->Bitmap->Width = PatternImage->Width; PatternImage->Picture->Bitmap->Height = PatternImage->Height; SetDIBColorTable(PatternImage->Picture->Bitmap->Canvas->Handle, 0, 256, rgb); viewp->UnionStretchBlt(PatternImage->Picture->Bitmap->Canvas->Handle, 0, 0, PatternImage->Width, PatternImage->Height, 0, 0, window.size.x, window.size.y, SRCCOPY); // convert by celberus MakeFillImage(0); } else { cbPattern->Visible = true; //lhskys cbPattern->Enabled = true; //lhskys PatternImage->Height = 57; //full À϶§ #if !(defined(ACADEMY) || defined(KNIT)) for (int i=0; iCount; i++) { cbPattern->Items->Add(Format("Capture %d", OPENARRAY(TVarRec, (i+1)))); } if (CaptureData->Count <= captureindex) captureindex = CaptureData->Count ? CaptureData->Count - 1 : 0; cbPattern->ItemIndex = captureindex; cbPatternChange(cbPattern); #endif } } if(s == 5) { //============================= by hjs 00.09.15 //ClientHeight = 298; ClientHeight = 320; //============================= Parent->Height = ParentHeight+ClientHeight; RepeatView(); if (cbExp->Checked) sbBeforeShape->Enabled = true; else sbBeforeShape->Enabled = false; } else { //============================= by hjs 00.09.15 //ClientHeight = 245; ClientHeight = /*320;*/ 266; //lhskys ¹Ýº¹,Æø ºÎºÐ »èÁ¦ ÆÐÅÏÀ¸·Î¸¸»ý¼º //============================= Parent->Height = ParentHeight+ClientHeight; } if (s == 6) { spDeg->Enabled = true; Label1->Enabled = true; //======================================== by hjs 00.09.14 if (cbExp->Checked) sbBeforeDeg->Enabled = false; else sbBeforeDeg->Enabled = true; // sbBeforeDeg->Enabled = true; //======================================== // sbBeforeShape->Enabled = true; if (cbExp->Checked) sbBeforeShape->Enabled = true; else sbBeforeShape->Enabled = false; } else { spDeg->Enabled = false; Label1->Enabled = false; sbBeforeDeg->Enabled = false; //======================================== by hjs 00.09.14 if (cbExp->Checked) sbBeforeShape->Enabled = true; else sbBeforeShape->Enabled = false; // sbBeforeShape->Enabled = false; //======================================== } if ((s == 5) || (s == 6)) { cbExp->Enabled = true; MousePointPlace = 5; DrawMousePoint(MousePointPlace); } else { cbExp->Enabled = false; } Image->SubVisible = false; step = 0; rstep = 0; expStep = 0; IsRDraw = false; PatternImage->Repaint(); MainImageForm->iMainImage->Repaint(); return; fail: if (viewp) viewp->Destroy(); EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TFillForm::cbPatternChange(TObject *Sender) { #if !(defined(ACADEMY) || defined(KNIT)) // HDC vDC = NULL; TCaptureData *cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; MainImageForm->iMainImage->SubVisible = false; window.size.x = cd->Bitmap->Width; window.size.y = cd->Bitmap->Height; PatternImage->Picture->Bitmap->PixelFormat = pf24bit; PatternImage->Picture->Bitmap->Width = PatternImage->Width; PatternImage->Picture->Bitmap->Height = PatternImage->Height; // if ((vDC = cd->Bitmap->CreateDC()) == NULL) goto fail; // SetStretchBltMode(vDC, COLORONCOLOR); // StretchBlt(PatternImage->Picture->Bitmap->Canvas->Handle, 0, 0, // PatternImage->Width, PatternImage->Height, vDC, 0, 0, window.size.x, // window.size.y, SRCCOPY); cd->Bitmap->UnionStretchBlt(PatternImage->Picture->Bitmap->Canvas->Handle, 0, 0, PatternImage->Width, PatternImage->Height, 0, 0, window.size.x, window.size.y, SRCCOPY); // convert by celberus // cd->Bitmap->DeleteDC(vDC); PatternImage->Repaint(); DrawMousePoint(MousePointPlace); expStep = 0; MakeFillImage(0); captureindex = cbPattern->ItemIndex; #endif return; fail: EXCEPTION_MESSAGE_OK(EC_RESOURCE_LACK); } //--------------------------------------------------------------------------- void __fastcall TFillForm::spEditClick(TObject *Sender) { TPSpinEdit *sp = (TPSpinEdit *)Sender; sp->SetFocus(); sp->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TFillForm::spDensityChange(TObject *Sender) { if (spDensity->Text.Length()>0) { density = spDensity->Value; } } //--------------------------------------------------------------------------- void __fastcall TFillForm::spNozzleChange(TObject *Sender) { if (spNozzle->Text.Length()>0) { nozzle = spNozzle->Value; } } //--------------------------------------------------------------------------- void __fastcall TFillForm::rgAirClick(TObject *Sender) { if (air) air = false; else air = true; lDensity->Enabled = air; lNozzle->Enabled = air; spDensity->Enabled = air; spNozzle->Enabled = air; } //--------------------------------------------------------------------------- void __fastcall TFillForm::sbNewClick(TObject *Sender) { TSpeedButton *s; TCursor cursor; s = (TSpeedButton *)Sender; if (s == sbNew) { Selector->Initial(); } else if (s == sbAll) { cursor = Screen->Cursor; Screen->Cursor = crHourGlass; if (MainImageForm->WorkArea->Mask) MainImageForm->SearchWorkAreaColor(Selector->ChoiceColor); else MainImageForm->SearchWholeColor(Selector->ChoiceColor); Selector->Invalid(); Screen->Cursor = cursor; } else if (s == sbBlock) { if (sbBlock->Down) sbBlock->Hint = IDS_COMMON_ONECOLOR; else sbBlock->Hint = IDS_COMMON_BLOCKCOLOR; } else if (s == sbDelete) { if (sbDelete->Down) sbDelete->Hint = IDS_COMMON_DELETECOLOR; else sbDelete->Hint = IDS_COMMON_INSERTCOLOR; } } //--------------------------------------------------------------------------- void __fastcall TFillForm::sbBeforeClick(TObject *Sender) { Selector->LoadFromFile(DirectoryItem+"\\Fill.Ini", "Multi"); } //--------------------------------------------------------------------------- void __fastcall TFillForm::sbBeforeDegClick(TObject *Sender) { // È®´ëÃà¼Ò½Ã ÀÌÀü¿¡ »ç¿ëµÈ À̹ÌÁöÀÇ Å©±â·Î ȯ¿ø ½ÃÄÑ ´Ù½Ã »ç¿ëÇϱâ À§ÇØ TCursor oldcur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->iMainImage->SubVisible = false; // spDeg->Value = 0; //lhskys ÀüºÎ ½ÇÇàÇß´ø °ÍÀ¸·Î... //====================================================== Theta = BeforeTheta; int deg = RadToDeg(Theta); spDeg->Value = deg; rstep = 2; if (patternfill_image_rotate()) { MakeFillImage(deg); } //======================================================= // if (cbExp->Checked) { // expStep = 2; // ExpRect = beforesize; // ExpMakeBitmap(); // } // if (patternfill_image_rotate()) { // MakeFillImage(0); // } Screen->Cursor = oldcur; MainImageForm->iMainImage->Repaint(); // cbExp->Checked = false; } //=============================================== //--------------------------------------------------------------------------- /* TCursor oldcur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->iMainImage->SubVisible = false; Theta = BeforeTheta; spDeg->Value = 0; //lhskys °¢¸¸ ÀÌÀü°¡À¸·Î int deg = RadToDeg(Theta); spDeg->Value = deg; rstep = 2; if (cbExp->Checked) { expStep = 2; ExpRect = beforesize; ExpMakeBitmap(); } if (patternfill_image_rotate()) { MakeFillImage(deg); } Screen->Cursor = oldcur; MainImageForm->iMainImage->Repaint(); } */ //--------------------------------------------------------------------------- COLORREF __fastcall TFillForm::SearchFillColor(TUnionBitmap *sBitmap) // convert by celberus { int x, y, i, j; Byte *sl; Byte rgb[3][256]; int r, g, b; COLORREF crrf; memset(rgb, 0, 256 * 3); if (!(sBitmap->StartScanLine())) goto fail; for (y = 0; y < sBitmap->Height; y++) { sl = sBitmap->GetScanLine(y); for (x = 0; x < sBitmap->Width; x++, sl += 3) { GetPixel24(sl, crrf); r = crrf & 0xFF; g = (crrf>>8) & 0xFF; b = (crrf>>16) & 0xFF; rgb[0][r] = 1; rgb[1][g] = 1; rgb[2][b] = 1; } } sBitmap->StopScanLine(); for (i = 0; i < 3; i++) { for (j = 0; j < 256; j++) { if (rgb[i][j] == 0) return 0x00000000 | (j<<(8*i)); } } return 0; fail: sBitmap->StopScanLine(); EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); return 0; } //--------------------------------------------------------------------------- // Private Function //--------------------------------------------------------------------------- void __fastcall TFillForm::Rotate_Rect(void) { MainImageForm->DrawLineLocate(Point(sx[0], sy[0]), Point(sx[2], sy[2]),8); MainImageForm->DrawLineLocate(Point(sx[2], sy[2]), Point(sx[3], sy[3]),8); MainImageForm->DrawLineLocate(Point(sx[3], sy[3]), Point(sx[1], sy[1]),8); MainImageForm->DrawLineLocate(Point(sx[1], sy[1]), Point(sx[0], sy[0]),8); MainImageForm->DrawLineLocate(Point(ArrowX[0], ArrowY[0]), Point(ArrowX[1], ArrowY[1]),8); MainImageForm->DrawLineLocate(Point(ArrowX[1], ArrowY[1]), Point(ArrowX[2], ArrowY[2]),8); MainImageForm->DrawLineLocate(Point(ArrowX[2], ArrowY[2]), Point(ArrowX[0], ArrowY[0]),8); MainImageForm->DrawLineLocate(Point(ArrowX[3], ArrowY[3]), Point(ArrowX[4], ArrowY[4]),8); } //--------------------------------------------------------------------------- void __fastcall TFillForm::Convert_CLTheta(int X, int Y) { int tx, ty; tx = rotatepoint.x - X; ty = rotatepoint.y - Y; if (ty == 0) { if (tx < 0) Theta = 3*M_PI /2.0; else Theta = M_PI / 2.0; } else { Theta = atan((Extended)tx / ty); if (ty < 0) Theta += M_PI; else if (tx < 0) Theta += 2 * M_PI; } } //--------------------------------------------------------------------------- void __fastcall TFillForm::Trans_Data(int X, int Y) { TRotation *Trans = NULL; int LX, LY; LX = window.size.x / 2; LY = window.size.y / 2; if ((Trans = new TRotation) == NULL) { EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); return; } Convert_CLTheta(X, Y); Trans->translation(-rotatepoint.x, -rotatepoint.y); Trans->rotation(-Theta); Trans->convert(rotatepoint.x - LX, rotatepoint.y - LY, sx[0], sy[0]); sx[0] = sx[0] + rotatepoint.x; sy[0] = sy[0] + rotatepoint.y; Trans->convert(rotatepoint.x - LX, rotatepoint.y + LY, sx[1], sy[1]); sx[1] = sx[1] + rotatepoint.x; sy[1] = sy[1] + rotatepoint.y; Trans->convert(rotatepoint.x + LX, rotatepoint.y - LY, sx[2], sy[2]); sx[2] = sx[2] + rotatepoint.x; sy[2] = sy[2] + rotatepoint.y; Trans->convert(rotatepoint.x + LX, rotatepoint.y + LY, sx[3], sy[3]); sx[3] = sx[3] + rotatepoint.x; sy[3] = sy[3] + rotatepoint.y; Trans->convert(ArrowX[0], ArrowY[0]); ArrowX[0] = ArrowX[0] + rotatepoint.x; ArrowY[0] = ArrowY[0] + rotatepoint.y; Trans->convert(ArrowX[1], ArrowY[1]); ArrowX[1] = ArrowX[1] + rotatepoint.x; ArrowY[1] = ArrowY[1] + rotatepoint.y; Trans->convert(ArrowX[2], ArrowY[2]); ArrowX[2] = ArrowX[2] + rotatepoint.x; ArrowY[2] = ArrowY[2] + rotatepoint.y; Trans->convert(ArrowX[3], ArrowY[3]); ArrowX[3] = ArrowX[3] + rotatepoint.x; ArrowY[3] = ArrowY[3] + rotatepoint.y; max_x = sx[0]; min_x = max_x; max_y = sy[0]; min_y = max_y; delete Trans; } //--------------------------------------------------------------------------- bool __fastcall TFillForm::patternfill_image_rotate(int X, int Y) { TRotation *Trans = NULL; Extended dx, dy, px, py; int LX, LY, xx, yy, i, j; Byte *IP, *WP, *MP; MainImageForm->ResetDraw(true); RotateArea = Point(max_x - min_x + 1, max_y - min_y + 1); if ((Trans = new TRotation) == NULL) goto fail; // LX = window.size.x / 2; // LY = window.size.y / 2; if (!sbBeforeDeg->Down) { if (!sw) Convert_CLTheta(X, Y); } Trans->translation(-rotatepoint.x, -rotatepoint.y); Trans->rotation(Theta); /* if (!(window.Bitmap->Create(RotateArea.x, RotateArea.y, 8, rgb))) goto fail; if (!(window.Mask->Create(RotateArea.x, RotateArea.y, 8, rgb))) goto fail; if (!(window.Bitmap->StartScanLine())) goto fail; if (!(window.Mask->StartScanLine())) goto fail; if (bExp) { if (!(viewp->StartScanLine())) goto fail; for (i = 0; i <= max_y-min_y; i++) { WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (j = 0; j <= max_x-min_x; j++) { //////adsfadsf_for Trans->convert(j, i, dx, dy); py = dy + LY; yy = floor(py); if ((yy >= 0) && (yy < window.size.y)) { px = dx + LX; xx = floor(px); if ((xx >= 0) && (xx < window.size.x)) { IP = viewp->GetScanLine(yy); if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 WP[j] = IP[xx];//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP[j] = 0x00;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 WP[j] = 0x00;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP[j] = 0xFF;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 WP[j] = 0x00;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP[j] = 0xFF;//////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } viewp->StopScanLine(); } else { if (!(Image->uBitmap->StartScanLine())) goto fail; for (i = min_y; i <= max_y; i++) { WP = window.Bitmap->GetScanLine(i - min_y); MP = window.Mask->GetScanLine(i - min_y); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (j = min_x; j <= max_x; j++) { //////adsfadsf_for Trans->convert(j, i, dx, dy); py = dy + LY; yy = floor(py); yy += window.s.y; if ((window.s.y <= yy) && (window.e.y > yy)) { px = dx + LX; xx = floor(px); xx += window.s.x; if ((window.s.x <= xx) && (window.e.x > xx)) { IP = Image->uBitmap->GetScanLine(yy); if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 WP[j - (int)min_x] = IP[xx];//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP[j - (int)min_x] = 0x00;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 WP[j - (int)min_x] = 0x00;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP[j - (int)min_x] = 0xFF;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 WP[j - (int)min_x] = 0x00;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP[j - (int)min_x] = 0xFF;//////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i - min_y,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i - min_y,StartX,EndX-StartX+1); ////adsfadsf } Image->uBitmap->StopScanLine(); } window.Bitmap->StopScanLine(); window.Mask->StopScanLine(); */ delete Trans; return true; fail: window.Mask->Destroy(); window.Bitmap->Destroy(); if (Trans) delete Trans; EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); return false; } //--------------------------------------------------------------------------- void __fastcall TFillForm::multifill_color_making(TUnionBitmap *undo) // convert by celberus { Byte c, uc; int gray[256]; int i, j; short lig, main_lig, sub_lig, diff_lig; double h, l, s, hue, sat; int frequency[256]; int max; TCursor OldCursor; RGBQUAD rgb[256]; Byte *UP; TPItemImage *Image = MainImageForm->iMainImage; OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->Palette->RGB2HLS(PaletteForm->DIB256Palette->ChoiceIndex, hue, l, sat); main_lig = l * 100; for (i = 0; i < MAX_COLOR; i++) { frequency[i] = 0; } for (i = 0; i < undo->Height; i++) { // UP = undo->GetScanLine(i); UP = MainImageForm->iMainImage->uBitmap->GetUndoScanLine(i); for (j = 0; j < undo->Width; j++) { uc = UP[j]; if (Selector->Number[uc] < 255) frequency[uc]++; } } max = 0; j = 0; for (i = 0; i < MAX_COLOR; i++) { if (Selector->Number[i] < 255) { if (frequency[i] > max) { max = frequency[i]; j = i; } } } MainImageForm->Palette->RGB2HLS(j, h, l, s); sub_lig = l * 100; diff_lig = main_lig - sub_lig; memset(gray, 0, sizeof(gray)); for (i = 0; i < MAX_COLOR; i++) { if (Selector->Number[i] < 255) { MainImageForm->Palette->RGB2HLS(i, h, l, s); lig = l * 100; gray[i] = lig + diff_lig; if (gray[i] < 0) gray[i] = 0; else if (gray[i] > 100) gray[i] = 100; } } for (i = 0; i < MAX_COLOR; i++) { if ((Selector->Number[i] < 255) && ((gray[i] & 0x8000) == 0)) { if (ctable[i] == 0) { colorptr++; c = colorptr; if (c < MAX_COLOR) { if (c == PaletteForm->DIB256Palette->ChoiceIndex) { colorptr++; c = colorptr; } ctable[i] = c; gray[i] = gray[i] | 0x8000; } for (j = i + 1; j < MAX_COLOR; j++) { if (Selector->Number[j] < 255) { if ((gray[i] & 0x007F) == gray[j]) { if ((gray[j] & 0x8000) == 0) { ctable[j] = ctable[i]; } } } } } } } for (i = 0; i< MAX_COLOR; i++) { if (Selector->Number[i] < 255) { MainImageForm->Palette->HLS2RGB(ctable[i], hue, (gray[i] & 0x7FFF) / 100.0, sat); } } /* if(PaletteForm->DIB256Palette->UseColor + Selector->Count > MAX_COLOR) PaletteForm->DIB256Palette->UseColor -= Selector->Count;*/ if (colorptr > PaletteForm->DIB256Palette->UseColor) PaletteForm->DIB256Palette->UseColor = colorptr; PaletteForm->DIB256Palette->SetPalette(MainImageForm->Palette); MainImageForm->Palette->ToRGBQUAD(rgb, 256); Image->uBitmap->PutColors(0, 256, rgb); Screen->Cursor = OldCursor; } //--------------------------------------------------------------------------- bool __fastcall TFillForm::fill_read_none8(Byte *p, int x) { return Selector->Number[*(p+x)]<255; } //---------------------------------------------------------------------------- bool __fastcall TFillForm::fill_read_layer8_zero(Byte *p, Byte *lp, int x) { return Selector->Number[*(p+x)]<255 && (*(lp + x) == 0); } //---------------------------------------------------------------------------- bool __fastcall TFillForm::fill_read_layer8_nonezero(Byte *p, Byte *lp, int x) { return Selector->Number[*(p+x)]<255 && (*(lp + x) != 0); } //---------------------------------------------------------------------------- void __fastcall TFillForm::fill_save_8(Byte *p, int x) { *(p+x) = 255; } //--------------------------------------------------------------------------- #define GETMASK (*mp&mm) #define GETMASK0(n) (*mp[n]&mm) #define GETMASK1(n) (mm>1 ? *mp[n]&(mm>>1) : *(mp[n]+1)&0x80) #define GETMASK2(n) (mm>2 ? *mp[n]&(mm>>2) : *(mp[n]+1)&(mm<<6)) #define RESETMASK *mp &= ~mm #define RESETMASK0(n) *mp[n] &= ~mm #define RESETMASK1(n) if (mm>1) *mp[n] &= ~(mm>>1); else *(mp[n]+1) &= ~0x80 #define RESETMASK2(n) if (mm>2) *mp[n] &= ~(mm>>2); else *(mp[n]+1) &= ~(mm<<6) //--------------------------------------------------------------------------- void __fastcall TFillForm::normal_8(TFillData &fd, TFillFunc ff) { TPItemImage *Image = MainImageForm->iMainImage; Byte *lp, *mp, mm; if(FullViewForm->Super==sOverlap){MainImageForm->InitOverlap();} if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); lp = Image->LayerMask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp = fd.M[0] + (fd.rcBound.Left >> 3); mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp = fd.M[0] + (fd.rcBound.Left >> 3); mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } if(FullViewForm->Super==sOverlap){MainImageForm->ExitOverlap();} } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle1_8(TFillData &fd, TFillFunc ff) { TPItemImage *Image = MainImageForm->iMainImage; Byte *lp, *mp, mm; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); lp = Image->LayerMask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp = fd.M[0] + (fd.rcBound.Left >> 3); mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp = fd.M[0] + (fd.rcBound.Left >> 3); mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle2_8(TFillData &fd, TFillFunc ff) { TPItemImage *Image = MainImageForm->iMainImage; Byte *lp, *lp1, *mp[2], mm; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); lp = Image->LayerMask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); lp1 = Image->LayerMask->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1 < fd.rcBound.Bottom) { Image->uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf Image->LayerMask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle3_8(TFillData &fd, TFillFunc ff) { TPItemImage *Image = MainImageForm->iMainImage; Byte *lp, *lp1, *mp[2], mm; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); lp = Image->LayerMask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); lp1 = Image->LayerMask->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf Image->LayerMask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle4_8(TFillData &fd, TFillFunc ff) { TPItemImage *Image = MainImageForm->iMainImage; Byte *lp, *lp1, *lp2, *mp[3], mm; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); lp = Image->LayerMask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); lp1 = Image->LayerMask->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y + 1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } if (y+2GetScanLineN(y+2 - S_TOP, 2); fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); lp2 = Image->LayerMask->GetScanLineN(y+2, 2); fd.M[2] = fd.Mask->ScanLine(y + 2); mp[2] = fd.M[2] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf Image->LayerMask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } if (y+2uBitmap->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf Image->LayerMask->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf } } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } if (y+2GetScanLineN(y+2 - S_TOP, 2); fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); fd.M[2] = fd.Mask->ScanLine(y+2); mp[2] = fd.M[2] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } if (y+2uBitmap->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle5_8(TFillData &fd, TFillFunc ff) { TPItemImage *Image = MainImageForm->iMainImage; Byte *lp, *lp1, *lp2, *mp[3], mm; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); lp = Image->LayerMask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); lp1 = Image->LayerMask->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } if (y+2GetScanLineN(y+2 - S_TOP, 2); fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); lp2 = Image->LayerMask->GetScanLineN(y+2, 2); fd.M[2] = fd.Mask->ScanLine(y+2); mp[2] = fd.M[2] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+2); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+2); ////adsfadsf if (y+1uBitmap->PutScanLineN(y + 1,StartX,EndX-StartX+2, 1); ////adsfadsf Image->LayerMask->PutScanLineN(y + 1,StartX,EndX-StartX+2, 1); ////adsfadsf } if (y+2uBitmap->PutScanLineN(y + 2,StartX,EndX-StartX+2, 2); ////adsfadsf Image->LayerMask->PutScanLineN(y + 2,StartX,EndX-StartX+2, 2); ////adsfadsf } } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } if (y+2GetScanLineN(y+2 - S_TOP, 2); fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); fd.M[2] = fd.Mask->ScanLine(y+2); mp[2] = fd.M[0] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+2); ////adsfadsf if (y+1uBitmap->PutScanLineN(y + 1,StartX,EndX-StartX+2, 1); ////adsfadsf } if (y+2uBitmap->PutScanLineN(y + 2,StartX,EndX-StartX+2, 2); ////adsfadsf } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::normalmask_8(TFillData &fd, TFillFunc ff) { Byte *P = 0, *mp, mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top; yuBitmap->GetScanLine(y); P = Image->Mask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp = fd.M[0] + (fd.rcBound.Left >> 3); mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel;//////adsfadsf_Variable_Checked RESETMASK; } if (mm == 1) { mp++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask1_8(TFillData &fd, TFillFunc ff) { Byte *P = 0, *mp, mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top; yuBitmap->GetScanLine(y); P = Image->Mask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp = fd.M[0] + (fd.rcBound.Left >> 3); mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel;//////adsfadsf_Variable_Checked RESETMASK; } } if (mm == 1) { mp++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask2_8(TFillData &fd, TFillFunc ff) { Byte *P[2], *mp[2], mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); P[0] = Image->Mask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); P[1] = Image->Mask->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(0); if (x&1) { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK1(0); } } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((y+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(1); } } } } if (mm == 1) { mp[0]++; mp[1]++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1Mask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask3_8(TFillData &fd, TFillFunc ff) { Byte *P[2], *mp[2], mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); P[0] = Image->Mask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); P[1] = Image->Mask->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(0); if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK1(0); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((y+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(1); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK1(1); } } } if (mm == 1) { mp[0]++; mp[1]++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1Mask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask4_8(TFillData &fd, TFillFunc ff) { Byte *P[3], *mp[3], mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); P[0] = Image->Mask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); P[1] = Image->Mask->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } if (y+2GetScanLineN(y+2 - S_TOP, 2); fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); P[2] = Image->Mask->GetScanLineN(y+2, 2); fd.M[2] = fd.Mask->ScanLine(y+2); mp[2] = fd.M[2] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(0); if (x&1) { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+2MaskPixel;//////adsfadsf_Variable_Checked RESETMASK2(0); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+2MaskPixel;//////adsfadsf_Variable_Checked RESETMASK2(1); } } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((y+2MaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(2); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((y+2MaskPixel;//////adsfadsf_Variable_Checked RESETMASK1(2); } } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(1); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((y+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(1); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK1(1); } } } if (mm == 1) { mp[0]++; mp[1]++; mp[2]++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1Mask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf if (y+2Mask->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf if (y+2uBitmap->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask5_8(TFillData &fd, TFillFunc ff) { TPItemImage *Image = MainImageForm->iMainImage; Byte *P[3], *mp[3], mm; for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); fd.P[0] = Image->uBitmap->GetScanLine(y); P[0] = Image->Mask->GetScanLine(y); fd.M[0] = fd.Mask->ScanLine(y); mp[0] = fd.M[0] + (fd.rcBound.Left >> 3); if (y+1GetScanLineN(y+1 - S_TOP, 1); fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); P[1] = Image->Mask->GetScanLineN(y+1, 1); fd.M[1] = fd.Mask->ScanLine(y+1); mp[1] = fd.M[1] + (fd.rcBound.Left >> 3); } if (y+2GetScanLineN(y+2 - S_TOP, 2); fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); P[2] = Image->Mask->GetScanLineN(y+2, 2); fd.M[2] = fd.Mask->ScanLine(y+2); mp[2] = fd.M[2] + (fd.rcBound.Left >> 3); } mm = 0x80 >> (fd.rcBound.Left & 7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(0); if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+2MaskPixel;//////adsfadsf_Variable_Checked RESETMASK2(2); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+2MaskPixel;//////adsfadsf_Variable_Checked RESETMASK2(0); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+2MaskPixel;//////adsfadsf_Variable_Checked RESETMASK2(1); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((y+2MaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(2); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((y+2MaskPixel;//////adsfadsf_Variable_Checked RESETMASK1(2); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK1(0); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((y+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK0(1); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if ((x+1MaskPixel;//////adsfadsf_Variable_Checked RESETMASK1(1); } } } if (mm == 1) { mp[0]++; mp[1]++; mp[2]++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1Mask->PutScanLineN(y + 1,StartX,EndX-StartX+1, 1); ////adsfadsf /////wasted lines if (y+2Mask->PutScanLineN(y + 2,StartX,EndX-StartX+1, 2); ////adsfadsf /////wasted lines Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y + 1,StartX,EndX-StartX+1, 1); ////adsfadsf /////wasted lines if (y+2uBitmap->PutScanLineN(y + 2,StartX,EndX-StartX+1, 2); ////adsfadsf /////wasted lines } } //--------------------------------------------------------------------------- void __fastcall TFillForm::funcToMulti_8(TFillData &fd, int n, int x, int y) { clFillData = ctable[fd.U[n][x-S_LEFT]]; } //--------------------------------------------------------------------------- void __fastcall TFillForm::funcNormalPattern_8(TFillData &fd, int n, int x, int y) { Byte *SP; int px, py, r; int ex, ey; COLORREF color; if (RepeatItem == 0) { if (y-fd.ey<0) { py = window.size.y+(y-fd.ey)%window.size.y; if (py>=window.size.y) py = 0; } else { py = (y-fd.ey)%window.size.y; } if (x-fd.ex<0) { px = window.size.x+(x-fd.ex)%window.size.x; if (px>=window.size.x) px = 0; } else { px = (x-fd.ex)%window.size.x; } } else if (RepeatItem == 1) { // Half Drop Vertical if (x-fd.ex<0) { px = window.size.x+(x-fd.ex)%window.size.x-1; if (px>=window.size.x) px = 0; r = ((fd.ex - x) / window.size.x) + 1; ey = fd.ey - r*half; } else { px = (x-fd.ex)%window.size.x; r = (x - fd.ex) / window.size.x; ey = fd.ey + r*half; } if (y-ey<0) { py = window.size.y+(y-ey)%window.size.y; if (py>=window.size.y) py = 0; } else { py = (y-ey)%window.size.y; } } else { // Half Drop Horizontal if (y-fd.ey<0) { py = window.size.y+(y-fd.ey)%window.size.y-1; if (py>=window.size.y) py = 0; r = ((fd.ey - y) / window.size.y) + 1; ex = fd.ex - r*half; } else { py = (y-fd.ey)%window.size.y; r = (y - fd.ey) / window.size.y; ex = fd.ex + r*half; } if (x-ex<0) { px = window.size.x+(x-ex)%window.size.x; if (px>=window.size.x) px = 0; } else { px = (x-ex)%window.size.x; } } SP = viewp->GetScanLine(py); clFillData = SP[px]; clLayerData = 0; switch (FullViewForm->Super) { case sNormal: if (clFillData==fd.clBack) { clFillData = fd.U[n][x-S_LEFT]; clLayerData = 0xFF; } break; case sGauze : // if(fd.U[n][x-S_LEFT] == 0x01)break; if (clFillData==fd.clBack || ((x+y)&1)) { clFillData = fd.U[n][x-S_LEFT]; clLayerData = 0xFF; } break; case sOverlap : // if(fd.U[n][x-S_LEFT] == 0x01)break; if (clFillData==fd.clBack || ((x+y)&1)) { clFillData = fd.U[n][x-S_LEFT]; clLayerData = 0xFF; } ///* if(COLOROVERFLOW)return; if(fd.U[n][x-S_LEFT] == 0x01)break; // if (MainImageForm->Palette->ColorData[fd.P[0][x]]->Protect==0 && (*SP > 1)) { if (MainImageForm->Palette->ColorData[fd.P[0][x]]->Protect==0 && (SP[px] > 1)) { // MainImageForm->InitOverlap(); if (fd.P[0][x] > 1) { // color = MainImageForm->Overlap(*SP, fd.U[n][x-S_LEFT]); color = MainImageForm->Overlap(SP[px], fd.U[n][x-S_LEFT]); clFillData = color; } // MainImageForm->ExitOverlap(); } //*/ break; } } //--------------------------------------------------------------------------- void __fastcall TFillForm::funcRotatePattern_8(TFillData &fd, int n, int x, int y) { int gap, gapx, gapy; Byte *SP; Extended xc, xs, yc, ys; ys = (fillstart.y-y)*fd.st; yc = (fillstart.y-y)*fd.ct; xs = (fillstart.x-x)*fd.st; xc = (fillstart.x-x)*fd.ct; gap = (int)(-yc+xs-fd.ey)%window.size.y; if (gap<0) { gapy = window.size.y+gap; } else { gapy = gap; } gap = (int)(-xc-ys-fd.ex)%window.size.x; if (gap<0) { gapx = window.size.x+gap; } else { gapx = gap; } SP = viewp->GetScanLine(gapy); clFillData = SP[gapx]; clLayerData = 0; switch (FullViewForm->Super) { case sNormal: if (clFillData==fd.clBack) { clFillData = fd.U[n][x-S_LEFT]; clLayerData = 0xFF; } break; case sGauze: // if(fd.U[n][x-S_LEFT] == 0x01)break; if ((clFillData==fd.clBack) || ((x+y)&1)) { clFillData = fd.U[n][x-S_LEFT]; clLayerData = 0xFF; } break; case sOverlap: // if(fd.U[n][x-S_LEFT] == 0x01)break; if ((clFillData==fd.clBack) || ((x+y)&1)) { clFillData = fd.U[n][x-S_LEFT]; clLayerData = 0xFF; } break; } } //--------------------------------------------------------------------------- bool __fastcall TFillForm::fill_read_none24(Byte *p, int x) { COLORREF c; p += 3*x; GetPixel24(p, c); return c==clFillFrom; } //--------------------------------------------------------------------------- bool __fastcall TFillForm::fill_read_layer24_zero(Byte *p, Byte *lp, int x) { COLORREF c; p += 3*x; GetPixel24(p, c); return (c==clFillFrom) && ((lp[x >> 3] & (0x80 >> (x & 7))) == 0); } //--------------------------------------------------------------------------- bool __fastcall TFillForm::fill_read_layer24_nonezero(Byte *p, Byte *lp, int x) { COLORREF c; p += 3*x; GetPixel24(p, c); return (c==clFillFrom) && ((lp[x >> 3] & (0x80 >> (x & 7))) != 0); } //--------------------------------------------------------------------------- void __fastcall TFillForm::normal_24(TFillData &fd, TFillFunc ff) { Byte *pp, *mp, mm, *lp; TPItemImage *Image = MainImageForm->iMainImage; if(FullViewForm->Super==sOverlap){MainImageForm->InitOverlap();} //by linuxjun if (Image->LayerMask) { for (int y=fd.rcBound.Top; yuBitmap->GetScanLine(y); pp = fd.P[0]+3*fd.rcBound.Left; fd.U[0] = fd.undo->GetScanLine(y - S_TOP); fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp = fd.M[0]+(fd.ptMask.x>>3); lp = Image->LayerMask->GetScanLine(y); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>3)) & (0x80 >> (x&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(lp + (x>>3)) &= ~(0x80 >> (x&7));//////adsfadsf_Variable_Checked } } RESETMASK; } if (mm==1) { mp++; mm = 0x80; } else { mm >>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } else { for (int y=fd.rcBound.Top; yuBitmap->GetScanLine(y); pp = fd.P[0]+3*fd.rcBound.Left; fd.U[0] = fd.undo->GetScanLine(y - S_TOP); fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp = fd.M[0]+(fd.ptMask.x>>3); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } if(FullViewForm->Super==sOverlap){MainImageForm->ExitOverlap();} //by linuxjun } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle1_24(TFillData &fd, TFillFunc ff) { Byte *pp, *up, *mp, mm, *lp; TPItemImage *Image = MainImageForm->iMainImage; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yuBitmap->GetScanLine(y); pp = fd.P[0]+3*fd.rcBound.Left; fd.U[0] = fd.undo->GetScanLine(y - S_TOP); up = fd.U[0]+3*S_LEFT; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp = fd.M[0]+(fd.ptMask.x>>3); lp = Image->LayerMask->GetScanLine(y); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>3)) & (0x80 >> (x&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(lp + (x>>3)) &= ~(0x80 >> (x&7));//////adsfadsf_Variable_Checked } } RESETMASK; } } if (mm==1) { mp++; mm = 0x80; } else { mm >>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } else { for (int y=fd.rcBound.Top; yuBitmap->GetScanLine(y); pp = fd.P[0]+3*fd.rcBound.Left; fd.U[0] = fd.undo->GetScanLine(y - S_TOP); up = fd.U[0]+3*S_LEFT; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp = fd.M[0]+(fd.ptMask.x>>3); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle2_24(TFillData &fd, TFillFunc ff) { Byte *pp1, *pp2, *up1, *up2, *mp[2], mm, *p, *lp, *lp1; TPItemImage *Image = MainImageForm->iMainImage; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); up1 = fd.U[0]+3*S_LEFT; fd.P[0] = Image->uBitmap->GetScanLine(y); pp1 = fd.P[0]+3*fd.rcBound.Left; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); lp = Image->LayerMask->GetScanLine(y); if (y+1GetScanLineN(y+1 - S_TOP, 1); up2 = fd.U[1]+3*S_LEFT; fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); pp2 = fd.P[1]+3*fd.rcBound.Left; fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); lp1 = Image->LayerMask->GetScanLineN(y+1, 1); } mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>3)) & (0x80 >> (x&7))) { if (clLayerData == 0){ *(lp + (x>>3)) &= ~(0x80 >> (x&7)); } } RESETMASK0(0); if (x&1) { if (x+1>3)) & (0x80 >> ((x+1)&7))) { if (clLayerData == 0){ *(lp + ((x+1)>>3)) &= ~(0x80 >> ((x+1)&7)); } } RESETMASK1(0); } } else { if (y+1>3)) & (0x80 >> (x&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ *(lp1 + (x>>3)) &= ~(0x80 >> (x&7));//////adsfadsf_Variable_Checked } } RESETMASK0(1); } } } } if (mm==1) { mp[0]++; mp[1]++; mm = 0x80; } else { mm >>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf Image->LayerMask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); up1 = fd.U[0]+3*S_LEFT; fd.P[0] = Image->uBitmap->GetScanLine(y); pp1 = fd.P[0]+3*fd.rcBound.Left; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); if (y+1GetScanLineN(y+1 - S_TOP, 1); up2 = fd.U[1]+3*S_LEFT; fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); pp2 = fd.P[1]+3*fd.rcBound.Left; fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); } mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle3_24(TFillData &fd, TFillFunc ff) { Byte *pp1, *pp2, *up1, *up2, *mp[2], mm, *p, *lp, *lp1; TPItemImage *Image = MainImageForm->iMainImage; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); up1 = fd.U[0]+3*S_LEFT; fd.P[0] = Image->uBitmap->GetScanLine(y); pp1 = fd.P[0]+3*fd.rcBound.Left; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); lp = Image->LayerMask->GetScanLine(y); if (y+1GetScanLineN(y+1 - S_TOP, 1); up2 = fd.U[1]+3*S_LEFT; fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); pp2 = fd.P[1]+3*fd.rcBound.Left; fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); lp1 = Image->LayerMask->GetScanLineN(y+1, 1); } mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>3)) & (0x80 >> (x&7))) { if (clLayerData == 0){ *(lp + (x>>3)) &= ~(0x80 >> (x&7)); } } RESETMASK0(0); if (x+1>3)) & (0x80 >> ((x+1)&7))) { if (clLayerData == 0){ *(lp + ((x+1)>>3)) &= ~(0x80 >> ((x+1)&7)); } } RESETMASK1(0); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (y+1>3)) & (0x80 >> (x&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(lp1 + (x>>3)) &= ~(0x80 >> (x&7));//////adsfadsf_Variable_Checked } } RESETMASK0(1); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (x+1>3)) & (0x80 >> ((x+1)&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(lp1 + ((x+1)>>3)) &= ~(0x80 >> ((x+1)&7));//////adsfadsf_Variable_Checked } } RESETMASK1(1); } } } if (mm==1) { mp[0]++; mp[1]++; mm = 0x80; } else { mm >>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf Image->LayerMask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); up1 = fd.U[0]+3*S_LEFT; fd.P[0] = Image->uBitmap->GetScanLine(y); pp1 = fd.P[0]+3*fd.rcBound.Left; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); if (y+1GetScanLineN(y+1 - S_TOP, 1); up2 = fd.U[1]+3*S_LEFT; fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); pp2 = fd.P[1]+3*fd.rcBound.Left; fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); } mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle4_24(TFillData &fd, TFillFunc ff) { Byte *pp1, *pp2, *pp3, *up1, *up2, *up3, *mp[3], mm, *p; Byte *lp, *lp1, *lp2; TPItemImage *Image = MainImageForm->iMainImage; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); up1 = fd.U[0]+3*S_LEFT; fd.P[0] = Image->uBitmap->GetScanLine(y); pp1 = fd.P[0]+3*fd.rcBound.Left; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); lp = Image->LayerMask->GetScanLine(y); if (y+1GetScanLineN(y+1 - S_TOP, 1); up2 = fd.U[1]+3*S_LEFT; fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); pp2 = fd.P[1]+3*fd.rcBound.Left; fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); lp1 = Image->LayerMask->GetScanLineN(y+1, 1); } if (y+2GetScanLineN(y+2 - S_TOP, 2); up3 = fd.U[2]+3*S_LEFT; fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); pp3 = fd.P[2]+3*fd.rcBound.Left; fd.M[2] = fd.Mask->ScanLine(y+2-fd.ptMask.y); mp[2] = fd.M[2]+(fd.ptMask.x>>3); lp2 = Image->LayerMask->GetScanLineN(y+2, 2); } mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>3)) & (0x80 >> (x&7))) { if (clLayerData == 0){ *(lp + (x>>3)) &= ~(0x80 >> (x&7)); } } RESETMASK0(0); if (x&1) { if (x+2>3)) & (0x80 >> ((x+2)&7))) { if (clLayerData == 0){ *(lp + ((x+2)>>3)) &= ~(0x80 >> ((x+2)&7)); } } RESETMASK2(0); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (x+2>3)) & (0x80 >> ((x+2)&7))) { if (clLayerData == 0){ *(lp1 + ((x+2)>>3)) &= ~(0x80 >> ((x+2)&7)); } } RESETMASK2(1); } } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (y+2>3)) & (0x80 >> (x&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(lp2 + (x>>3)) &= ~(0x80 >> (x&7));//////adsfadsf_Variable_Checked } } RESETMASK0(2); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (y+2>3)) & (0x80 >> ((x+1)&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(lp2 + ((x+1)>>3)) &= ~(0x80 >> ((x+1)&7));//////adsfadsf_Variable_Checked } } RESETMASK1(2); } } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (x+1>3)) & (0x80 >> ((x+1)&7))) { if (clLayerData == 0){ *(lp + ((x+1)>>3)) &= ~(0x80 >> ((x+1)&7)); } } RESETMASK1(0); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (y+1>3)) & (0x80 >> (x&7))) { if (clLayerData == 0){ *(lp1 + (x>>3)) &= ~(0x80 >> (x&7)); } } RESETMASK0(1); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (x+1>3)) & (0x80 >> ((x+1)&7))) { if (clLayerData == 0){ *(lp1 + ((x+1)>>3)) &= ~(0x80 >> ((x+1)&7)); } } RESETMASK1(1); } } } if (mm==1) { mp[0]++; mp[1]++; mp[2]++; mm = 0x80; } else { mm >>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf Image->LayerMask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } if (y+2uBitmap->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf Image->LayerMask->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf } } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); up1 = fd.U[0]+3*S_LEFT; fd.P[0] = Image->uBitmap->GetScanLine(y); pp1 = fd.P[0]+3*fd.rcBound.Left; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); if (y+1GetScanLineN(y+1 - S_TOP, 1); up2 = fd.U[1]+3*S_LEFT; fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); pp2 = fd.P[1]+3*fd.rcBound.Left; fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); } if (y+2GetScanLineN(y+2 - S_TOP, 2); up3 = fd.U[2]+3*S_LEFT; fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); pp3 = fd.P[2]+3*fd.rcBound.Left; fd.M[2] = fd.Mask->ScanLine(y+2-fd.ptMask.y); mp[2] = fd.M[2]+(fd.ptMask.x>>3); } mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } if (y+2uBitmap->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzle5_24(TFillData &fd, TFillFunc ff) { Byte *pp1, *pp2, *pp3, *up1, *up2, *up3, *mp[3], mm, *p; Byte *lp, *lp1, *lp2; TPItemImage *Image = MainImageForm->iMainImage; if (Image->LayerMask) { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); up1 = fd.U[0]+3*S_LEFT; fd.P[0] = Image->uBitmap->GetScanLine(y); pp1 = fd.P[0]+3*fd.rcBound.Left; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); lp = Image->LayerMask->GetScanLine(y); if (y+1GetScanLineN(y+1 - S_TOP, 1); up2 = fd.U[1]+3*S_LEFT; fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); pp2 = fd.P[1]+3*fd.rcBound.Left; fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); lp1 = Image->LayerMask->GetScanLineN(y+1, 1); } if (y+2GetScanLineN(y+2 - S_TOP, 2); up3 = fd.U[2]+3*S_LEFT; fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); pp3 = fd.P[2]+3*fd.rcBound.Left; fd.M[2] = fd.Mask->ScanLine(y+2-fd.ptMask.y); mp[2] = fd.M[2]+(fd.ptMask.x>>3); lp2 = Image->LayerMask->GetScanLineN(y+2, 2); } mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>3)) & (0x80 >> (x&7))) { if (clLayerData == 0){ *(lp + (x>>3)) &= ~(0x80 >> (x&7)); } } RESETMASK0(0); if (x+2>3)) & (0x80 >> ((x+2)&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(lp2 + ((x+2)>>3)) &= ~(0x80 >> ((x+2)&7));//////adsfadsf_Variable_Checked } } RESETMASK2(2); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (x+2>3)) & (0x80 >> ((x+2)&7))) { if (clLayerData == 0){ *(lp + ((x+2)>>3)) &= ~(0x80 >> ((x+2)&7)); } } RESETMASK2(0); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (x+2>3)) & (0x80 >> ((x+2)&7))) { if (clLayerData == 0){ *(lp1 + ((x+2)>>3)) &= ~(0x80 >> ((x+2)&7)); } } RESETMASK2(1); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (y+2>3)) & (0x80 >> (x&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(lp2 + (x>>3)) &= ~(0x80 >> (x&7));//////adsfadsf_Variable_Checked } } RESETMASK0(2); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (y+2>3)) & (0x80 >> ((x+1)&7))) {//////adsfadsf_Variable_Checked if (clLayerData == 0){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(lp2 + ((x+1)>>3)) &= ~(0x80 >> ((x+1)&7));//////adsfadsf_Variable_Checked } } RESETMASK1(2); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (x+1>3)) & (0x80 >> ((x+1)&7))) { if (clLayerData == 0){ *(lp + ((x+1)>>3)) &= ~(0x80 >> ((x+1)&7)); } } RESETMASK1(0); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (y+1>3)) & (0x80 >> (x&7))) { if (clLayerData == 0){ *(lp1 + (x>>3)) &= ~(0x80 >> (x&7)); } } RESETMASK0(1); } if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 if (x+1>3)) & (0x80 >> ((x+1)&7))) { if (clLayerData == 0){ *(lp1 + ((x+1)>>3)) &= ~(0x80 >> ((x+1)&7)); } } RESETMASK1(1); } } } if (mm==1) { mp[0]++; mp[1]++; mp[2]++; mm = 0x80; } else { mm >>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf Image->LayerMask->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf Image->LayerMask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } if (y+2uBitmap->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf Image->LayerMask->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf } } } else { for (int y=fd.rcBound.Top; yGetScanLine(y - S_TOP); up1 = fd.U[0]+3*S_LEFT; fd.P[0] = Image->uBitmap->GetScanLine(y); pp1 = fd.P[0]+3*fd.rcBound.Left; fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); if (y+1GetScanLineN(y+1 - S_TOP, 1); up2 = fd.U[1]+3*S_LEFT; fd.P[1] = Image->uBitmap->GetScanLineN(y+1, 1); pp2 = fd.P[1]+3*fd.rcBound.Left; fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); } if (y+2GetScanLineN(y+2 - S_TOP, 2); up3 = fd.U[2]+3*S_LEFT; fd.P[2] = Image->uBitmap->GetScanLineN(y+2, 2); pp3 = fd.P[2]+3*fd.rcBound.Left; fd.M[2] = fd.Mask->ScanLine(y+2-fd.ptMask.y); mp[2] = fd.M[2]+(fd.ptMask.x>>3); } mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; x>= 1; } } Image->uBitmap->PutScanLine(y,StartX,EndX-StartX+1); ////adsfadsf if (y+1uBitmap->PutScanLineN(y+1,StartX+ (fd.rcBound.Left>>3),EndX-StartX+1, 1); ////adsfadsf } if (y+2uBitmap->PutScanLineN(y+2,StartX+ (fd.rcBound.Left>>3),EndX-StartX+1, 2); ////adsfadsf } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::normalmask_24(TFillData &fd, TFillFunc ff) { Byte *pp, pm, *mp, mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top; yMask->GetScanLine(y) + (fd.rcBound.Left>>3); fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp = fd.M[0]+(fd.ptMask.x>>3); pm = 0x80>>(fd.rcBound.Left&7); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left ; xMaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK; } if (pm==1) { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 pp++; pm = 0x80; //////adsfadsf_Variable_Checked } else { pm >>= 1; } if (mm==1) { mp++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX+ (fd.rcBound.Left>>3),EndX-StartX+1); ////adsfadsf } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask1_24(TFillData &fd, TFillFunc ff) { Byte *pp, pm, *mp, mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top ; yMask->GetScanLine(y)+(fd.rcBound.Left>>3); fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp = fd.M[0]+(fd.ptMask.x>>3); pm = 0x80>>(fd.rcBound.Left&7); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left ; xMaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK; } } if (pm==1) { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 pp++; pm = 0x80; //////adsfadsf_Variable_Checked } else { pm >>= 1; } if (mm==1) { mp++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX+(fd.rcBound.Left>>3),EndX-StartX+1); ////adsfadsf } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask2_24(TFillData &fd, TFillFunc ff) { Byte *pp[2], pm, *mp[2], mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top ; yMask->GetScanLine(y)+(fd.rcBound.Left>>3); fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); if (y+1Mask->GetScanLineN(y+1, 1)+(fd.rcBound.Left>>3); fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); } pm = 0x80>>(fd.rcBound.Left&7); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(0); if (x&1) { if (x+11) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm>>1;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~(pm>>1);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) |= 0x80;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) &= 0x7F;//////adsfadsf_Variable_Checked } } RESETMASK1(0); } } else { if (y+1MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(1); } } } } if (pm==1) { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 pp[0]++; pp[1]++; pm = 0x80; //////adsfadsf_Variable_Checked } else { pm >>= 1; } if (mm==1) { mp[0]++; mp[1]++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX+(fd.rcBound.Left>>3),EndX-StartX+1); ////adsfadsf if (y+1Mask->PutScanLineN(y+1,StartX+(fd.rcBound.Left>>3),EndX-StartX+1, 1); ////adsfadsf } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask3_24(TFillData &fd, TFillFunc ff) { Byte *pp[2], pm, *mp[2], mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top; yMask->GetScanLine(y)+(fd.rcBound.Left>>3); fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); if (y+1Mask->GetScanLineN(y+1, 1)+(fd.rcBound.Left>>3); fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); } pm = 0x80>>(fd.rcBound.Left&7); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(0); if (x+11) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm>>1;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~(pm>>1);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) |= 0x80;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) &= 0x7F;//////adsfadsf_Variable_Checked } } RESETMASK1(0); } if (y+1MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(1); } if (x+11) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] |= pm>>1;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] &= ~(pm>>1);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) |= 0x80;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) &= 0x7F;//////adsfadsf_Variable_Checked } } RESETMASK1(1); } } } if (pm==1) { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 pp[0]++; pp[1]++; pm = 0x80; //////adsfadsf_Variable_Checked } else { pm >>= 1; } if (mm==1) { mp[0]++; mp[1]++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX+(fd.rcBound.Left>>3),EndX-StartX+1); ////adsfadsf if (y+1Mask->PutScanLineN(y+1,StartX+(fd.rcBound.Left>>3),EndX-StartX+1, 1); ////adsfadsf } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask4_24(TFillData &fd, TFillFunc ff) { Byte *pp[3], pm, *mp[3], mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top; yMask->GetScanLine(y)+(fd.rcBound.Left>>3); fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); if (y+1Mask->GetScanLineN(y+1, 1)+(fd.rcBound.Left>>3); fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); } if (y+2Mask->GetScanLineN(y+2, 2)+(fd.rcBound.Left>>3); fd.M[2] = fd.Mask->ScanLine(y+2-fd.ptMask.y); mp[2] = fd.M[2]+(fd.ptMask.x>>3); } pm = 0x80>>(fd.rcBound.Left&7); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(0); if (x&1) { if (x+22) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm>>2;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~(pm>>2);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) |= 0x80>>(2-pm);//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) &= ~(0x80>>(2-pm));//////adsfadsf_Variable_Checked } } RESETMASK2(0); } if (x+22) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] |= pm>>2;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] &= ~(pm>>2);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) |= 0x80>>(2-pm);//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) &= ~(0x80>>(2-pm));//////adsfadsf_Variable_Checked } } RESETMASK2(1); } } else { if (y+2MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(2); } if (y+21) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] |= pm>>1;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] &= ~(pm>>1);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[2]+1) |= 0x80;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[2]+1) &= 0x7F;//////adsfadsf_Variable_Checked } } RESETMASK1(2); } } if (x+11) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm>>1;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~(pm>>1);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) |= 0x80;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) &= 0x7F;//////adsfadsf_Variable_Checked } } RESETMASK1(0); } if (y+1MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(1); } if (x+11) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] |= pm>>1;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] &= ~(pm>>1);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) |= 0x80;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) &= 0x7F;//////adsfadsf_Variable_Checked } } RESETMASK1(1); } } } if (pm==1) { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 pp[0]++; pp[1]++; pp[2]++; pm = 0x80; //////adsfadsf_Variable_Checked } else { pm >>= 1; } if (mm==1) { mp[0]++; mp[1]++; mp[2]++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX+(fd.rcBound.Left>>3),EndX-StartX+1); ////adsfadsf if (y+1Mask->PutScanLineN(y+1,StartX+(fd.rcBound.Left>>3),EndX-StartX+1, 1); ////adsfadsf } if (y+2Mask->PutScanLineN(y+2,StartX+(fd.rcBound.Left>>3),EndX-StartX+1, 2); ////adsfadsf } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::nozzlemask5_24(TFillData &fd, TFillFunc ff) { Byte *pp[3], pm, *mp[3], mm; TPItemImage *Image = MainImageForm->iMainImage; for (int y=fd.rcBound.Top; yMask->GetScanLine(y)+(fd.rcBound.Left>>3); fd.M[0] = fd.Mask->ScanLine(y-fd.ptMask.y); mp[0] = fd.M[0]+(fd.ptMask.x>>3); if (y+1Mask->GetScanLineN(y+1, 1)+(fd.rcBound.Left>>3); fd.M[1] = fd.Mask->ScanLine(y+1-fd.ptMask.y); mp[1] = fd.M[1]+(fd.ptMask.x>>3); } if (y+2Mask->GetScanLineN(y+2, 2)+(fd.rcBound.Left>>3); fd.M[2] = fd.Mask->ScanLine(y+2-fd.ptMask.y); mp[2] = fd.M[2]+(fd.ptMask.x>>3); } pm = 0x80>>(fd.rcBound.Left&7); mm = 0x80>>(fd.ptMask.x&7); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (int x=fd.rcBound.Left; xMaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(0); if (x+22) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] |= pm>>2;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] &= ~(pm>>2);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[2]+1) |= 0x80>>(2-pm);//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[2]+1) &= ~(0x80>>(2-pm));//////adsfadsf_Variable_Checked } } RESETMASK2(2); } if (x+22) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm>>2;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~(pm>>2);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) |= 0x80>>(2-pm);//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) &= ~(0x80>>(2-pm));//////adsfadsf_Variable_Checked } } RESETMASK2(0); } if (x+22) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] |= pm>>2;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] &= ~(pm>>2);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) |= 0x80>>(2-pm);//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) &= ~(0x80>>(2-pm));//////adsfadsf_Variable_Checked } } RESETMASK2(1); } if (y+2MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(2); } if (y+21) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] |= pm>>1;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[2] &= ~(pm>>1);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[2]+1) |= 0x80;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[2]+1) &= 0x7F;//////adsfadsf_Variable_Checked } } RESETMASK1(2); } if (x+11) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] |= pm>>1;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[0] &= ~(pm>>1);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) |= 0x80;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[0]+1) &= 0x7F;//////adsfadsf_Variable_Checked } } RESETMASK1(0); } if (y+1MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] |= pm;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] &= ~pm;//////adsfadsf_Variable_Checked } RESETMASK0(1); } if (x+11) { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] |= pm>>1;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *pp[1] &= ~(pm>>1);//////adsfadsf_Variable_Checked } } else { if (MainImageForm->MaskPixel){ if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) |= 0x80;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 *(pp[1]+1) &= 0x7F;//////adsfadsf_Variable_Checked } } RESETMASK1(1); } } } if (pm==1) { if(EndX==0){StartX=x;} EndX=x; //adsfadsf_i_f1 pp[0]++; pp[1]++; pp[2]++; pm = 0x80; //////adsfadsf_Variable_Checked } else { pm >>= 1; } if (mm==1) { mp[0]++; mp[1]++; mp[2]++; mm = 0x80; } else { mm >>= 1; } } Image->Mask->PutScanLine(y,StartX+(fd.rcBound.Left>>3),EndX-StartX+1); ////adsfadsf if (y+1Mask->PutScanLineN(y+1,StartX,EndX-StartX+1, 1); ////adsfadsf } if (y+2Mask->PutScanLineN(y+2,StartX,EndX-StartX+1, 2); ////adsfadsf } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::funcToMulti_24(TFillData &fd, int n, int x, int y) { COLORREF c; double h, l, s; // Byte *pp = fd.U[n]+3*x; Byte *pp = fd.U[n]+3*(x-S_LEFT); GetPixel24(pp, c); TColor2HLS((TColor) c, h, l, s); h += fd.h; if (h<0) h += 360.0; else if (h>=360.0) h -= 360.0; l += fd.l; if (l<0) l = 0.0; else if (l>=1.0) l = 1.0; s += fd.s; if (s<0) s = 0.0; else if (s>=1.0) s = 1.0; clFillData = HLS2TColor(h, l, s); } //--------------------------------------------------------------------------- void __fastcall TFillForm::funcNormalPattern_24(TFillData &fd, int n, int x, int y) { Byte *pp, *up; int px, py, ex, ey, r; COLORREF color, IC, WC, bgc; if (RepeatItem == 0) { if (y-fd.ey<0) { py = window.size.y+(y-fd.ey)%window.size.y; if (py>=window.size.y) py = 0; } else { py = (y-fd.ey)%window.size.y; } if (x-fd.ex<0) { px = window.size.x+(x-fd.ex)%window.size.x; if (px>=window.size.x) px = 0; } else { px = (x-fd.ex)%window.size.x; } } else if (RepeatItem == 1) { // Half Drop Vertical if (x-fd.ex<0) { px = window.size.x+(x-fd.ex)%window.size.x; if (px>=window.size.x) px = 0; r = ((fd.ex - x) / window.size.x) + 1; ey = fd.ey - r*half; } else { px = (x-fd.ex)%window.size.x; r = (x - fd.ex) / window.size.x; ey = fd.ey + r*half; } if (y-ey<0) { py = window.size.y+(y-ey)%window.size.y; if (py>=window.size.y) py = 0; } else { py = (y-ey)%window.size.y; } } else { // Half Drop Horizontal if (y-fd.ey<0) { py = window.size.y+(y-fd.ey)%window.size.y; if (py>=window.size.y) py = 0; r = ((fd.ey - y) / window.size.y) + 1; ex = fd.ex - r*half; } else { py = (y-fd.ey)%window.size.y; r = (y - fd.ey) / window.size.y; ex = fd.ex + r*half; } if (x-ex<0) { px = window.size.x+(x-ex)%window.size.x; if (px>=window.size.x) px = 0; } else { px = (x-ex)%window.size.x; } } pp = fd.Pattern->GetScanLine(py); pp += 3*px; GetPixel24(pp, clFillData); clLayerData = 0; switch (FullViewForm->Super) { case sNormal: if (clFillData==fd.clBack) { up = fd.U[n]+3*(x-S_LEFT); GetPixel24(up, clFillData); clLayerData = 0xFF; } break; case sGauze : if ((clFillData==fd.clBack) || ((x+y)&1)) { up = fd.U[n]+3*(x-S_LEFT); GetPixel24(up, clFillData); clLayerData = 0xFF; } break; case sOverlap : if ((clFillData==fd.clBack) || ((x+y)&1)) { up = fd.U[n]+3*(x-S_LEFT); GetPixel24(up, clFillData); clLayerData = 0xFF; } ///////////////////////////////////// //* up = fd.U[n]+3*(x-S_LEFT); GetPixel24(up, IC); GetPixel24(pp, WC); bgc = PaletteForm->DIB256Palette->GetBGCOLORREF(24); if(IC != bgc && WC != fd.clBack){ clFillData = MainImageForm->Overlap(IC, WC); } //*/ ///////////////////////////////////// break; } } //--------------------------------------------------------------------------- void __fastcall TFillForm::funcRotatePattern_24(TFillData &fd, int n, int x, int y) { int gap, gapx, gapy; Byte *pp, *up; Extended xc, xs, yc, ys; ys = (fillstart.y-y)*fd.st; yc = (fillstart.y-y)*fd.ct; xs = (fillstart.x-x)*fd.st; xc = (fillstart.x-x)*fd.ct; gap = (int)(-yc+xs-fd.ey)%window.size.y; if (gap<0) { gapy = window.size.y+gap; } else { gapy = gap; } gap = (int)(-xc-ys-fd.ex)%window.size.x; if (gap<0) { gapx = window.size.x+gap; } else { gapx = gap; } pp = fd.Pattern->GetScanLine(gapy)+3*gapx; GetPixel24(pp, clFillData); clLayerData = 0; switch (FullViewForm->Super) { case sNormal: if (clFillData==fd.clBack) { up = fd.U[n]+3*(x-S_LEFT); GetPixel24(up, clFillData); clLayerData = 0xFF; } break; case sGauze: if ((clFillData==fd.clBack) || ((x+y)&1)) { up = fd.U[n]+3*(x-S_LEFT); GetPixel24(up, clFillData); clLayerData = 0xFF; } break; case sOverlap: if ((clFillData==fd.clBack) || ((x+y)&1)) { up = fd.U[n]+3*(x-S_LEFT); GetPixel24(up, clFillData); clLayerData = 0xFF; } break; } } //--------------------------------------------------------------------------- void __fastcall TFillForm::Color_Fill(void) { //BeConverted by linuxjun Don't Forget!! Undo_Method TRect art, udrect; RECT rect; TFillData FillData; THistoryData *ud = NULL; int ec = EC_NONE; TPItemImage *Image = MainImageForm->iMainImage; #if !(defined(ACADEMY) || defined(KNIT)) TCaptureData *cd; #endif TCursor OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; FillData.Mask = NULL; FillData.size = Point(Image->uBitmap->Width, Image->uBitmap->Height); if (Image->uBitmap->BitsPerPixel==8) { FillData.clBack = (Byte) PaletteForm->DIB256Palette->GetBGCOLORREF(8); if ((FillData.Mask = new TPBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (MainImageForm->AutoRepeat && cbAutoRep->Checked && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { art = Rect(MainImageForm->arwindow.s.x, MainImageForm->arwindow.s.y, MainImageForm->arwindow.e.x, MainImageForm->arwindow.e.y); if ((fillstart.x>art.Left) && (fillstart.xart.Top) && (fillstart.yLayerMask) { if (Image->LayerMask->GetPixelColor(fillstart.x, fillstart.y)) { if (!Image->FloodFillMask(fillstart, fill_read_layer8_nonezero, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } else { if (!Image->FloodFillMask(fillstart, fill_read_layer8_zero, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } } else { if (!Image->uBitmap->FloodFillMask(fillstart, fill_read_none8, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } udrect = Rect(art.Left-MainImageForm->arwindow.size.x/2, art.Top-MainImageForm->arwindow.size.y/2, art.Right+MainImageForm->arwindow.size.x/2, art.Bottom+MainImageForm->arwindow.size.y/2); MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); S_LEFT = udrect.Left; S_TOP = udrect.Top; } else { delete FillData.Mask; Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(EC_INCORRECT_POINT); return; } } else { if (Image->LayerMask) { if (Image->LayerMask->GetPixelColor(fillstart.x, fillstart.y)) { if (!Image->FloodFillMask(fillstart, fill_read_layer8_nonezero, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } else { if (!Image->FloodFillMask(fillstart, fill_read_layer8_zero, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } } else { if (!Image->uBitmap->FloodFillMask(fillstart, fill_read_none8, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } udrect = Rect(FillData.rcBound.Left,FillData.rcBound.Top,FillData.rcBound.Right,FillData.rcBound.Bottom); // if(FillData.rcBound.Right-FillData.rcBound.Left==1&&FillData.rcBound.Bottom-FillData.rcBound.Top==1)return;//by jeegeo if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { rect = MainImageForm->AutoRep_UndoRect(udrect); udrect = rect; } // MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); //MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_REPEAT /*UK_PATTERN|UK_MASK*/: UK_PATTERN, udrect); //corrected for New Undo-Method MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_ALL /*UK_PATTERN|UK_MASK*/: UK_PATTERN, udrect); //corrected for New Undo-Method // S_LEFT = udrect.Left; // S_TOP = udrect.Top; S_LEFT = 0; //by linuxjun S_TOP = 0; //by linuxjun } if ((ud = MainImageForm->Undo->GetLast()) == NULL) { ec = EC_UNDO_NONE; goto fail; } FillData.undo = ud->uBitmap; //by linuxjun MainImageForm->iMainImage->uBitmap->PartialUndo->LoadLast(ud->FromRgb); if (!(Image->uBitmap->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (PenManagerForm->sbMask->Down) { if (!( Image->Mask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (!(MainImageForm->iMainImage->uBitmap->StartUndoScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (Image->LayerMask) { if (!(Image->LayerMask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (FillData.Mask->Lock() == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (changeto==TFT_SINGLE) { clFillData = clFillTo; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_8(FillData, NULL); else { switch (nozzle) { case 1: nozzlemask1_8(FillData, NULL); break; case 2: nozzlemask2_8(FillData, NULL); break; case 3: nozzlemask3_8(FillData, NULL); break; case 4: nozzlemask4_8(FillData, NULL); break; case 5: nozzlemask5_8(FillData, NULL); break; } } } else { if (air==false) normal_8(FillData, NULL); else { switch (nozzle) { case 1: nozzle1_8(FillData, NULL); break; case 2: nozzle2_8(FillData, NULL); break; case 3: nozzle3_8(FillData, NULL); break; case 4: nozzle4_8(FillData, NULL); break; case 5: nozzle5_8(FillData, NULL); break; } } } } else if (changeto==TFT_MULTI) { Byte f = PaletteForm->DIB256Palette->ChoiceIndex; // if ((mul_rgb.rgbRed!=MainImageForm->Palette->ColorData[f]->RGB.rgbRed) || // (mul_rgb.rgbGreen!=MainImageForm->Palette->ColorData[f]->RGB.rgbGreen) || // (mul_rgb.rgbBlue!=MainImageForm->Palette->ColorData[f]->RGB.rgbBlue)) { /////by jeegeo memset(ctable, 0, sizeof(ctable)); multifill_color_making(FillData.undo); mul_rgb = MainImageForm->Palette->ColorData[f]->RGB; // } if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_8(FillData, funcToMulti_8); else { switch (nozzle) { case 1: nozzlemask1_8(FillData, funcToMulti_8); break; case 2: nozzlemask2_8(FillData, funcToMulti_8); break; case 3: nozzlemask3_8(FillData, funcToMulti_8); break; case 4: nozzlemask4_8(FillData, funcToMulti_8); break; case 5: nozzlemask5_8(FillData, funcToMulti_8); break; } } } else { if (air==false) normal_8(FillData, funcToMulti_8); else { switch (nozzle) { case 1: nozzle1_8(FillData, funcToMulti_8); break; case 2: nozzle2_8(FillData, funcToMulti_8); break; case 3: nozzle3_8(FillData, funcToMulti_8); break; case 4: nozzle4_8(FillData, funcToMulti_8); break; case 5: nozzle5_8(FillData, funcToMulti_8); break; } } } } else if (changeto==TFT_NORMALP) { if (!(viewp->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; half = spRange->Value; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_8(FillData, funcNormalPattern_8); else { switch (nozzle) { case 1: nozzlemask1_8(FillData, funcNormalPattern_8); break; case 2: nozzlemask2_8(FillData, funcNormalPattern_8); break; case 3: nozzlemask3_8(FillData, funcNormalPattern_8); break; case 4: nozzlemask4_8(FillData, funcNormalPattern_8); break; case 5: nozzlemask5_8(FillData, funcNormalPattern_8); break; } } } else { if (air==false) normal_8(FillData, funcNormalPattern_8); else { switch (nozzle) { case 1: nozzle1_8(FillData, funcNormalPattern_8); break; case 2: nozzle2_8(FillData, funcNormalPattern_8); break; case 3: nozzle3_8(FillData, funcNormalPattern_8); break; case 4: nozzle4_8(FillData, funcNormalPattern_8); break; case 5: nozzle5_8(FillData, funcNormalPattern_8); break; } } } viewp->StopScanLine(); } else if (changeto==TFT_ROTATEP) { FillData.ex = pfpos.x; FillData.ey = pfpos.y; // FillData.ex = window.size.x/2.0; //by jeegeo // FillData.ey = window.size.y/2.0; Theta = 2*M_PI-Theta; FillData.ct = cos(Theta); FillData.st = sin(Theta); if(FillData.st==1 || FillData.st==-1){ FillData.ct=0; } if(FillData.ct==1 || FillData.ct==-1){ FillData.st=0; } if ((viewp->StartScanLine()) == false) goto fail; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_8(FillData, funcRotatePattern_8); else { switch (nozzle) { case 1: nozzlemask1_8(FillData, funcRotatePattern_8); break; case 2: nozzlemask2_8(FillData, funcRotatePattern_8); break; case 3: nozzlemask3_8(FillData, funcRotatePattern_8); break; case 4: nozzlemask4_8(FillData, funcRotatePattern_8); break; case 5: nozzlemask5_8(FillData, funcRotatePattern_8); break; } } } else { if (air==false) normal_8(FillData, funcRotatePattern_8); else { switch (nozzle) { case 1: nozzle1_8(FillData, funcRotatePattern_8); break; case 2: nozzle2_8(FillData, funcRotatePattern_8); break; case 3: nozzle3_8(FillData, funcRotatePattern_8); break; case 4: nozzle4_8(FillData, funcRotatePattern_8); break; case 5: nozzle5_8(FillData, funcRotatePattern_8); break; } } } viewp->StopScanLine(); } if (Image->LayerMask) Image->LayerMask->StopScanLine(); //FillData.undo->StopScanLine(); MainImageForm->iMainImage->uBitmap->StopUndoScanLine(); // MainImageForm->iMainImage->uBitmap->PartialUndo->LoadLast(ud->FromRgb); if (PenManagerForm->sbMask->Down) Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); // ud->Complete(); delete FillData.Mask; if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)){ if(cbAutoRep->Checked) SpreadArea(); else MainImageForm->RedrawingRepeat(false, false); } ::RepaintImage(); Screen->Cursor = OldCursor; } else { #if !(defined(ACADEMY) || defined(KNIT)) FillData.clBack = PaletteForm->DIB256Palette->GetBGCOLORREF(24); if ((FillData.Mask = new TPBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (MainImageForm->WorkArea->Mask && L_IsPtInBitmapRgn(Image->uBitmap->RgnBitmap->Handle, fillstart.y, fillstart.x)) { // convert by celberus FillData.rcBound = MainImageForm->WorkArea->Range; udrect = FillData.rcBound; if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { rect = MainImageForm->AutoRep_UndoRect(udrect); udrect = rect; } MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); // S_LEFT = udrect.Left; // S_TOP = udrect.Top; S_TOP = 0; S_LEFT = 0; if (!FillData.Mask->Create(FillData.rcBound.Right-FillData.rcBound.Left, FillData.rcBound.Bottom-FillData.rcBound.Top, 1)) { ec = EC_MEMORY_LACK; goto fail; } if ((FillData.Mask->Lock()) == NULL) { ec = EC_MEMORY_LACK; goto fail; } MainImageForm->WorkArea->Mask->SaveToMemory(FillData.Mask->ScanLine(), FillData.Mask->BytesPerLine); FillData.ptMask = Point(0, MainImageForm->WorkArea->Range.top); // if ((ud = Undo->Last) == NULL) { ec = EC_UNDO_NONE; goto fail; } if ((ud = MainImageForm->Undo->GetLast()) == NULL) { ec = EC_UNDO_NONE; goto fail; } FillData.undo = ud->uBitmap; MainImageForm->iMainImage->uBitmap->PartialUndo->LoadLast(ud->FromRgb); if (!(Image->uBitmap->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (PenManagerForm->sbMask->Down) { if (!(Image->Mask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (!(MainImageForm->iMainImage->uBitmap->StartUndoScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (Image->LayerMask) { if (!(Image->LayerMask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (changeto==TFT_SINGLE) { clFillData = clFillTo; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_24(FillData, NULL); else { switch (nozzle) { case 1: nozzlemask1_24(FillData, NULL); break; case 2: nozzlemask2_24(FillData, NULL); break; case 3: nozzlemask3_24(FillData, NULL); break; case 4: nozzlemask4_24(FillData, NULL); break; case 5: nozzlemask5_24(FillData, NULL); break; } } } else { if (air==false) normal_24(FillData, NULL); else { switch (nozzle) { case 1: nozzle1_24(FillData, NULL); break; case 2: nozzle2_24(FillData, NULL); break; case 3: nozzle3_24(FillData, NULL); break; case 4: nozzle4_24(FillData, NULL); break; case 5: nozzle5_24(FillData, NULL); break; } } } } else if (changeto==TFT_MULTI) { Byte *pp, *mp, mm; COLORREF c; double h, l, s, th = 0.0, tl = 0.0, ts = 0.0; int total = 0; for (int y=FillData.rcBound.Top; yuBitmap->GetScanLine(y)+3*FillData.rcBound.Left; mp = FillData.Mask->ScanLine(y-FillData.rcBound.Top); mm = 0x80; for (int x=FillData.rcBound.Left; x1) mm >>= 1; else { mp++; mm = 0x80; } } } th /= total; tl /= total; ts /= total; c = PaletteForm->DIB256Palette->GetFGCOLORREF(24); TColor2HLS((TColor) c, h, l, s); FillData.h = h-th; FillData.l = l-tl; FillData.s = s-ts; if (air==false) normal_24(FillData, funcToMulti_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcToMulti_24); break; case 2: nozzle2_24(FillData, funcToMulti_24); break; case 3: nozzle3_24(FillData, funcToMulti_24); break; case 4: nozzle4_24(FillData, funcToMulti_24); break; case 5: nozzle5_24(FillData, funcToMulti_24); break; } } } else if (changeto==TFT_NORMALP) { if (bExp) { FillData.Pattern = viewp; } else { cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; FillData.Pattern = cd->Bitmap; } if (!(FillData.Pattern->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; half = spRange->Value; if (air==false) normal_24(FillData, funcNormalPattern_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcNormalPattern_24); break; case 2: nozzle2_24(FillData, funcNormalPattern_24); break; case 3: nozzle3_24(FillData, funcNormalPattern_24); break; case 4: nozzle4_24(FillData, funcNormalPattern_24); break; case 5: nozzle5_24(FillData, funcNormalPattern_24); break; } } FillData.Pattern->StopScanLine(); } else if (changeto==TFT_ROTATEP) { if (bExp) { FillData.Pattern = viewp; } else { cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; FillData.Pattern = cd->Bitmap; } if (!(FillData.Pattern->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; // FillData.ex = window.size.x/2.0; //by jeegeo // FillData.ey = window.size.y/2.0; Theta = 2*M_PI-Theta; FillData.ct = cos(Theta); FillData.st = sin(Theta); if (air==false) normal_24(FillData, funcRotatePattern_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcRotatePattern_24); break; case 2: nozzle2_24(FillData, funcRotatePattern_24); break; case 3: nozzle3_24(FillData, funcRotatePattern_24); break; case 4: nozzle4_24(FillData, funcRotatePattern_24); break; case 5: nozzle5_24(FillData, funcRotatePattern_24); break; } } FillData.Pattern->StopScanLine(); } if (Image->LayerMask) Image->LayerMask->StopScanLine(); //FillData.undo->StopScanLine(); MainImageForm->iMainImage->uBitmap->StopUndoScanLine(); if (PenManagerForm->sbMask->Down) Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); // ud->Complete(); } else { clFillFrom = Image->uBitmap->GetPixelColor(fillstart.x, fillstart.y); if (MainImageForm->AutoRepeat && cbAutoRep->Checked && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { art = Rect(MainImageForm->arwindow.s.x, MainImageForm->arwindow.s.y, MainImageForm->arwindow.e.x, MainImageForm->arwindow.e.y); if ((fillstart.x>art.Left) && (fillstart.xart.Top) && (fillstart.yLayerMask) { if (Image->LayerMask->GetPixelColor(fillstart.x, fillstart.y)) { if (!Image->FloodFillMask(fillstart, fill_read_layer24_nonezero, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } else { if (!Image->FloodFillMask(fillstart, fill_read_layer24_zero, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } } else { if (!Image->uBitmap->FloodFillMask(fillstart, fill_read_none24, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } udrect = Rect(art.Left-MainImageForm->arwindow.size.x/2, art.Top-MainImageForm->arwindow.size.y/2, art.Right+MainImageForm->arwindow.size.x/2, art.Bottom+MainImageForm->arwindow.size.y/2); MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); // S_LEFT = udrect.Left; // S_TOP = udrect.Top; S_TOP = 0; S_LEFT = 0; } else { delete FillData.Mask; Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(EC_INCORRECT_POINT); return; } } else { if (Image->LayerMask) { if (Image->LayerMask->GetPixelColor(fillstart.x, fillstart.y)) { if (!Image->FloodFillMask(fillstart, fill_read_layer24_nonezero, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } else { if (!Image->FloodFillMask(fillstart, fill_read_layer24_zero, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } } else { if (!Image->uBitmap->FloodFillMask(fillstart, fill_read_none24, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } udrect = Rect(FillData.rcBound.Left,FillData.rcBound.Top,FillData.rcBound.Right,FillData.rcBound.Bottom); if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { rect = MainImageForm->AutoRep_UndoRect(udrect); udrect = rect; } MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); // S_LEFT = udrect.Left; // S_TOP = udrect.Top; S_LEFT = 0; S_TOP = 0; } FillData.ptMask = Point(FillData.rcBound.Left, 0); // ud = Undo->Last; ud = MainImageForm->Undo->GetLast(); if (ud==NULL) { ec = EC_UNDO_NONE; goto fail; } FillData.undo = ud->uBitmap; MainImageForm->iMainImage->uBitmap->PartialUndo->LoadLast(ud->FromRgb); if (!(Image->uBitmap->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (PenManagerForm->sbMask->Down) { if (!(Image->Mask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (!(MainImageForm->iMainImage->uBitmap->StartUndoScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if ((FillData.Mask->Lock()) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (Image->LayerMask) { if (!(Image->LayerMask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (changeto==TFT_SINGLE) { clFillData = clFillTo; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_24(FillData, NULL); else { switch (nozzle) { case 1: nozzlemask1_24(FillData, NULL); break; case 2: nozzlemask2_24(FillData, NULL); break; case 3: nozzlemask3_24(FillData, NULL); break; case 4: nozzlemask4_24(FillData, NULL); break; case 5: nozzlemask5_24(FillData, NULL); break; } } } else { if (air==false) normal_24(FillData, NULL); else { switch (nozzle) { case 1: nozzle1_24(FillData, NULL); break; case 2: nozzle2_24(FillData, NULL); break; case 3: nozzle3_24(FillData, NULL); break; case 4: nozzle4_24(FillData, NULL); break; case 5: nozzle5_24(FillData, NULL); break; } } } } else if (changeto==TFT_NORMALP) { if (bExp) { FillData.Pattern = viewp; } else { cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; FillData.Pattern = cd->Bitmap; } if (!(FillData.Pattern->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; half = spRange->Value; if (air==false) normal_24(FillData, funcNormalPattern_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcNormalPattern_24); break; case 2: nozzle2_24(FillData, funcNormalPattern_24); break; case 3: nozzle3_24(FillData, funcNormalPattern_24); break; case 4: nozzle4_24(FillData, funcNormalPattern_24); break; case 5: nozzle5_24(FillData, funcNormalPattern_24); break; } } FillData.Pattern->StopScanLine(); } else if (changeto==TFT_ROTATEP) { if (bExp) { FillData.Pattern = viewp; } else { cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; FillData.Pattern = cd->Bitmap; } if (!(FillData.Pattern->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; // FillData.ex = window.size.x/2.0; // by jeegeo // FillData.ey = window.size.y/2.0; Theta = 2*M_PI-Theta; FillData.ct = cos(Theta); FillData.st = sin(Theta); if (air==false) normal_24(FillData, funcRotatePattern_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcRotatePattern_24); break; case 2: nozzle2_24(FillData, funcRotatePattern_24); break; case 3: nozzle3_24(FillData, funcRotatePattern_24); break; case 4: nozzle4_24(FillData, funcRotatePattern_24); break; case 5: nozzle5_24(FillData, funcRotatePattern_24); break; } } FillData.Pattern->StopScanLine(); } if (Image->LayerMask) Image->LayerMask->StopScanLine(); //FillData.undo->StopScanLine(); MainImageForm->iMainImage->uBitmap->StopUndoScanLine(); if (PenManagerForm->sbMask->Down) Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); // ud->Complete(); } delete FillData.Mask; #endif } if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)){ if(cbAutoRep->Checked) SpreadArea(); else MainImageForm->RedrawingRepeat(false, false); } ::RepaintImage(); Screen->Cursor = OldCursor; return; fail: if (Image->LayerMask) Image->LayerMask->StopScanLine(); //FillData.undo->StopScanLine(); MainImageForm->iMainImage->uBitmap->StopUndoScanLine(); if (PenManagerForm->sbMask->Down) Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); #if !(defined(ACADEMY) || defined(KNIT)) if (FillData.Mask) { if (changeto==TFT_ROTATEP) { if( FillData.Pattern) FillData.Pattern->StopScanLine(); } FillData.Mask->Unlock(); delete FillData.Mask; } #endif Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(ec); // */ /* //BeConverted by linuxjun Don't Forget!! Undo_Method TRect art, udrect; RECT rect; TFillData FillData; THistoryData *ud = NULL; int ec = EC_NONE; TPItemImage *Image = MainImageForm->iMainImage; #if !(defined(ACADEMY) || defined(KNIT)) TCaptureData *cd; #endif TCursor OldCursor = Screen->Cursor; Screen->Cursor = crHourGlass; FillData.Mask = NULL; FillData.size = Point(Image->uBitmap->Width, Image->uBitmap->Height); if (Image->uBitmap->BitsPerPixel==8) { FillData.clBack = (Byte) PaletteForm->DIB256Palette->GetBGCOLORREF(8); if ((FillData.Mask = new TPBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (MainImageForm->AutoRepeat && cbAutoRep->Checked && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { art = Rect(MainImageForm->arwindow.s.x, MainImageForm->arwindow.s.y, MainImageForm->arwindow.e.x, MainImageForm->arwindow.e.y); if ((fillstart.x>art.Left) && (fillstart.xart.Top) && (fillstart.yLayerMask) { if (Image->LayerMask->GetPixelColor(fillstart.x, fillstart.y)) { if (!Image->FloodFillMask(fillstart, fill_read_layer8_nonezero, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } else { if (!Image->FloodFillMask(fillstart, fill_read_layer8_zero, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } } else { if (!Image->uBitmap->FloodFillMask(fillstart, fill_read_none8, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } udrect = Rect(art.Left-MainImageForm->arwindow.size.x/2, art.Top-MainImageForm->arwindow.size.y/2, art.Right+MainImageForm->arwindow.size.x/2, art.Bottom+MainImageForm->arwindow.size.y/2); MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); S_LEFT = udrect.Left; S_TOP = udrect.Top; } else { delete FillData.Mask; Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(EC_INCORRECT_POINT); return; } } else { if (Image->LayerMask) { if (Image->LayerMask->GetPixelColor(fillstart.x, fillstart.y)) { if (!Image->FloodFillMask(fillstart, fill_read_layer8_nonezero, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } else { if (!Image->FloodFillMask(fillstart, fill_read_layer8_zero, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } } else { if (!Image->uBitmap->FloodFillMask(fillstart, fill_read_none8, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } udrect = Rect(FillData.rcBound.Left,FillData.rcBound.Top,FillData.rcBound.Right,FillData.rcBound.Bottom); // if(FillData.rcBound.Right-FillData.rcBound.Left==1&&FillData.rcBound.Bottom-FillData.rcBound.Top==1)return;//by jeegeo if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { rect = MainImageForm->AutoRep_UndoRect(udrect); udrect = rect; } MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); S_LEFT = udrect.Left; S_TOP = udrect.Top; } if ((ud = Undo->Last) == NULL) { ec = EC_UNDO_NONE; goto fail; } FillData.undo = ud->Bitmap; if (!(Image->uBitmap->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (PenManagerForm->sbMask->Down) { if (!( Image->Mask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (!(FillData.undo->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (Image->LayerMask) { if (!(Image->LayerMask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (FillData.Mask->Lock() == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (changeto==TFT_SINGLE) { clFillData = clFillTo; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_8(FillData, NULL); else { switch (nozzle) { case 1: nozzlemask1_8(FillData, NULL); break; case 2: nozzlemask2_8(FillData, NULL); break; case 3: nozzlemask3_8(FillData, NULL); break; case 4: nozzlemask4_8(FillData, NULL); break; case 5: nozzlemask5_8(FillData, NULL); break; } } } else { if (air==false) normal_8(FillData, NULL); else { switch (nozzle) { case 1: nozzle1_8(FillData, NULL); break; case 2: nozzle2_8(FillData, NULL); break; case 3: nozzle3_8(FillData, NULL); break; case 4: nozzle4_8(FillData, NULL); break; case 5: nozzle5_8(FillData, NULL); break; } } } } else if (changeto==TFT_MULTI) { Byte f = PaletteForm->DIB256Palette->ChoiceIndex; // if ((mul_rgb.rgbRed!=MainImageForm->Palette->ColorData[f]->RGB.rgbRed) || // (mul_rgb.rgbGreen!=MainImageForm->Palette->ColorData[f]->RGB.rgbGreen) || // (mul_rgb.rgbBlue!=MainImageForm->Palette->ColorData[f]->RGB.rgbBlue)) { /////by jeegeo memset(ctable, 0, sizeof(ctable)); multifill_color_making(FillData.undo); mul_rgb = MainImageForm->Palette->ColorData[f]->RGB; // } if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_8(FillData, funcToMulti_8); else { switch (nozzle) { case 1: nozzlemask1_8(FillData, funcToMulti_8); break; case 2: nozzlemask2_8(FillData, funcToMulti_8); break; case 3: nozzlemask3_8(FillData, funcToMulti_8); break; case 4: nozzlemask4_8(FillData, funcToMulti_8); break; case 5: nozzlemask5_8(FillData, funcToMulti_8); break; } } } else { if (air==false) normal_8(FillData, funcToMulti_8); else { switch (nozzle) { case 1: nozzle1_8(FillData, funcToMulti_8); break; case 2: nozzle2_8(FillData, funcToMulti_8); break; case 3: nozzle3_8(FillData, funcToMulti_8); break; case 4: nozzle4_8(FillData, funcToMulti_8); break; case 5: nozzle5_8(FillData, funcToMulti_8); break; } } } } else if (changeto==TFT_NORMALP) { if (!(viewp->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; half = spRange->Value; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_8(FillData, funcNormalPattern_8); else { switch (nozzle) { case 1: nozzlemask1_8(FillData, funcNormalPattern_8); break; case 2: nozzlemask2_8(FillData, funcNormalPattern_8); break; case 3: nozzlemask3_8(FillData, funcNormalPattern_8); break; case 4: nozzlemask4_8(FillData, funcNormalPattern_8); break; case 5: nozzlemask5_8(FillData, funcNormalPattern_8); break; } } } else { if (air==false) normal_8(FillData, funcNormalPattern_8); else { switch (nozzle) { case 1: nozzle1_8(FillData, funcNormalPattern_8); break; case 2: nozzle2_8(FillData, funcNormalPattern_8); break; case 3: nozzle3_8(FillData, funcNormalPattern_8); break; case 4: nozzle4_8(FillData, funcNormalPattern_8); break; case 5: nozzle5_8(FillData, funcNormalPattern_8); break; } } } viewp->StopScanLine(); } else if (changeto==TFT_ROTATEP) { FillData.ex = pfpos.x; FillData.ey = pfpos.y; // FillData.ex = window.size.x/2.0; //by jeegeo // FillData.ey = window.size.y/2.0; Theta = 2*M_PI-Theta; FillData.ct = cos(Theta); FillData.st = sin(Theta); if ((viewp->StartScanLine()) == false) goto fail; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_8(FillData, funcRotatePattern_8); else { switch (nozzle) { case 1: nozzlemask1_8(FillData, funcRotatePattern_8); break; case 2: nozzlemask2_8(FillData, funcRotatePattern_8); break; case 3: nozzlemask3_8(FillData, funcRotatePattern_8); break; case 4: nozzlemask4_8(FillData, funcRotatePattern_8); break; case 5: nozzlemask5_8(FillData, funcRotatePattern_8); break; } } } else { if (air==false) normal_8(FillData, funcRotatePattern_8); else { switch (nozzle) { case 1: nozzle1_8(FillData, funcRotatePattern_8); break; case 2: nozzle2_8(FillData, funcRotatePattern_8); break; case 3: nozzle3_8(FillData, funcRotatePattern_8); break; case 4: nozzle4_8(FillData, funcRotatePattern_8); break; case 5: nozzle5_8(FillData, funcRotatePattern_8); break; } } } viewp->StopScanLine(); } if (Image->LayerMask) Image->LayerMask->StopScanLine(); FillData.undo->StopScanLine(); if (PenManagerForm->sbMask->Down) Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); ud->Complete(); delete FillData.Mask; if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)){ if(cbAutoRep->Checked) SpreadArea(); else MainImageForm->RedrawingRepeat(false, false); } ::RepaintImage(); Screen->Cursor = OldCursor; } else { #if !(defined(ACADEMY) || defined(KNIT)) FillData.clBack = PaletteForm->DIB256Palette->GetBGCOLORREF(24); if ((FillData.Mask = new TPBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (MainImageForm->WorkArea->Mask && L_IsPtInBitmapRgn(Image->uBitmap->RgnBitmap->Handle, fillstart.y, fillstart.x)) { // convert by celberus FillData.rcBound = MainImageForm->WorkArea->Range; udrect = FillData.rcBound; if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { rect = MainImageForm->AutoRep_UndoRect(udrect); udrect = rect; } MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); S_LEFT = udrect.Left; S_TOP = udrect.Top; if (!FillData.Mask->Create(FillData.rcBound.Right-FillData.rcBound.Left, FillData.rcBound.Bottom-FillData.rcBound.Top, 1)) { ec = EC_MEMORY_LACK; goto fail; } if ((FillData.Mask->Lock()) == NULL) { ec = EC_MEMORY_LACK; goto fail; } MainImageForm->WorkArea->Mask->SaveToMemory(FillData.Mask->ScanLine(), FillData.Mask->BytesPerLine); FillData.ptMask = Point(0, MainImageForm->WorkArea->Range.top); if ((ud = Undo->Last) == NULL) { ec = EC_UNDO_NONE; goto fail; } FillData.undo = ud->Bitmap; if (!(Image->uBitmap->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (PenManagerForm->sbMask->Down) { if (!(Image->Mask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (!(FillData.undo->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (Image->LayerMask) { if (!(Image->LayerMask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (changeto==TFT_SINGLE) { clFillData = clFillTo; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_24(FillData, NULL); else { switch (nozzle) { case 1: nozzlemask1_24(FillData, NULL); break; case 2: nozzlemask2_24(FillData, NULL); break; case 3: nozzlemask3_24(FillData, NULL); break; case 4: nozzlemask4_24(FillData, NULL); break; case 5: nozzlemask5_24(FillData, NULL); break; } } } else { if (air==false) normal_24(FillData, NULL); else { switch (nozzle) { case 1: nozzle1_24(FillData, NULL); break; case 2: nozzle2_24(FillData, NULL); break; case 3: nozzle3_24(FillData, NULL); break; case 4: nozzle4_24(FillData, NULL); break; case 5: nozzle5_24(FillData, NULL); break; } } } } else if (changeto==TFT_MULTI) { Byte *pp, *mp, mm; COLORREF c; double h, l, s, th = 0.0, tl = 0.0, ts = 0.0; int total = 0; for (int y=FillData.rcBound.Top; yuBitmap->GetScanLine(y)+3*FillData.rcBound.Left; mp = FillData.Mask->ScanLine(y-FillData.rcBound.Top); mm = 0x80; for (int x=FillData.rcBound.Left; x1) mm >>= 1; else { mp++; mm = 0x80; } } } th /= total; tl /= total; ts /= total; c = PaletteForm->DIB256Palette->GetFGCOLORREF(24); TColor2HLS((TColor) c, h, l, s); FillData.h = h-th; FillData.l = l-tl; FillData.s = s-ts; if (air==false) normal_24(FillData, funcToMulti_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcToMulti_24); break; case 2: nozzle2_24(FillData, funcToMulti_24); break; case 3: nozzle3_24(FillData, funcToMulti_24); break; case 4: nozzle4_24(FillData, funcToMulti_24); break; case 5: nozzle5_24(FillData, funcToMulti_24); break; } } } else if (changeto==TFT_NORMALP) { if (bExp) { FillData.Pattern = viewp; } else { cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; FillData.Pattern = cd->Bitmap; } if (!(FillData.Pattern->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; half = spRange->Value; if (air==false) normal_24(FillData, funcNormalPattern_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcNormalPattern_24); break; case 2: nozzle2_24(FillData, funcNormalPattern_24); break; case 3: nozzle3_24(FillData, funcNormalPattern_24); break; case 4: nozzle4_24(FillData, funcNormalPattern_24); break; case 5: nozzle5_24(FillData, funcNormalPattern_24); break; } } FillData.Pattern->StopScanLine(); } else if (changeto==TFT_ROTATEP) { if (bExp) { FillData.Pattern = viewp; } else { cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; FillData.Pattern = cd->Bitmap; } if (!(FillData.Pattern->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; // FillData.ex = window.size.x/2.0; //by jeegeo // FillData.ey = window.size.y/2.0; Theta = 2*M_PI-Theta; FillData.ct = cos(Theta); FillData.st = sin(Theta); if (air==false) normal_24(FillData, funcRotatePattern_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcRotatePattern_24); break; case 2: nozzle2_24(FillData, funcRotatePattern_24); break; case 3: nozzle3_24(FillData, funcRotatePattern_24); break; case 4: nozzle4_24(FillData, funcRotatePattern_24); break; case 5: nozzle5_24(FillData, funcRotatePattern_24); break; } } FillData.Pattern->StopScanLine(); } if (Image->LayerMask) Image->LayerMask->StopScanLine(); FillData.undo->StopScanLine(); if (PenManagerForm->sbMask->Down) Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); ud->Complete(); } else { clFillFrom = Image->uBitmap->GetPixelColor(fillstart.x, fillstart.y); if (MainImageForm->AutoRepeat && cbAutoRep->Checked && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { art = Rect(MainImageForm->arwindow.s.x, MainImageForm->arwindow.s.y, MainImageForm->arwindow.e.x, MainImageForm->arwindow.e.y); if ((fillstart.x>art.Left) && (fillstart.xart.Top) && (fillstart.yLayerMask) { if (Image->LayerMask->GetPixelColor(fillstart.x, fillstart.y)) { if (!Image->FloodFillMask(fillstart, fill_read_layer24_nonezero, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } else { if (!Image->FloodFillMask(fillstart, fill_read_layer24_zero, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } } else { if (!Image->uBitmap->FloodFillMask(fillstart, fill_read_none24, NULL, FillData.rcBound, FillData.Mask, &art)) { ec = EC_MEMORY_LACK; goto fail; } } udrect = Rect(art.Left-MainImageForm->arwindow.size.x/2, art.Top-MainImageForm->arwindow.size.y/2, art.Right+MainImageForm->arwindow.size.x/2, art.Bottom+MainImageForm->arwindow.size.y/2); MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); S_LEFT = udrect.Left; S_TOP = udrect.Top; } else { delete FillData.Mask; Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(EC_INCORRECT_POINT); return; } } else { if (Image->LayerMask) { if (Image->LayerMask->GetPixelColor(fillstart.x, fillstart.y)) { if (!Image->FloodFillMask(fillstart, fill_read_layer24_nonezero, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } else { if (!Image->FloodFillMask(fillstart, fill_read_layer24_zero, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } } else { if (!Image->uBitmap->FloodFillMask(fillstart, fill_read_none24, NULL, FillData.rcBound, FillData.Mask)) { ec = EC_MEMORY_LACK; goto fail; } } udrect = Rect(FillData.rcBound.Left,FillData.rcBound.Top,FillData.rcBound.Right,FillData.rcBound.Bottom); if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) { rect = MainImageForm->AutoRep_UndoRect(udrect); udrect = rect; } MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, udrect); S_LEFT = udrect.Left; S_TOP = udrect.Top; } FillData.ptMask = Point(FillData.rcBound.Left, 0); ud = Undo->Last; if (ud==NULL) { ec = EC_UNDO_NONE; goto fail; } FillData.undo = ud->Bitmap; if (!(Image->uBitmap->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if (PenManagerForm->sbMask->Down) { if (!(Image->Mask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (!(FillData.undo->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } if ((FillData.Mask->Lock()) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (Image->LayerMask) { if (!(Image->LayerMask->StartScanLineN(3))) { ec = EC_MEMORY_LACK; goto fail; } } if (changeto==TFT_SINGLE) { clFillData = clFillTo; if (PenManagerForm->sbMask->Down) { if (air==false) normalmask_24(FillData, NULL); else { switch (nozzle) { case 1: nozzlemask1_24(FillData, NULL); break; case 2: nozzlemask2_24(FillData, NULL); break; case 3: nozzlemask3_24(FillData, NULL); break; case 4: nozzlemask4_24(FillData, NULL); break; case 5: nozzlemask5_24(FillData, NULL); break; } } } else { if (air==false) normal_24(FillData, NULL); else { switch (nozzle) { case 1: nozzle1_24(FillData, NULL); break; case 2: nozzle2_24(FillData, NULL); break; case 3: nozzle3_24(FillData, NULL); break; case 4: nozzle4_24(FillData, NULL); break; case 5: nozzle5_24(FillData, NULL); break; } } } } else if (changeto==TFT_NORMALP) { if (bExp) { FillData.Pattern = viewp; } else { cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; FillData.Pattern = cd->Bitmap; } if (!(FillData.Pattern->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; half = spRange->Value; if (air==false) normal_24(FillData, funcNormalPattern_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcNormalPattern_24); break; case 2: nozzle2_24(FillData, funcNormalPattern_24); break; case 3: nozzle3_24(FillData, funcNormalPattern_24); break; case 4: nozzle4_24(FillData, funcNormalPattern_24); break; case 5: nozzle5_24(FillData, funcNormalPattern_24); break; } } FillData.Pattern->StopScanLine(); } else if (changeto==TFT_ROTATEP) { if (bExp) { FillData.Pattern = viewp; } else { cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; FillData.Pattern = cd->Bitmap; } if (!(FillData.Pattern->StartScanLine())) { ec = EC_MEMORY_LACK; goto fail; } FillData.ex = pfpos.x; FillData.ey = pfpos.y; // FillData.ex = window.size.x/2.0; // by jeegeo // FillData.ey = window.size.y/2.0; Theta = 2*M_PI-Theta; FillData.ct = cos(Theta); FillData.st = sin(Theta); if (air==false) normal_24(FillData, funcRotatePattern_24); else { switch (nozzle) { case 1: nozzle1_24(FillData, funcRotatePattern_24); break; case 2: nozzle2_24(FillData, funcRotatePattern_24); break; case 3: nozzle3_24(FillData, funcRotatePattern_24); break; case 4: nozzle4_24(FillData, funcRotatePattern_24); break; case 5: nozzle5_24(FillData, funcRotatePattern_24); break; } } FillData.Pattern->StopScanLine(); } if (Image->LayerMask) Image->LayerMask->StopScanLine(); FillData.undo->StopScanLine(); if (PenManagerForm->sbMask->Down) Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); ud->Complete(); } delete FillData.Mask; #endif } if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)){ if(cbAutoRep->Checked) SpreadArea(); else MainImageForm->RedrawingRepeat(false, false); } ::RepaintImage(); Screen->Cursor = OldCursor; return; fail: if (Image->LayerMask) Image->LayerMask->StopScanLine(); FillData.undo->StopScanLine(); if (PenManagerForm->sbMask->Down) Image->Mask->StopScanLine(); Image->uBitmap->StopScanLine(); #if !(defined(ACADEMY) || defined(KNIT)) if (FillData.Mask) { if (changeto==TFT_ROTATEP) { if( FillData.Pattern) FillData.Pattern->StopScanLine(); } FillData.Mask->Unlock(); delete FillData.Mask; } #endif Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(ec); */ } //--------------------------------------------------------------------------- void __fastcall TFillForm::CommonMouseMove(int X, int Y) { TPItemImage *Image = MainImageForm->iMainImage; // HDC backDC = NULL, /*imageDC = NULL, */maskDC = NULL/*, fillDC = NULL, fmask = NULL, // bitmapDC = NULL*/; // convert by celberus TPoint size = Point(Image->SubBitmap->Width, Image->SubBitmap->Height); FillRect.Left = X; FillRect.Top = Y; FillRect.Right = FillRect.Left + size.x; FillRect.Bottom = FillRect.Top + size.y; Image->SubRange = (RECT) FillRect; // if ((backDC = window.Back->CreateDC()) == NULL) goto fail; // if ((imageDC = Image->uBitmap->CreateDC()) == NULL) goto fail; convert by celberus // BitBlt(backDC, 0, 0, size.x, size.y, imageDC, FillRect.Left, FillRect.Top, SRCCOPY); window.Back->Copy(0, 0, size.x, size.y, Image->uBitmap, FillRect.Left, FillRect.Top, SRCCOPY); // convert by celberus // Image->uBitmap->UnionBitBlt(backDC, 0, 0, size.x, size.y, FillRect.Left, FillRect.Top, SRCCOPY, false); // convert by celberus // Image->uBitmap->DeleteDC(imageDC); imageDC = NULL; convert by celberus // if ((maskDC = window.Mask->CreateDC()) == NULL) goto fail; // BitBlt(backDC, 0, 0, size.x, size.y, maskDC, 0, 0, SRCAND); window.Back->Copy(0, 0, size.x, size.y, window.Mask, 0, 0, SRCAND); // convert by celberus // if ((fmask = Image->SubMask->CreateDC()) == NULL) goto fail; // BitBlt(fmask, 0, 0, size.x, size.y, maskDC, 0, 0, SRCCOPY); // Image->SubMask->UnionBitBlt(maskDC, 0, 0, size.x, size.y, 0, 0, SRCCOPY, true); // convert by celberus Image->SubMask->Copy(0, 0, size.x, size.y, window.Mask, 0, 0, SRCCOPY); // convert by celberus // Image->SubMask->DeleteDC(fmask); // window.Mask->DeleteDC(maskDC); maskDC = NULL; // if ((fillDC = Image->SubBitmap->CreateDC()) == NULL) goto fail; convert by celberus // if ((bitmapDC = window.Bitmap->CreateDC()) == NULL) goto fail; convert by celberus // BitBlt(fillDC, 0, 0, size.x, size.y, bitmapDC, 0, 0, SRCCOPY); Image->SubBitmap->Copy(0, 0, size.x, size.y, window.Bitmap, 0, 0, SRCCOPY); // convert by celberus // window.Bitmap->DeleteDC(bitmapDC); convert by celberus // BitBlt(fillDC, 0, 0, size.x, size.y, backDC, 0, 0, SRCPAINT); // Image->SubBitmap->UnionBitBlt(backDC, 0, 0, size.x, size.y, 0, 0, SRCPAINT, true); // convert by celberus Image->SubBitmap->Copy(0, 0, size.x, size.y, window.Back, 0, 0, SRCPAINT); // convert by celberus // Image->SubBitmap->DeleteDC(fillDC); convert by celberus // window.Back->DeleteDC(backDC); ImageRectPaint(); return; fail: // if (backDC) { // if (fillDC) { // if (bitmapDC) window.Bitmap->DeleteDC(bitmapDC); // Image->SubBitmap->DeleteDC(fillDC); // } convert by celberus // if (maskDC) window.Mask->DeleteDC(maskDC); // if (fmask) Image->SubMask->DeleteDC(fmask); // if (imageDC) Image->uBitmap->DeleteDC(imageDC); convert by celberus // window.Back->DeleteDC(backDC); // } EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //--------------------------------------------------------------------------- void __fastcall TFillForm::MakeFillImage(int deg) { int i, j; Byte *IP, *WP, *MP, mm; COLORREF crrf, fcol, bgc; HDC FhDC = NULL; TPoint size; deg = 360 - deg; TUnionBitmap *TempBitmap = NULL; // convert by celberus TPItemImage *Image = MainImageForm->iMainImage; if ((TempBitmap = new TUnionBitmap) == NULL) goto fail; // convert by celberus if (Image->uBitmap->BitsPerPixel == 8) { if (!(TempBitmap->Create(window.size.x, window.size.y, 8, rgb))) goto fail; if (bExp) { TempBitmap->UnionStretchBlt(0, 0, window.size.x, window.size.y, Image->uBitmap, source.Left, source.Top, source.Right - source.Left, source.Bottom - source.Top, SRCCOPY); // convert by celberus } else { TempBitmap->CopyFromRect(Image->uBitmap, window.s.x, window.s.y, SRCCOPY); } TempBitmap->Rotate(deg*100, true, PALETTEINDEX(0)); size = Point(TempBitmap->Width, TempBitmap->Height); if (bExp) { if (!(Expbmp->Create(size.x, size.y, 8, rgb))) goto fail; if ((FhDC = Expbmp->CreateDC()) == NULL) goto fail; TempBitmap->UnionBitBlt(FhDC, 0, 0, size.x, size.y, 0, 0, SRCCOPY, false); // convert by celberus Expbmp->DeleteDC(FhDC); FhDC = NULL; } if (!(Image->SubBitmap->Create(size.x, size.y, 8, rgb))) goto fail; if (!(Image->SubMask->Create(size.x, size.y, 8, rgb))) goto fail; if (!(window.Bitmap->Create(size.x, size.y, 8, rgb))) goto fail; if (!(window.Mask->Create(size.x, size.y, 8, rgb))) goto fail; if (!(window.Back->Create(size.x, size.y, 8, rgb))) goto fail; if (!(TempBitmap->StartScanLine())) goto fail; if (!(window.Bitmap->StartScanLine())) goto fail; if (!(window.Mask->StartScanLine())) goto fail; if (FullViewForm->Super == sOff) { for (i=0; iHeight; i++) { IP = TempBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (j=0; jWidth; j++, IP++, WP++, MP++) { //////adsfadsf_for if (*IP) { if ((j+i) % 3) { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = *IP;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = 0;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0xFF;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = 0; *MP = 0xFF;//////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } } else { for (i=0; iHeight; i++) { IP = TempBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (j=0; jWidth; j++, IP++, WP++, MP++) { //////adsfadsf_for if (*IP > 1) { if ((j+i) % 3) { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = *IP;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = 0;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0xFF;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = 0; *MP = 0xFF;//////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } } window.Mask->StopScanLine(); window.Bitmap->StopScanLine(); TempBitmap->StopScanLine(); } else { #ifndef ACADEMY TCaptureData *cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; if (!(TempBitmap->Create(window.size.x, window.size.y, 24))) goto fail; if (bExp) { TempBitmap->UnionStretchBlt(0, 0, window.size.x, window.size.y, cd->Bitmap, 0, 0, cd->Bitmap->Width, cd->Bitmap->Height, SRCCOPY); } else { TempBitmap->Copy(cd->Bitmap, SRCCOPY); } crrf = SearchFillColor(TempBitmap); TempBitmap->Rotate(deg*100, true, crrf); size = Point(TempBitmap->Width, TempBitmap->Height); if (bExp) { if (!(Expbmp->Create(size.x, size.y, 24))) goto fail; if ((FhDC = Expbmp->CreateDC()) == NULL) goto fail; TempBitmap->UnionBitBlt(FhDC, 0, 0, size.x, size.y, 0, 0, SRCCOPY, false); // convert by celberus Expbmp->DeleteDC(FhDC); FhDC = NULL; } if (!(Image->SubBitmap->Create(size.x, size.y, 24))) goto fail; if (!(Image->SubMask->Create(size.x, size.y, 1))) goto fail; if (!(window.Bitmap->Create(size.x, size.y, 24))) goto fail; if (!(window.Mask->Create(size.x, size.y, 1))) goto fail; if (!(window.Back->Create(size.x, size.y, 24))) goto fail; if (!(TempBitmap->StartScanLine())) goto fail; if (!(window.Bitmap->StartScanLine())) goto fail; if (!(window.Mask->StartScanLine())) goto fail; if (FullViewForm->Super == sOff) { for (int i=0; i < size.y; i++) { IP = TempBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); *MP = 0; mm = 0x80; int StartX = 0; int EndX = 0; //adsfadsf_for_declare j=0; while(1) { //////adsfadsf_while GetPixel24(IP, fcol); if (fcol != crrf) { if ((j+i) % 3) { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 CopyPixel24(WP, IP);//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 SetPixel24(WP, 0);//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 SetPixel24(WP, 0);//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } j++; if (j >= size.x){ break; } if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 IP+=3; WP+=3;//////adsfadsf_Variable_Checked if (mm>1){ mm >>= 1; } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP++; *MP = 0; mm = 0x80; //////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } } else { bgc = PaletteForm->DIB256Palette->GetBGCOLORREF(24); for (int i=0; i < size.y; i++) { IP = TempBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); *MP = 0; mm = 0x80; int StartX = 0; int EndX = 0; //adsfadsf_for_declare j=0; while(1) { //////adsfadsf_while GetPixel24(IP, fcol); if (fcol != crrf && fcol != bgc) { if ((j+i) % 3) { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 CopyPixel24(WP, IP);//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 SetPixel24(WP, 0);//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 SetPixel24(WP, 0);//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } j++; if (j >= size.x){ break; } if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 IP+=3; WP+=3;//////adsfadsf_Variable_Checked if (mm>1){ mm >>= 1; } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP++; *MP = 0; mm = 0x80; //////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } } window.Mask->StopScanLine(); window.Bitmap->StopScanLine(); TempBitmap->StopScanLine(); #endif } Image->SubBitmap->Copy(window.Bitmap, SRCCOPY); // Image->SubMask->Copy(window.Mask, SRCCOPY); // by celberus delete TempBitmap; TempBitmap = NULL; return; fail: if (Expbmp) Expbmp->Destroy(); window.Mask->StopScanLine(); window.Bitmap->StopScanLine(); TempBitmap->StopScanLine(); if (TempBitmap) delete TempBitmap; EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //--------------------------------------------------------------------------- // Public Function //--------------------------------------------------------------------------- void __fastcall TFillForm::InitForm() { TPItemImage *Image = MainImageForm->iMainImage; ParentHeight = Parent->Height+20; //========================================= by hjs 00.09.14 // ClientHeight = 245; ClientHeight = /*320;*/ 266; //lhskys ¹Ýº¹,Æø ºÎºÐ »èÁ¦ ÆÐÅÏÀ¸·Î¸¸»ý¼º //========================================= Parent->Height = ParentHeight+ClientHeight; 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; FillRect.Left = window.s.x; FillRect.Top = window.s.y; FillRect.Right = window.e.x; FillRect.Bottom = window.e.y; changefrom = TFF_SINGLE; changeto = TFT_SINGLE; air = rgAir->ItemIndex ? true : false; density = 3; nozzle = 1; spDensity->Value = density; spNozzle->Value = nozzle; bExp = false; source = Rect(window.s.x, window.s.y, window.e.x, window.e.y); ExpRect = window; beforesize = window; expStep = 0; if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) cbAutoRep->Enabled = true; else cbAutoRep->Enabled = false; if (Image->uBitmap->BitsPerPixel==8) { Selector->SetPalette(MainImageForm->Palette); FTarget = PaletteForm->DIB256Palette->ChoiceIndex; TSColor->Brush->Color = MainImageForm->Palette->Color[FTarget]; sbFMulti->Enabled = true; sbTNPattern->Enabled = MainImageForm->WorkArea->Mask!=NULL; sbTRPattern->Enabled = MainImageForm->WorkArea->Mask!=NULL; sbTMulti->Enabled = false; MainImageForm->Palette->ToRGBQUAD(rgb, 256); } else { #if !(defined(ACADEMY) || defined(KNIT)) FTarget = PaletteForm->DIB256Palette->GetFGCOLORREF(24); TSColor->Brush->Color = (TColor) FTarget; sbFMulti->Enabled = false; sbTNPattern->Enabled = CaptureData->Count>0; sbTRPattern->Enabled = CaptureData->Count>0; sbTMulti->Enabled = false;//MainImageForm->WorkArea->Mask!=NULL; #endif } sbFSingle->Down = true; sbTSingle->Down = true; MultiPanel->Visible = false; PatternPanel->Visible = false; SSPanel->Visible = true; TSPanel->Visible = true; viewp = NULL; window.Bitmap = NULL; window.Back = NULL; window.Mask = NULL; Expbmp = NULL; #ifdef TPDEBUG if ((viewp = new TUnionBitmap) == NULL) SHOWDEBUG; if ((window.Bitmap = new TUnionBitmap) == NULL) SHOWDEBUG; if ((window.Back = new TUnionBitmap) == NULL) SHOWDEBUG; if ((window.Mask = new TUnionBitmap) == NULL) SHOWDEBUG; if ((Expbmp = new TTexpiaBitmap) == NULL) SHOWDEBUG; #else viewp = new TUnionBitmap; // convert by celberus window.Bitmap = new TUnionBitmap; // convert by celberus window.Back = new TUnionBitmap; // convert by celberus window.Mask = new TUnionBitmap; // convert by celberus Expbmp = new TTexpiaBitmap; #endif RepeatPanel->SendToBack(); RepeatItem = 0; sbBeforeDeg->Down = false; spDeg->Value = 0; captureindex = 0; paintrect = Rect(0, 0, Image->uBitmap->Width, Image->uBitmap->Height); IsRDraw = false; ReadIni(); } //--------------------------------------------------------------------------- void __fastcall TFillForm::ExitForm(void) { TPItemImage *Image = MainImageForm->iMainImage; MainImageForm->ResetDraw(true); IsRDraw = false; if (step == 1) MainImageForm->iMainImage->Repaint(); if (window.Back) { delete window.Back; window.Back = 0; } if (window.Mask) { delete window.Mask; window.Mask = 0; } if (window.Bitmap) { delete window.Bitmap; window.Bitmap = 0; } if (viewp) { delete viewp; viewp = 0; } if (Expbmp) { delete Expbmp; Expbmp = 0;} Image->SubVisible = false; Image->SubEnabled = false; if (Image->uBitmap->BitsPerPixel==8) { Selector->SaveToFile(DirectoryItem+"\\Fill.Ini", "Multi"); } WriteIni(); } //--------------------------------------------------------------------------- void __fastcall TFillForm::ReadIni() { TIniFile *FillIni = new TIniFile(DirectoryItem + "\\Fill.ini"); int TempDeg = FillIni->ReadInteger("Rotate", "BeforeDeg", 0); BeforeTheta = DegToRad((Extended) TempDeg); delete FillIni; } //--------------------------------------------------------------------------- void __fastcall TFillForm::WriteIni() { TIniFile *FillIni = new TIniFile(DirectoryItem + "\\Fill.ini"); int TempDeg = RadToDeg(BeforeTheta); FillIni->WriteInteger("Rotate", "BeforeDeg", TempDeg); delete FillIni; } //--------------------------------------------------------------------------- void __fastcall TFillForm::SelectColor(int Value) { TPItemImage *Image = MainImageForm->iMainImage; if (changeto == TFT_SINGLE || changeto == TFT_MULTI) { if (Image->uBitmap->BitsPerPixel==8) { FTarget = Value; TSColor->Brush->Color = MainImageForm->Palette->Color[FTarget]; } else { FTarget = MainImageForm->Palette->Color[Value]; TSColor->Brush->Color = (TColor) FTarget; } } else if (changeto == TFT_NONE) { if (changefrom == TFF_MULTI) { Selector->AddColor(Value); } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::FillMouseDown(TMouseButton Button, TShiftState Shift, int X, int Y) { RECT r; int ix, iy; TPItemImage *Image = MainImageForm->iMainImage; POINT sp; if (changeto == TFT_SINGLE) { if (changefrom == TFF_SINGLE) { if (Button==mbMiddle || (Shift.Contains(ssShift) && Button==mbLeft)) { FTarget = Image->uBitmap->GetPixelColor(X, Y); if (Image->uBitmap->BitsPerPixel==8) { TSColor->Brush->Color = MainImageForm->Palette->Color[FTarget]; } else { TSColor->Brush->Color = (TColor) FTarget; } } else if (Button == mbLeft) { // MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, // Rect(0, 0, Image->uBitmap->Width, Image->uBitmap->Height)); FSource = Image->uBitmap->GetPixelColor(X, Y); if (Image->uBitmap->BitsPerPixel==8) { Selector->Initial(); Selector->AddColor(FSource); SSColor->Brush->Color = MainImageForm->Palette->Color[FSource]; } else { SSColor->Brush->Color =(TColor) FSource; } clFillTo = FTarget; fillstart = Point(X, Y); Color_Fill(); } } else if (changefrom == TFF_MULTI) { if (Button==mbMiddle || (Shift.Contains(ssShift) && Button==mbLeft)) { FTarget = Image->uBitmap->GetPixelColor(X, Y); if (Image->uBitmap->BitsPerPixel==8) { TSColor->Brush->Color = MainImageForm->Palette->Color[FTarget]; } else { TSColor->Brush->Color = (TColor) FTarget; } } else if (Button == mbLeft) { // MainImageForm->UndoSave(PenManagerForm->sbMask->Down ? UK_PATTERN|UK_MASK : UK_PATTERN, // Rect(0, 0, Image->uBitmap->Width, Image->uBitmap->Height)); clFillTo = FTarget; fillstart = Point(X, Y); Color_Fill(); } } } else if (changeto == TFT_MULTI) { if (Button==mbMiddle || (Shift.Contains(ssShift) && Button==mbLeft)) { FTarget = Image->uBitmap->GetPixelColor(X, Y); if (Image->uBitmap->BitsPerPixel==8) { TSColor->Brush->Color = MainImageForm->Palette->Color[FTarget]; } else { TSColor->Brush->Color = (TColor) FTarget; } } else if (Button == mbLeft) { fillstart = Point(X, Y); for (int l = 0; l < MAX_COLOR; l++) { if (Selector->Number[l] < 255) { UseColorNUM = l - 1; break; } } /* 2001.3.29 by lhskys FIll(ä¿ì±â)¿¡¼­ 256ÀÌ ³Ñ¾îµµ ä¿ì±â´Â °¡´ÉÇØ¾ß Çϱ⶧¹®¿¡... Color_Fill(); ¸¸ ³²±â°í ¸Þ¼¼Áö¸¦ ³ª¿À´Â°ÍÀ» ¸·¾Ò´Ù. ´õ ÁÁÀº ¹æ¹ýÀÌ ÀÖÀ¸¸é ¼öÁ¤Çϵµ·Ï... ================================================================================ if ((Selector->Count + colorptr >= MAX_COLOR) && ((mul_rgb.rgbRed != MainImageForm->Palette->ColorData[f]->RGB.rgbRed) || (mul_rgb.rgbGreen != MainImageForm->Palette->ColorData[f]->RGB.rgbGreen) || (mul_rgb.rgbBlue != MainImageForm->Palette->ColorData[f]->RGB.rgbBlue))) { if (mul_fill_sw == 1) mul_fill_sw = 0; EXCEPTION_MESSAGE_OK(EC_COLOR_OVERFLOW); } else { // MainImageForm->UndoSave(UK_PATTERN, Rect(0, 0, Image->uBitmap->Width, // Image->uBitmap->Height)); Color_Fill(); } ================================================================================ */ Color_Fill(); } } else if (changeto == TFT_NORMALP) { if (Button == mbLeft) { if (bExp) { if (expStep == 0) { if (Image->uBitmap->BitsPerPixel == 8) { expStep = 2; ExpMakeBitmap(); } else { expStep = 1; cap_dp = Point(X, Y); MakeExpNMImage(X, Y); } return; } else if (expStep == 1) { expStep = 2; ExpMakeBitmap(); return; } else if (expStep == 2) { if (changefrom == TFF_SINGLE) { // MainImageForm->UndoSave(UK_PATTERN, Rect(0, 0, Image->uBitmap->Width, // Image->uBitmap->Height)); FSource = Image->uBitmap->GetPixelColor(X, Y); if (Image->uBitmap->BitsPerPixel==8) { Selector->Initial(); Selector->AddColor(FSource); SSColor->Brush->Color = MainImageForm->Palette->Color[FSource]; } else { SSColor->Brush->Color = (TColor) FSource; } switch (MousePointPlace) { case 1: pfpos = Point(X, Y); break; case 2: pfpos = Point(X - window.size.x, Y); break; case 3: pfpos = Point(X, Y - window.size.y); break; case 4: pfpos = Point(X - window.size.x, Y - window.size.y); break; case 5: pfpos = Point(X - window.size.x / 2.0, Y - window.size.y / 2.0); } fillstart = Point(X, Y); Color_Fill(); } else if (changefrom == TFF_MULTI) { // MainImageForm->UndoSave(UK_PATTERN, Rect(0, 0, Image->uBitmap->Width, // Image->uBitmap->Height)); switch (MousePointPlace) { case 1: pfpos = Point(X, Y); break; case 2: pfpos = Point(X - window.size.x, Y); break; case 3: pfpos = Point(X, Y - window.size.y); break; case 4: pfpos = Point(X - window.size.x, Y - window.size.y); break; case 5: pfpos = Point(X - window.size.x / 2.0, Y - window.size.y / 2.0); } fillstart = Point(X, Y); Color_Fill(); } beforesize = ExpRect; // window.s.x = source.Left; // window.s.y = source.Top; // window.e.x = source.Right; // window.e.y = source.Bottom; // window.size.x = source.Right - source.Left; // window.size.y = source.Bottom - source.Top; } } else { if (changefrom == TFF_SINGLE) { // MainImageForm->UndoSave(UK_PATTERN, Rect(0, 0, Image->uBitmap->Width, // Image->uBitmap->Height)); FSource = Image->uBitmap->GetPixelColor(X, Y); if (Image->uBitmap->BitsPerPixel==8) { Selector->Initial(); Selector->AddColor(FSource); SSColor->Brush->Color = MainImageForm->Palette->Color[FSource]; } else { SSColor->Brush->Color = (TColor) FSource; } switch (MousePointPlace) { case 1: pfpos = Point(X, Y); break; case 2: pfpos = Point(X - window.size.x, Y); break; case 3: pfpos = Point(X, Y - window.size.y); break; case 4: pfpos = Point(X - window.size.x, Y - window.size.y); break; case 5: pfpos = Point(X - window.size.x / 2.0, Y - window.size.y / 2.0); } fillstart = Point(X, Y); Color_Fill(); } else if (changefrom == TFF_MULTI) { // MainImageForm->UndoSave(UK_PATTERN, Rect(0, 0, Image->uBitmap->Width, // Image->uBitmap->Height)); switch (MousePointPlace) { case 1: pfpos = Point(X, Y); break; case 2: pfpos = Point(X - window.size.x, Y); break; case 3: pfpos = Point(X, Y - window.size.y); break; case 4: pfpos = Point(X - window.size.x, Y - window.size.y); break; case 5: pfpos = Point(X - window.size.x / 2.0, Y - window.size.y / 2.0); } fillstart = Point(X, Y); Color_Fill(); } } } } else if (changeto == TFT_ROTATEP) { if (bExp) { if (expStep == 0) { rstep = 0; if (Image->uBitmap->BitsPerPixel == 8) { expStep = 2; sbBeforeShape->Enabled = false; //lhskys sbBeforeDeg->Enabled = true; //lhskys ExpMakeBitmap(); } else { expStep = 1; cap_dp = Point(X, Y); MakeExpNMImage(X, Y); sbBeforeShape->Enabled = false; //lhskys sbBeforeDeg->Enabled = true; //lhskys } return; } else if (expStep == 1) { ExpMakeBitmap(); expStep = 2; PatternImage->Repaint(); return; } else if (expStep == 2) { if (rstep == 0) { switch (MousePointPlace) { case 1: X=X+window.size.x/2; Y=Y+window.size.x/2; break; case 2: X=X-window.size.x/2; Y=Y+window.size.x/2; break; case 3: X=X+window.size.x/2; Y=Y-window.size.x/2; break; case 4: X=X-window.size.x/2; Y=Y-window.size.x/2; break; case 5: break; } rotatepoint.x = X; rotatepoint.y = Y; Image->SubVisible = false; rstep = 1; ROTATEP_X = X; ROTATEP_Y = Y; } else if (rstep == 1) { Image->SubVisible = true; if (patternfill_image_rotate(X, Y)){ MakeFillImage(RadToDeg(Theta)); } rstep = 2; } else if (rstep == 2) { if (Button == mbLeft) { BeforeTheta = Theta; if (sbBeforeDeg->Down) sbBeforeDeg->Down = false; if (changefrom == TFF_SINGLE) { // MainImageForm->UndoSave(UK_PATTERN, Rect(0, 0, Image->uBitmap->Width, // Image->uBitmap->Height)); FSource = Image->uBitmap->GetPixelColor(X, Y); if (Image->uBitmap->BitsPerPixel==8) { Selector->Initial(); Selector->AddColor(FSource); SSColor->Brush->Color = MainImageForm->Palette->Color[FSource]; } else { SSColor->Brush->Color = (TColor) FSource; } switch (MousePointPlace) { case 1: pfpos = Point(0, 0); break; case 2: pfpos = Point(window.size.x, 0); break; case 3: pfpos = Point(0, window.size.y); break; //ÇöÀçÀÇ Á¡¿¡¼­ ¿ÞÂÊÀ¸·Î 0, À§ÂÊÀ¸·Î window.size.y¸¸Å­ º¸³»¸é left-topÀÌ ³ª¿Â´Ù case 4: pfpos = Point(window.size.x,window.size.y); break; //rotate¿¡¼­´Â pfpos¿¡ ÀÌ °ªÀ» ³Ö´Â´Ù case 5: pfpos = Point(window.size.x / 2.0,window.size.y / 2.0); } fillstart = Point(X,Y); Color_Fill(); } else if (changefrom == TFF_MULTI) { // MainImageForm->UndoSave(UK_PATTERN, Rect(0, 0, Image->uBitmap->Width, // Image->uBitmap->Height)); switch (MousePointPlace) { case 1: pfpos = Point(0, 0); break; case 2: pfpos = Point(window.size.x, 0); break; case 3: pfpos = Point(0, window.size.y); break; //ÇöÀçÀÇ Á¡¿¡¼­ ¿ÞÂÊÀ¸·Î 0, À§ÂÊÀ¸·Î window.size.y¸¸Å­ º¸³»¸é left-topÀÌ ³ª¿Â´Ù case 4: pfpos = Point(window.size.x,window.size.y); break; //rotate¿¡¼­´Â pfpos¿¡ ÀÌ °ªÀ» ³Ö´Â´Ù case 5: pfpos = Point(window.size.x / 2.0,window.size.y / 2.0); } fillstart = Point(X,Y); Color_Fill(); } beforesize = ExpRect; // window.s.x = source.Left; // window.s.y = source.Top; // window.e.x = source.Right; // window.e.y = source.Bottom; // window.size.x = source.Right - source.Left; // window.size.y = source.Bottom - source.Top; FunctionClick(sbTRPattern); } } } } else { if (rstep == 0) { switch (MousePointPlace) { case 1: X=X+window.size.x/2; Y=Y+window.size.x/2; break; case 2: X=X-window.size.x/2; Y=Y+window.size.x/2; break; case 3: X=X+window.size.x/2; Y=Y-window.size.x/2; break; case 4: X=X-window.size.x/2; Y=Y-window.size.x/2; break; case 5: break; } rotatepoint.x = X; rotatepoint.y = Y; Image->SubVisible = false; rstep = 1; ROTATEP_X = X; ROTATEP_Y = Y; } else if (rstep == 1) { Image->SubVisible = false; if (patternfill_image_rotate(X, Y)) { //ȸÀüÀÇ Áß½É? X,Y? °ú¿¬Àǹ̰¡ ÀÖÀ»±î? MakeFillImage(RadToDeg(Theta)); } rstep = 2; } else if (rstep == 2) { if (Button == mbLeft) { BeforeTheta = Theta; if (sbBeforeDeg->Down) sbBeforeDeg->Down = false; if (changefrom == TFF_SINGLE) { // MainImageForm->UndoSave(UK_PATTERN, Rect(0, 0, Image->uBitmap->Width, // Image->uBitmap->Height)); FSource = Image->uBitmap->GetPixelColor(X,Y); if (Image->uBitmap->BitsPerPixel==8) { Selector->Initial(); Selector->AddColor(FSource); SSColor->Brush->Color = MainImageForm->Palette->Color[FSource]; } else { SSColor->Brush->Color = (TColor) FSource; } switch (MousePointPlace) { case 1: pfpos = Point(0, 0); break; case 2: pfpos = Point(window.size.x, 0); break; case 3: pfpos = Point(0, window.size.y); break; //ÇöÀçÀÇ Á¡¿¡¼­ ¿ÞÂÊÀ¸·Î 0, À§ÂÊÀ¸·Î window.size.y¸¸Å­ º¸³»¸é left-topÀÌ ³ª¿Â´Ù case 4: pfpos = Point(window.size.x,window.size.y); break; //rotate¿¡¼­´Â pfpos¿¡ ÀÌ °ªÀ» ³Ö´Â´Ù case 5: pfpos = Point(window.size.x / 2.0,window.size.y / 2.0); } fillstart = Point(X,Y); Color_Fill(); } else if (changefrom == TFF_MULTI) { // MainImageForm->UndoSave(UK_PATTERN, Rect(0, 0, Image->uBitmap->Width, // Image->uBitmap->Height)); switch (MousePointPlace) { case 1: pfpos = Point(0, 0); break; case 2: pfpos = Point(window.size.x, 0); break; case 3: pfpos = Point(0, window.size.y); break; //ÇöÀçÀÇ Á¡¿¡¼­ ¿ÞÂÊÀ¸·Î 0, À§ÂÊÀ¸·Î window.size.y¸¸Å­ º¸³»¸é left-topÀÌ ³ª¿Â´Ù case 4: pfpos = Point(window.size.x,window.size.y); break; //rotate¿¡¼­´Â pfpos¿¡ ÀÌ °ªÀ» ³Ö´Â´Ù case 5: pfpos = Point(window.size.x / 2.0,window.size.y / 2.0); } fillstart = Point(X,Y); Color_Fill(); } spDeg->Value = 0; // by celberus Theta = 0; // by celberus FunctionClick(sbTRPattern); } } } } else if (changeto == TFT_NONE) { if (changefrom == TFF_MULTI) { if (Button==mbMiddle || (Shift.Contains(ssShift) && Button==mbLeft)) { if (sbBlock->Down) { if (sbDelete->Down) { Selector->DeleteColor(Image->uBitmap->GetPixelColor(X, Y)); } else { Selector->AddColor(Image->uBitmap->GetPixelColor(X, Y)); } } else { if (step == 0) { Temp.left = X; Temp.top = Y; Temp.bottom = Temp.top; Temp.right = Temp.left; MainImageForm->DrawRectangleLocate(Temp); IsDraw = true; step = 1; } else if (step == 1) { Temp.right = X; Temp.bottom = Y; MainImageForm->DrawRectangleLocate(Temp); if (Temp.left > Temp.right) { r.left = Temp.right; r.right = Temp.left; } else { r.left = Temp.left; r.right = Temp.right; } if (Temp.top > Temp.bottom) { r.top = Temp.bottom; r.bottom = Temp.top; } else { r.top = Temp.top; r.bottom = Temp.bottom; } if (sbDelete->Down) { for (iy = r.top; iy < r.bottom; iy++) { for (ix = r.left; ix < r.right; ix++) { Selector->DeleteColor(Image->uBitmap->GetPixelColor(ix, iy)); } } } else { for (iy = r.top; iy < r.bottom; iy++) { for (ix = r.left; ix < r.right; ix++) { Selector->AddColor(Image->uBitmap->GetPixelColor(ix, iy)); } } } IsDraw = false; MainImageForm->iMainImage->OnPaintLocate = NULL;/////////////////by jeegeo step = 0; } } } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::FillMouseMove(int X, int Y) { int ArrowXX, ArrowYY, i; POINT sp; TPItemImage *Image = MainImageForm->iMainImage; if (changeto == TFT_NONE) { if (changefrom == TFF_MULTI) { if (step == 1) { if (IsDraw) MainImageForm->DrawRectangleLocate(Temp); Temp.right = X; Temp.bottom = Y; MainImageForm->DrawRectangleLocate(Temp); IsDraw = true; } } } else if (changeto == TFT_NORMALP) { if (bExp) { if ((Image->uBitmap->BitsPerPixel == 24) && (expStep == 0)) { sp = SImageLocation(X, Y); CommonMouseMove(sp.x, sp.y); } else { MakeExpNMImage(X, Y); } } else { sp = SImageLocation(X, Y); CommonMouseMove(sp.x, sp.y); } } else if((changeto == TFT_ROTATEP) && (rstep == 0)){ if (bExp) { if ((Image->uBitmap->BitsPerPixel == 24) && (expStep == 0)) { sp = SImageLocation(X, Y); CommonMouseMove(sp.x, sp.y); // X = X - (Image->SubBitmap->Width / 2.0); //by jeegeo // Y = Y - (Image->SubBitmap->Height / 2.0); // CommonMouseMove(X, Y); } else { MakeExpNMImage(X, Y); } } else { sp = SImageLocation(X, Y); CommonMouseMove(sp.x, sp.y); // X = X - (Image->SubBitmap->Width / 2.0); // Y = Y - (Image->SubBitmap->Height / 2.0); // CommonMouseMove(X, Y); } } else if (changeto == TFT_ROTATEP) { if (rstep == 1) { MainImageForm->iMainImage->SubVisible = false; ROTATEP_X1 = X; ROTATEP_Y1 = Y; MouseStop->Enabled = false; MouseStop->Enabled = true; if (IsRDraw) Rotate_Rect(); // µ¹¾Æ°¡´Â »ç°¢ÇüÀ» ±×¸®´Â ÇÁ·Î½ÃÀú.. ArrowXX = window.size.x / 6; ArrowYY = window.size.y / 6; ArrowX[0] = rotatepoint.x; ArrowX[1] = rotatepoint.x - ArrowXX * 2; ArrowX[2] = rotatepoint.x + ArrowXX * 2; ArrowX[3] = rotatepoint.x; ArrowX[4] = rotatepoint.x; ArrowY[0] = rotatepoint.y - ArrowYY * 2; ArrowY[1] = rotatepoint.y; ArrowY[2] = rotatepoint.y; ArrowY[3] = rotatepoint.y + ArrowYY * 2; ArrowY[4] = rotatepoint.y; Trans_Data(X, Y); for (i = 0; i <= 3; i++) { if (min_x >= sx[i]) min_x = sx[i]; else if (max_x <= sx[i]) max_x = sx[i]; if (min_y >= sy[i]) min_y = sy[i]; else if (max_y <= sy[i]) max_y = sy[i]; } Rotate_Rect(); // µ¹¾Æ°¡´Â »ç°¢ÇüÀ» ±×¸®´Â ÇÁ·Î½ÃÀú.. IsRDraw = true; spDeg->Value = RadToDeg(Theta); } else if (rstep == 2){ if (bExp) { MakeExpRMImage(X, Y); } else { sp = SImageLocation(X, Y, Theta); //ȸÀüµÈ À̹ÌÁöÀÇ ¸¶¿ì½º Ä¿¼­¿¡ ´ëÇÑ À§Ä¡¸¦ Á¤ÇÑ´Ù. //by jeegeo CommonMouseMove(sp.x, sp.y); // X = X - Image->SubBitmap->Width/2; // Y = Y - Image->SubBitmap->Height/2; // CommonMouseMove(X, Y); } } } else { if (changefrom == TFF_SINGLE) { FSource = Image->uBitmap->GetPixelColor(X, Y); if (Image->uBitmap->BitsPerPixel==8) { SSColor->Brush->Color = MainImageForm->Palette->Color[FSource]; } else { SSColor->Brush->Color = (TColor) FSource; } } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::FillPaint() { IsDraw = false; MainImageForm->iMainImage->OnPaintLocate = NULL;/////////////////by jeegeo IsRDraw = false; } //--------------------------------------------------------------------------- void __fastcall TFillForm::iMainImageChange(void) { if (IsDraw) IsDraw = false; MainImageForm->iMainImage->OnPaintLocate = NULL;/////////////////by jeegeo if (IsRDraw) IsRDraw = false; } //--------------------------------------------------------------------------- void __fastcall TFillForm::PatternImageMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { int w, h; w = PatternImage->Width; h = PatternImage->Height; if (changeto == TFT_NORMALP||changeto == TFT_ROTATEP) { //by jeegeo if((X>w/4 && X<=3*w/4) && (Y>h/4 && Y<= 3*h/4)) { //Center MousePointPlace = 5; } else if((X>=0 && X<=w/2) && (Y>=0 && Y<=h/2)) { //Left-Top MousePointPlace = 1; } else if((X>=w/2 && X<=w) && (Y>=0 && Y<=h/2)) { //Right-Top MousePointPlace = 2; } else if((X>=0 && X<=w/2) && (Y>h/2 && Y<= h)) { //Left-Bottom MousePointPlace = 3; } else if((X>w/2 && X<=w) && (Y>h/2 && Y<=h)) { //Right-Bottom MousePointPlace = 4; } DrawMousePoint(MousePointPlace); } } //--------------------------------------------------------------------------- void __fastcall TFillForm::DrawMousePoint(int mousepoint) { int width, height; // HDC vDC = NULL; TRect canvas; width = PatternImage->Width; height = PatternImage->Height; TPItemImage *Image = MainImageForm->iMainImage; if (Image->uBitmap->BitsPerPixel==8) { // Delete before MouseMark canvas = Rect(0,0,width,height); PatternImage->Canvas->Brush->Color = clWhite; PatternImage->Canvas->FillRect(canvas); } else { #if !(defined(ACADEMY) || defined(KNIT)) TCaptureData *cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; // window.size.x = cd->Bitmap->Width; // window.size.y = cd->Bitmap->Height; // if ((vDC = cd->Bitmap->CreateDC()) == NULL) goto fail; // SetStretchBltMode(vDC, COLORONCOLOR); // StretchBlt(PatternImage->Canvas->Handle, 0, 0,width, height, // vDC, 0, 0, window.size.x, window.size.y, SRCCOPY); cd->Bitmap->UnionStretchBlt(PatternImage->Canvas->Handle, 0, 0,width, height, 0, 0, cd->Bitmap->Width, cd->Bitmap->Height, SRCCOPY); // convert by celberus // cd->Bitmap->DeleteDC(vDC); #endif } PatternImage->Repaint(); //Create New MouseMark PatternImage->Canvas->Pen->Color = clBlack; PatternImage->Canvas->Pen->Width = 3; PatternImage->Canvas->Brush->Color = clWhite; switch(mousepoint) { case 1: PatternImage->Canvas->Rectangle(3, 3, 13, 13); break; case 2: PatternImage->Canvas->Rectangle(width-13, 3, width-3, 13); break; case 3: PatternImage->Canvas->Rectangle(3, height-13, 13, height-3); break; case 4: PatternImage->Canvas->Rectangle(width-13, height-13, width-3, height-3); break; default: PatternImage->Canvas->Rectangle(width/2-5, height/2-5, width/2+5, height/2+5); break; } return; fail: EXCEPTION_MESSAGE_OK(EC_RESOURCE_LACK); } //--------------------------------------------------------------------------- void __fastcall TFillForm::cbRepeatTypeChange(TObject *Sender) { RepeatItem = cbRepeatType->ItemIndex; if (RepeatItem == 0) cbRepeatType->Text = IDS_COMMON_NORMAL; else if (RepeatItem == 1) { spRange->Value = window.size.y/2; cbRepeatType->Text = IDS_COMMON_HDVER; }else if (RepeatItem == 2) { spRange->Value = window.size.x/2; cbRepeatType->Text = IDS_COMMON_HDHOR; }else cbRepeatType->Text = TypeName; RepeatView(); } //--------------------------------------------------------------------------- void __fastcall TFillForm::RepeatView() { if (RepeatItem == 0) { lbWH->Caption = IDS_COMMON_WIDTH; lbRange->Caption = Format("(0 - %d)", OPENARRAY(TVarRec, ((int)window.size.x))); lbWH->Enabled = false; lbRange->Enabled = false; spRange->Enabled = false; } else if (RepeatItem == 1) { lbWH->Enabled = true; lbRange->Enabled = true; spRange->Enabled = true; lbWH->Caption = IDS_COMMON_HEIGHT; lbRange->Caption = Format("(0 - %d)", OPENARRAY(TVarRec, ((int)window.size.y))); } else { lbWH->Enabled = true; lbRange->Enabled = true; spRange->Enabled = true; lbWH->Caption = IDS_COMMON_WIDTH; lbRange->Caption = Format("(0 - %d)", OPENARRAY(TVarRec, ((int)window.size.x))); } } //--------------------------------------------------------------------------- void __fastcall TFillForm::spRangeChange(TObject *Sender) { if (spRange->Text.Length()>0) { if (spRange->Value < 0) spRange->Value = 0; if(RepeatItem == 1) { if (spRange->Value > window.size.y) spRange->Value = window.size.y; } if(RepeatItem == 2) { if (spRange->Value > window.size.x) spRange->Value = window.size.x; } } } //--------------------------------------------------------------------------- void __fastcall TFillForm::spDegChange(TObject *Sender) { int deg; if (spDeg->Text.Length() > 0) { Theta = DegToRad(spDeg->Value); } } //--------------------------------------------------------------------------- void __fastcall TFillForm::spDegKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { // if (Key == VK_RETURN) { int deg; if (spDeg->Text.Length() > 0) { TCursor oldcur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->iMainImage->SubVisible = false; deg = spDeg->Value; Theta = DegToRad(deg); rstep = 2; sw = true; if (cbExp->Checked) { ExpMakeBitmap(); } if (patternfill_image_rotate()) { MakeFillImage(deg); } Screen->Cursor = oldcur; sw = false; MainImageForm->iMainImage->Repaint(); } } //--------------------------------------------------------------------------- void __fastcall TFillForm::cbExpClick(TObject *Sender) { if (cbExp->Checked) { //========================================== //ÆÐÅÏÀ» ȸÀü½ÃŲ´ÙÀ½ üũÇÏ´Â °æ¿ì ¿¡·¯ ¹ß»ý¶§¹®¿¡. if (sbTNPattern->Down) { FunctionClick(sbTNPattern); sbBeforeShape->Enabled = true; } else if (sbTRPattern->Down) { FunctionClick(sbTRPattern); } //========================================== bExp = true; } else { bExp = false; window.s.x = source.Left; window.s.y = source.Top; window.e.x = source.Right; window.e.y = source.Bottom; window.size.x = source.Right - source.Left; window.size.y = source.Bottom - source.Top; if (sbTNPattern->Down){ FunctionClick(sbTNPattern); sbBeforeShape->Enabled = false; } else { FunctionClick(sbTRPattern); sbBeforeShape->Enabled = false; sbBeforeDeg->Enabled = true; } } expStep = 0; } //--------------------------------------------------------------------------- void __fastcall TFillForm::MakeExpNMImage(int X, int Y) { POINT sp; TPItemImage *Image = MainImageForm->iMainImage; if (expStep == 0) { if (Image->uBitmap->BitsPerPixel == 24) return; if (X < source.Left) { ExpRect.s.x = X; ExpRect.e.x = source.Right; ExpRect.size.x = ExpRect.e.x - X; } else { ExpRect.s.x = source.Left; ExpRect.e.x = X; ExpRect.size.x = X - ExpRect.s.x; } if (Y < source.Top) { ExpRect.s.y = Y; ExpRect.e.y = source.Bottom; ExpRect.size.y = ExpRect.e.y - Y; } else { ExpRect.s.y = source.Top; ExpRect.e.y = Y; ExpRect.size.y = Y - ExpRect.s.y; } sp.x = ExpRect.s.x; sp.y = ExpRect.s.y; if (ExpRect.size.x == 0 || ExpRect.size.y == 0) return; if (Image->uBitmap->BitsPerPixel==8) { if ((window.Back->Create(ExpRect.size.x, ExpRect.size.y, 8, rgb)) == false) goto fail; if ((Image->SubBitmap->Create(ExpRect.size.x, ExpRect.size.y, 8, rgb)) == false) goto fail; if ((Image->SubMask->Create(ExpRect.size.x, ExpRect.size.y, 8, rgb)) == false) goto fail; } else { if ((window.Back->Create(ExpRect.size.x, ExpRect.size.y, 24)) == false) goto fail; if ((Image->SubBitmap->Create(ExpRect.size.x, ExpRect.size.y, 24)) == false) goto fail; if ((Image->SubMask->Create(ExpRect.size.x, ExpRect.size.y, 1)) == false) goto fail; } } else if (expStep == 1) { if (X < cap_dp.x) { ExpRect.s.x = X; ExpRect.e.x = cap_dp.x; ExpRect.size.x = cap_dp.x - X; } else { ExpRect.s.x = cap_dp.x; ExpRect.e.x = X; ExpRect.size.x = X - cap_dp.x; } if (Y < cap_dp.y) { ExpRect.s.y = Y; ExpRect.e.y = cap_dp.y; ExpRect.size.y = cap_dp.y - Y; } else { ExpRect.s.y = cap_dp.y; ExpRect.e.y = Y; ExpRect.size.y = Y - cap_dp.y; } sp.x = ExpRect.s.x; sp.y = ExpRect.s.y; if (ExpRect.size.x == 0 || ExpRect.size.y == 0) return; if (Image->uBitmap->BitsPerPixel==8) { if ((window.Back->Create(ExpRect.size.x, ExpRect.size.y, 8, rgb)) == false) goto fail; if ((Image->SubBitmap->Create(ExpRect.size.x, ExpRect.size.y, 8, rgb)) == false) goto fail; if ((Image->SubMask->Create(ExpRect.size.x, ExpRect.size.y, 8, rgb)) == false) goto fail; } else { if ((window.Back->Create(ExpRect.size.x, ExpRect.size.y, 24)) == false) goto fail; if ((Image->SubBitmap->Create(ExpRect.size.x, ExpRect.size.y, 24)) == false) goto fail; if ((Image->SubMask->Create(ExpRect.size.x, ExpRect.size.y, 1)) == false) goto fail; } } else if (expStep == 2) { sp = SImageLocation(X, Y); } Image->SubRange.left = sp.x; Image->SubRange.top = sp.y; Image->SubRange.right = sp.x + Image->SubBitmap->Width; Image->SubRange.bottom = sp.y + Image->SubBitmap->Height; MergeBitmap(sp); ImageRectPaint(); return; fail: if (Image->SubBitmap) Image->SubBitmap->Destroy(); if (Image->SubMask) Image->SubMask->Destroy(); if (window.Back) window.Back->Destroy(); EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //--------------------------------------------------------------------------- void __fastcall TFillForm::MergeBitmap(POINT sp) { int i, j; Byte *IP, *MP, mm; // HDC /*MhDC = NULL,*/ ThDC = NULL; COLORREF bgc, fcol; TPItemImage *Image = MainImageForm->iMainImage; if (Image->uBitmap->BitsPerPixel == 8) { // if ((MhDC = Image->uBitmap->CreateDC()) == NULL) goto fail; // if ((ThDC = Image->SubBitmap->CreateDC()) == NULL) goto fail; // SetStretchBltMode(ThDC, COLORONCOLOR); // StretchBlt(ThDC, 0, 0, ExpRect.size.x, ExpRect.size.y, MhDC, source.Left, source.Top, // source.Right - source.Left, source.Bottom - source.Top, SRCCOPY); Image->SubBitmap->UnionStretchBlt(0, 0, ExpRect.size.x, ExpRect.size.y, Image->uBitmap, source.Left, source.Top, source.Right - source.Left, source.Bottom - source.Top, SRCCOPY); // convert by celberus // Image->SubBitmap->DeleteDC(ThDC); ThDC = NULL; // Image->uBitmap->DeleteDC(MhDC); MhDC = NULL; if (!(Image->SubBitmap->StartScanLine())) goto fail; if (!(Image->SubMask->StartScanLine())) goto fail; if (FullViewForm->Super == sOff) { for (i=0; iSubBitmap->Height; i++) { IP = Image->SubBitmap->GetScanLine(i); MP = Image->SubMask->GetScanLine(i); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (j=0; jSubBitmap->Width; j++, IP++, MP++) { //////adsfadsf_for if (*IP) { if ((j+i) % 3){ if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0xFF;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0xFF;//////adsfadsf_Variable_Checked } } Image->SubMask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } } else { for (i=0; iSubBitmap->Height; i++) { IP = Image->SubBitmap->GetScanLine(i); MP = Image->SubMask->GetScanLine(i); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (j=0; jSubBitmap->Width; j++, IP++, MP++) { //////adsfadsf_for if (*IP > 1) { if ((j+i) % 3){ if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0xFF;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0xFF;//////adsfadsf_Variable_Checked } } Image->SubMask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); } else { #ifndef ACADEMY TCaptureData *cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; // if ((ThDC = Image->SubBitmap->CreateDC()) == NULL) goto fail; convert by celberus // if ((MhDC = cd->Bitmap->CreateDC()) == NULL) goto fail; // SetStretchBltMode(ThDC, COLORONCOLOR); // StretchBlt(ThDC, 0, 0, ExpRect.size.x, ExpRect.size.y, MhDC, 0, 0, // cd->Bitmap->Width, cd->Bitmap->Height, SRCCOPY); // tBitmap->UnionBitBlt(MhDC, 0, 0, cd->Bitmap->Width, cd->Bitmap->Height, 0, 0, SRCCOPY, true); // c // Image->SubBitmap->UnionStretchBlt(0, 0, ExpRect.size.x, ExpRect.size.y, tBitmap, 0, 0, Image->SubBitmap->UnionStretchBlt(0, 0, ExpRect.size.x, ExpRect.size.y, cd->Bitmap, 0, 0, cd->Bitmap->Width, cd->Bitmap->Height, SRCCOPY); // convert by celberus // cd->Bitmap->DeleteDC(MhDC); // Image->SubBitmap->DeleteDC(ThDC); if (!(Image->SubBitmap->StartScanLine())) goto fail; if (!(Image->SubMask->StartScanLine())) goto fail; if (FullViewForm->Super == sOff) { for (int i=0; i < Image->SubBitmap->Height; i++) { MP = Image->SubMask->GetScanLine(i); *MP = 0; mm = 0x80; int StartX = 0; int EndX = 0; //adsfadsf_for_declare j=0; while(1) { //////adsfadsf_while if (((j+i) % 3) == 0) { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } j++; if (j >= Image->SubBitmap->Width){ break; } if (mm>1){ mm >>= 1; } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP++; *MP = 0; mm = 0x80; //////adsfadsf_Variable_Checked } } Image->SubMask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } } else { bgc = PaletteForm->DIB256Palette->GetBGCOLORREF(24); for (int i=0; i < Image->SubBitmap->Height; i++) { IP = Image->SubBitmap->GetScanLine(i); MP = Image->SubMask->GetScanLine(i); *MP = 0; mm = 0x80; int StartX = 0; int EndX = 0; //adsfadsf_for_declare j=0; while(1) { //////adsfadsf_while GetPixel24(IP, fcol); if (fcol != bgc) { if (((j+i) % 3) == 0){ if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } j++; if (j >= Image->SubBitmap->Width){ break; } IP+=3; if (mm>1){ mm >>= 1; } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP++; *MP = 0; mm = 0x80; //////adsfadsf_Variable_Checked } } Image->SubMask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } } Image->SubMask->StopScanLine(); Image->SubBitmap->StopScanLine(); #endif } return; fail: Image->SubBitmap->StopScanLine(); EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //--------------------------------------------------------------------------- void __fastcall TFillForm::MakeExpRMImage(int X, int Y) // È®Àå ȸÀüµÈ À̹ÌÁö¸¦ »Ñ·ÁÁØ´Ù { // Ä¿¼­ÁÖº¯¿¡ int w, h; POINT sp; HDC ExpDC = NULL; TPItemImage *Image = MainImageForm->iMainImage; w = Expbmp->Width; h = Expbmp->Height; if (Image->uBitmap->BitsPerPixel==8) { if ((Image->SubBitmap->Create(w, h, 8, rgb)) == false) goto fail; if ((Image->SubMask->Create(w, h, 8, rgb)) == false) goto fail; } else { if ((Image->SubBitmap->Create(w, h, 24)) == false) goto fail; if ((Image->SubMask->Create(w, h, 1)) == false) goto fail; } sp = SImageLocation(X, Y, Theta); //by jeegeo Image->SubRange.left = sp.x; Image->SubRange.top = sp.y; Image->SubRange.right = sp.x + Image->SubBitmap->Width; Image->SubRange.bottom = sp.y + Image->SubBitmap->Height; if ((ExpDC = Expbmp->CreateDC()) == NULL) goto fail; Image->SubMask->Copy(0, 0, w, h, window.Mask, 0, 0, SRCCOPY); // convert by celberus Image->SubBitmap->UnionBitBlt(ExpDC, 0, 0, w, h, 0, 0, SRCCOPY, true); // convert by celberus Expbmp->DeleteDC(ExpDC); ImageRectPaint(); return; fail: if (Image->SubBitmap) Image->SubBitmap->Destroy(); if (Image->SubMask) Image->SubBitmap->Destroy(); if (ExpDC) Expbmp->DeleteDC(ExpDC); EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //--------------------------------------------------------------------------- void __fastcall TFillForm::ImageRectPaint() { TPItemImage *Image = MainImageForm->iMainImage; RECT r; Image->SubVisible = true; r.left = paintrect.left < Image->SubRange.left ? paintrect.left : Image->SubRange.left; r.top = paintrect.top < Image->SubRange.top ? paintrect.top : Image->SubRange.top; r.right = paintrect.right > Image->SubRange.right ? paintrect.right : Image->SubRange.right; r.bottom = paintrect.bottom > Image->SubRange.bottom ? paintrect.bottom : Image->SubRange.bottom; paintrect = Image->SubRange; Image->RectPaint(r); } //--------------------------------------------------------------------------- POINT __fastcall TFillForm::SImageLocation(int X, int Y, Extended Theta) //by jeegeo { //¶°´Ù´Ï´Â À̹ÌÁöÀÇ ¸¶¿ì½ºÄ¿¼­¿¡ ´ëÇÑ À§Ä¡¸¦ Á¤ÇÑ´Ù int w,h; w=window.size.x; h=window.size.y; if(w==0||h==0)return Point(X,Y); TPItemImage *Image = MainImageForm->iMainImage; Extended r = sqrt(w*w+h*h)/2.0; Extended alpha; // ¾çÀÇ x-axis¿¡ ´ëÇÑ °¢°¢ÀÇ ±ÍÅüÀ̱îÁöÀÇ °¢µµÀÌ´Ù POINT center; // ȸÀüÀÇ Áß½ÉÀÌ´Ù switch(MousePointPlace) { case 1: //Left-Top alpha = Theta + M_PI - atan((Extended)h/(Extended)w); break; case 2: //Right-Top alpha = Theta + atan((Extended)h/(Extended)w); break; case 3: //Left-Bottom alpha = Theta + M_PI +atan((Extended)h/(Extended)w); break; case 4: //Right-Bottom alpha = Theta - atan((Extended)h/(Extended)w); break; case 5: //Center and Initialization center.x = X; center.y = Y; goto centercase; } center = Point(X-r*cos(alpha),Y+r*sin(alpha)); centercase: w = Image->SubBitmap->Width; h = Image->SubBitmap->Height; X = center.x - w/2; Y = center.y - h/2 ; if (X < 0) X = 0; else if (X > Image->uBitmap->Width - w) X = Image->uBitmap->Width - w; if (Y < 0) Y = 0; else if (Y > Image->uBitmap->Height - h) Y = Image->uBitmap->Height - h; return Point(X, Y); } //--------------------------------------------------------------------------- void __fastcall TFillForm::ExpMakeBitmap() { // HDC vhDC = NULL, MhDC = NULL; TPItemImage *Image = MainImageForm->iMainImage; TCaptureData *cd; if (Image->uBitmap->BitsPerPixel == 8) { if ((viewp->Create(ExpRect.size.x, ExpRect.size.y, 8, rgb)) == false) goto fail; // if ((vhDC = viewp->CreateDC()) == NULL) goto fail; convert by celberus // if ((MhDC = Image->uBitmap->CreateDC()) == NULL) goto fail; convert by celberus // SetStretchBltMode(vhDC, COLORONCOLOR); // StretchBlt(vhDC, 0, 0, ExpRect.size.x, ExpRect.size.y, MhDC, source.Left, source.Top, // source.Right - source.Left, source.Bottom - source.Top, SRCCOPY); // Image->uBitmap->DeleteDC(MhDC); // Image->uBitmap->UnionStretchBlt(vhDC, 0, 0, ExpRect.size.x, ExpRect.size.y, source.Left, source.Top, // source.Right - source.Left, source.Bottom - source.Top, SRCCOPY); // convert by celberus viewp->UnionStretchBlt(0, 0, ExpRect.size.x, ExpRect.size.y, Image->uBitmap, source.Left, source.Top, source.Right - source.Left, source.Bottom - source.Top, SRCCOPY); // convert by celberus // viewp->DeleteDC(vhDC); window.s.x = ExpRect.s.x; window.s.y = ExpRect.s.y; window.e.x = ExpRect.e.x; window.e.y = ExpRect.e.y; window.size.x = ExpRect.size.x; window.size.y = ExpRect.size.y; } else { #if !(defined(ACADEMY) || defined(KNIT)) cd = (TCaptureData *)CaptureData->Items[captureindex]; if ((viewp->Create(ExpRect.size.x, ExpRect.size.y, 24)) == false) goto fail; // if ((vhDC = viewp->CreateDC()) == NULL) goto fail; convert by celberus // if ((MhDC = cd->Bitmap->CreateDC()) == NULL) goto fail; convert by celberus // SetStretchBltMode(vhDC, COLORONCOLOR); // StretchBlt(vhDC, 0, 0, ExpRect.size.x, ExpRect.size.y, // MhDC, 0, 0, cd->Bitmap->Width, cd->Bitmap->Height, SRCCOPY); viewp->UnionStretchBlt(0, 0, ExpRect.size.x, ExpRect.size.y, cd->Bitmap, 0, 0, cd->Bitmap->Width, cd->Bitmap->Height, SRCCOPY); // convert by celberus // cd->Bitmap->DeleteDC(MhDC); // viewp->DeleteDC(vhDC); window.size.x = ExpRect.size.x; window.size.y = ExpRect.size.y; #endif } if (sbTNPattern->Down) cbRepeatTypeChange((TObject *)RepeatItem); return; fail: // if (vhDC) viewp->DeleteDC(vhDC); EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //------------------------------------------------------------------------- //=============================================== by hjs 00.09.14 void __fastcall TFillForm::sbBeforeShapeClick(TObject *Sender) { if(sbTRPattern->Down){ sbBeforeShape->Enabled = false; sbBeforeDeg->Enabled = true; TCursor oldcur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->iMainImage->SubVisible = false; Theta = BeforeTheta; spDeg->Value = 0; //lhskys °¢¸¸ ÀÌÀü °¢À¸·Î // int deg = RadToDeg(Theta); // spDeg->Value = deg; // rstep = 2; rstep = 0; if (cbExp->Checked) { expStep = 2; ExpRect = beforesize; ExpMakeBitmap(); } // if (patternfill_image_rotate()) { MakeFillImage(0); // } Screen->Cursor = oldcur; MainImageForm->iMainImage->Repaint(); } else { TCursor oldcur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->iMainImage->SubVisible = false; if (cbExp->Checked) { expStep = 2; ExpRect = beforesize; ExpMakeBitmap(); } MakeFillImage(0); Screen->Cursor = oldcur; MainImageForm->iMainImage->Repaint(); } MainImageForm->sbVert->SetFocus(); } /* // È®´ëÃà¼Ò½Ã ÀÌÀü¿¡ »ç¿ëµÈ À̹ÌÁöÀÇ Å©±â·Î ȯ¿ø ½ÃÄÑ ´Ù½Ã »ç¿ëÇϱâ À§ÇØ TCursor oldcur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->iMainImage->SubVisible = false; // spDeg->Value = 0; //lhskys ÀüºÎ ½ÇÇàÇß´ø °ÍÀ¸·Î... //====================================================== Theta = BeforeTheta; int deg = RadToDeg(Theta); spDeg->Value = deg; rstep = 2; if (patternfill_image_rotate()) { MakeFillImage(deg); } //======================================================= if (cbExp->Checked) { expStep = 2; ExpRect = beforesize; ExpMakeBitmap(); } // if (patternfill_image_rotate()) { // MakeFillImage(0); // } Screen->Cursor = oldcur; MainImageForm->iMainImage->Repaint(); // cbExp->Checked = false; } //=============================================== //---------------------------------------------------------------------------*/ void __fastcall TFillForm::cbRepeatTypeKeyPress(TObject *Sender, char &Key) { TypeName = cbRepeatType->Text; } //--------------------------------------------------------------------------- void __fastcall TFillForm::MouseStopTimer(TObject *Sender) { if(rstep != 1)return; // by celberus POINT sp; MouseStop->Enabled = false; if (patternfill_image_rotate(ROTATEP_X1, ROTATEP_Y1)) { //ȸÀüÀÇ Áß½É? X,Y? °ú¿¬Àǹ̰¡ ÀÖÀ»±î? MakeFillImagePreView(RadToDeg(Theta)); } if (bExp) { MakeExpRMImage(ROTATEP_X, ROTATEP_Y); } else { sp = SImageLocation(ROTATEP_X, ROTATEP_Y, Theta); //ȸÀüµÈ À̹ÌÁöÀÇ ¸¶¿ì½º Ä¿¼­¿¡ ´ëÇÑ À§Ä¡¸¦ Á¤ÇÑ´Ù. //by jeegeo CommonMouseMove(sp.x, sp.y); } } //--------------------------------------------------------------------------- void __fastcall TFillForm::MakeFillImagePreView(int deg) { int i, j; Byte *IP, *WP, *MP, mm; COLORREF crrf, fcol, bgc; HDC /*MhDC = NULL, ThDC = NULL, PhDC = NULL,*/ FhDC = NULL; TPoint size; deg = 360 - deg; TUnionBitmap *TempBitmap = NULL; TPItemImage *Image = MainImageForm->iMainImage; if ((TempBitmap = new TUnionBitmap) == NULL) goto fail; if (Image->uBitmap->BitsPerPixel == 8) { if (!(TempBitmap->Create(window.size.x, window.size.y, 8, rgb))) goto fail; if (bExp) { // if ((MhDC = Image->uBitmap->CreateDC()) == NULL) goto fail; convert by celberus // if ((ThDC = TempBitmap->CreateDC()) == NULL) goto fail; // SetStretchBltMode(ThDC, COLORONCOLOR); // StretchBlt(ThDC, 0, 0, window.size.x, window.size.y, MhDC, source.Left, source.Top, // source.Right - source.Left, source.Bottom - source.Top, SRCCOPY); // TempBitmap->DeleteDC(ThDC); ThDC = NULL; // Image->uBitmap->DeleteDC(MhDC); MhDC = NULL; // Image->uBitmap->UnionStretchBlt(ThDC, 0, 0, window.size.x, window.size.y, source.Left, source.Top, // source.Right - source.Left, source.Bottom - source.Top, SRCCOPY); // convert by celberus TempBitmap->UnionStretchBlt(0, 0, window.size.x, window.size.y, Image->uBitmap, source.Left, source.Top, source.Right - source.Left, source.Bottom - source.Top, SRCCOPY); // convert by celberus } else { // TempBitmap->CopyFromRect(Image->uBitmap, window.s.x, window.s.y, SRCCOPY); // HDC tempDC; // // tempDC = TempBitmap->CreateDC(); // // Image->uBitmap->UnionBitBlt(tempDC, 0, 0, viewp->Width, viewp->Height, window.s.x, window.s.y, SRCCOPY, false); // TempBitmap->Copy(0, 0, viewp->Width, viewp->Height, Image->uBitmap, window.s.x, window.s.y, SRCCOPY); // TempBitmap->DeleteDC(tempDC); // convert by celberus } TempBitmap->Rotate(deg*100, true, PALETTEINDEX(0)); size = Point(TempBitmap->Width, TempBitmap->Height); if (bExp) { if (!(Expbmp->Create(size.x, size.y, 8, rgb))) goto fail; if ((FhDC = Expbmp->CreateDC()) == NULL) goto fail; // if ((ThDC = TempBitmap->CreateDC()) == NULL) goto fail; // BitBlt(FhDC, 0, 0, size.x, size.y, ThDC, 0, 0, SRCCOPY); TempBitmap->UnionBitBlt(FhDC, 0, 0, size.x, size.y, 0, 0, SRCCOPY, false); // convert by celberus // TempBitmap->DeleteDC(ThDC); ThDC = NULL; Expbmp->DeleteDC(FhDC); FhDC = NULL; } if (!(Image->SubBitmap->Create(size.x, size.y, 8, rgb))) goto fail; if (!(Image->SubMask->Create(size.x, size.y, 8, rgb))) goto fail; if (!(window.Bitmap->Create(size.x, size.y, 8, rgb))) goto fail; if (!(window.Mask->Create(size.x, size.y, 8, rgb))) goto fail; if (!(window.Back->Create(size.x, size.y, 8, rgb))) goto fail; if (!(TempBitmap->StartScanLine())) goto fail; if (!(window.Bitmap->StartScanLine())) goto fail; if (!(window.Mask->StartScanLine())) goto fail; if (FullViewForm->Super == sOff) { StatusProgress->Maximum = TempBitmap->Height - 1; for (i=0; iHeight; i++) { IP = TempBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (j=0; jWidth; j++, IP++, WP++, MP++) { //////adsfadsf_for if (*IP) { if ((j+i) % 3) { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = *IP;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = 0;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0xFF;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = 0; *MP = 0xFF;//////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf StatusProgress->Position = i; } StatusProgress->End(); } else { StatusProgress->Maximum = TempBitmap->Height - 1; for (i=0; iHeight; i++) { IP = TempBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (j=0; jWidth; j++, IP++, WP++, MP++) { //////adsfadsf_for if (*IP > 1) { if ((j+i) % 3) { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = *IP;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0;//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = 0;//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP = 0xFF;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *WP = 0; *MP = 0xFF;//////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf StatusProgress->Position = i; } StatusProgress->End(); } window.Mask->StopScanLine(); window.Bitmap->StopScanLine(); TempBitmap->StopScanLine(); /* if (bExp) { if (!(window.Bitmap->StartScanLine())) goto fail; if (!(window.Mask->StartScanLine())) goto fail; if (!(FillImage->uBitmap->StartScanLine())) goto fail; for (i=0; iuBitmap->Height; i++) { IP = FillImage->uBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); int StartX = 0; int EndX = 0; //adsfadsf_for_declare for (j=0; juBitmap->Width; j++, IP++, WP++, MP++) { //////adsfadsf_for if (*MP == 0){ if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *IP = *WP;//////adsfadsf_Variable_Checked } } FillImage->uBitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf } FillImage->uBitmap->StopScanLine(); window.Mask->StopScanLine(); window.Bitmap->StopScanLine(); } */ } else { #ifndef ACADEMY TCaptureData *cd = (TCaptureData *)CaptureData->Items[cbPattern->ItemIndex]; if (!(TempBitmap->Create(window.size.x, window.size.y, 24))) goto fail; if (bExp) { // if ((ThDC = TempBitmap->CreateDC()) == NULL) goto fail; // if ((PhDC = cd->Bitmap->CreateDC()) == NULL) goto fail; // SetStretchBltMode(ThDC, COLORONCOLOR); // StretchBlt(ThDC, 0, 0, window.size.x, window.size.y, PhDC, 0, 0, // cd->Bitmap->Width, cd->Bitmap->Height, SRCCOPY); TempBitmap->UnionStretchBlt(0, 0, window.size.x, window.size.y, cd->Bitmap, 0, 0, cd->Bitmap->Width, cd->Bitmap->Height, SRCCOPY); // convert by celberus // cd->Bitmap->DeleteDC(PhDC); // TempBitmap->DeleteDC(ThDC); } else { TempBitmap->Copy(cd->Bitmap, SRCCOPY); } crrf = SearchFillColor(TempBitmap); TempBitmap->Rotate(deg*100, true, crrf); size = Point(TempBitmap->Width, TempBitmap->Height); if (bExp) { if (!(Expbmp->Create(size.x, size.y, 24))) goto fail; if ((FhDC = Expbmp->CreateDC()) == NULL) goto fail; // if ((ThDC = TempBitmap->CreateDC()) == NULL) goto fail; // BitBlt(FhDC, 0, 0, size.x, size.y, ThDC, 0, 0, SRCCOPY); TempBitmap->UnionBitBlt(FhDC, 0, 0, size.x, size.y, 0, 0, SRCCOPY, false); // convert by celberus // TempBitmap->DeleteDC(ThDC); ThDC = NULL; Expbmp->DeleteDC(FhDC); FhDC = NULL; } if (!(Image->SubBitmap->Create(size.x, size.y, 24))) goto fail; if (!(Image->SubMask->Create(size.x, size.y, 1))) goto fail; if (!(window.Bitmap->Create(size.x, size.y, 24))) goto fail; if (!(window.Mask->Create(size.x, size.y, 1))) goto fail; if (!(window.Back->Create(size.x, size.y, 24))) goto fail; if (!(TempBitmap->StartScanLine())) goto fail; if (!(window.Bitmap->StartScanLine())) goto fail; if (!(window.Mask->StartScanLine())) goto fail; if (FullViewForm->Super == sOff) { StatusProgress->Maximum = size.y -1; for (int i=0; i < size.y; i++) { IP = TempBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); *MP = 0; mm = 0x80; int StartX = 0; int EndX = 0; //adsfadsf_for_declare j=0; while(1) { //////adsfadsf_while GetPixel24(IP, fcol); if (fcol != crrf) { if ((j+i) % 3) { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 CopyPixel24(WP, IP);//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 SetPixel24(WP, 0);//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 SetPixel24(WP, 0);//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } j++; if (j >= size.x){ break; } if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 IP+=3; WP+=3;//////adsfadsf_Variable_Checked if (mm>1){ mm >>= 1; } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP++; *MP = 0; mm = 0x80; //////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf StatusProgress->Position = i; } StatusProgress->End(); } else { bgc = PaletteForm->DIB256Palette->GetBGCOLORREF(24); StatusProgress->Maximum = size.y - 1; for (int i=0; i < size.y; i++) { IP = TempBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); *MP = 0; mm = 0x80; int StartX = 0; int EndX = 0; //adsfadsf_for_declare j=0; while(1) { //////adsfadsf_while GetPixel24(IP, fcol); if (fcol != crrf && fcol != bgc) { if ((j+i) % 3) { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 CopyPixel24(WP, IP);//////adsfadsf_Variable_Checked } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 SetPixel24(WP, 0);//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 SetPixel24(WP, 0);//////adsfadsf_Variable_Checked if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 *MP |= mm;//////adsfadsf_Variable_Checked } j++; if (j >= size.x){ break; } if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 IP+=3; WP+=3;//////adsfadsf_Variable_Checked if (mm>1){ mm >>= 1; } else { if(EndX==0){StartX=j;} EndX=j; //adsfadsf_i_f1 MP++; *MP = 0; mm = 0x80; //////adsfadsf_Variable_Checked } } window.Bitmap->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf window.Mask->PutScanLine(i,StartX,EndX-StartX+1); ////adsfadsf StatusProgress->Position = i; } StatusProgress->End(); } window.Mask->StopScanLine(); window.Bitmap->StopScanLine(); TempBitmap->StopScanLine(); /* if (bExp) { if (!(window.Bitmap->StartScanLine())) goto fail; if (!(window.Mask->StartScanLine())) goto fail; if (!(FillImage->uBitmap->StartScanLine())) goto fail; for (i=0; iuBitmap->Height; i++) { IP = FillImage->uBitmap->GetScanLine(i); WP = window.Bitmap->GetScanLine(i); MP = window.Mask->GetScanLine(i); mm = 0x80; j=0; while(1) { if (*MP& mm == 0) *IP = *WP; j++; if (j >= FillImage->uBitmap->Width) break; IP+=3; WP+=3; if (mm>1) mm >>= 1; else { MP++; *MP = 0; mm = 0x80; } } FillImage->uBitmap->PutScanLine(i); } FillImage->uBitmap->StopScanLine(); window.Mask->StopScanLine(); window.Bitmap->StopScanLine(); } */ #endif } delete TempBitmap; TempBitmap = NULL; return; fail: // if (ThDC) TempBitmap->DeleteDC(ThDC); convert by celberus // if (MhDC) Image->uBitmap->DeleteDC(MhDC); convert by celberus if (Expbmp) Expbmp->Destroy(); window.Mask->StopScanLine(); window.Bitmap->StopScanLine(); TempBitmap->StopScanLine(); if (TempBitmap) delete TempBitmap; EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //--------------------------------------------------------------------------- void __fastcall TFillForm::makeSpreadImage_Normal(TUnionBitmap *aBitmap) { 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); } //--------------------------------------------------------------------------- void __fastcall TFillForm::makeSpreadImage_HDVer(TUnionBitmap *aBitmap) // half drop vertical { 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); } } //--------------------------------------------------------------------------- void __fastcall TFillForm::makeSpreadImage_HDHor(TUnionBitmap *aBitmap) // half drop horizontal { 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); } } //--------------------------------------------------------------------------- void __fastcall TFillForm::SpreadArea() { // int sx, sy, ex, ey; // int hw, hh; // int Wdiv, Hdiv; // HDC LhDC = NULL, /*MhDC = NULL, MMhDC = NULL*/; // convert by celberus // int ARWidthR = MainImageForm->WidthR, ARHeightR = MainImageForm->HeightR; // sx = MainImageForm->arwindow.s.x; // sy = MainImageForm->arwindow.s.y; // ex = MainImageForm->arwindow.e.x; // ey = MainImageForm->arwindow.e.y; // hw = (ex - sx)/2; hh = (ey - sy)/2; // Wdiv = MainImageForm->MWdiv; // Hdiv = MainImageForm->MHdiv; //========================================= Delete WorkArea for BitBlt if (MainImageForm->WorkArea->Mask) { MainImageForm->WorkArea->ResetRegion(MainImageForm->iMainImage); MainImageForm->WorkAreaChange(); } //========================================== // if ((MhDC = MainImageForm->iMainImage->uBitmap->CreateDC()) == NULL) goto fail; convert by celberus // if (MainImageForm->iMainImage->Mask) // if ((MMhDC = MainImageForm->iMainImage->Mask->CreateDC()) == NULL) goto fail; // if (MainImageForm->iMainImage->LayerMask) // if ((LhDC = MainImageForm->iMainImage->LayerMask->CreateDC()) == NULL) goto fail; if (MainImageForm->ARTItem == AREPEAT_NORMAL) { // BitBlt(MhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, hh+ARHeightR, MhDC, sx+hw, sy+hh, SRCCOPY); // BitBlt(MhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, ex, sy-hh-ARHeightR, hw, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR,MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, ex, sy, hw, 2*hh+ARHeightR,MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, ey, hw+ARWidthR, hh, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, sx, ey, 2*hw+ARWidthR, hh, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, ex, ey, hw, hh, MhDC, sx, sy, SRCCOPY); makeSpreadImage_Normal(MainImageForm->iMainImage->uBitmap); // convert by celberus if (MainImageForm->iMainImage->Mask) { // BitBlt(MMhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, hh+ARHeightR, MMhDC, sx+hw, sy+hh, SRCCOPY); // BitBlt(MMhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); // BitBlt(MMhDC, ex, sy-hh-ARHeightR, hw, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); // BitBlt(MMhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, MMhDC, sx+hw, sy, SRCCOPY); // BitBlt(MMhDC, ex, sy, hw, 2*hh+ARHeightR, MMhDC, sx, sy, SRCCOPY); // BitBlt(MMhDC, sx-hw-ARWidthR, ey, hw+ARWidthR, hh, MMhDC, sx+hw, sy, SRCCOPY); // BitBlt(MMhDC, sx, ey, 2*hw+ARWidthR, hh, MMhDC, sx, sy, SRCCOPY); // BitBlt(MMhDC, ex, ey, hw, hh, MMhDC, sx, sy, SRCCOPY); makeSpreadImage_Normal(MainImageForm->iMainImage->Mask); // convert by celberus } if (MainImageForm->iMainImage->LayerMask) { // BitBlt(LhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, hh+ARHeightR, LhDC, sx+hw, sy+hh, SRCCOPY); // BitBlt(LhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); // BitBlt(LhDC, ex, sy-hh-ARHeightR, hw, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); // BitBlt(LhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, LhDC, sx+hw, sy, SRCCOPY); // BitBlt(LhDC, ex, sy, hw, 2*hh+ARHeightR, LhDC, sx, sy, SRCCOPY); // BitBlt(LhDC, sx-hw-ARWidthR, ey, hw+ARWidthR, hh, LhDC, sx+hw, sy, SRCCOPY); // BitBlt(LhDC, sx, ey, 2*hw+ARWidthR, hh, LhDC, sx, sy, SRCCOPY); // BitBlt(LhDC, ex, ey, hw, hh, LhDC, sx, sy, SRCCOPY); makeSpreadImage_Normal(MainImageForm->iMainImage->LayerMask); // convert by celberus } } else if (MainImageForm->ARTItem == AREPEAT_HDVER) { //¼¼·ÎºÐÇÒ makeSpreadImage_HDVer(MainImageForm->iMainImage->uBitmap); // convert by celberus // if(hh > Hdiv){ // BitBlt(MhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, hh-Hdiv+ARHeightR, MhDC, sx+hw, sy+hh+Hdiv, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, sy-Hdiv, hw+ARWidthR, 2*hh+ARHeightR, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, ey-Hdiv, hw+ARWidthR, hh+Hdiv, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, ex, sy-hh-ARHeightR, hw, hh+Hdiv+ARHeightR, MhDC, sx, sy+hh-Hdiv, SRCCOPY); // BitBlt(MhDC, ex, sy+Hdiv, hw, 2*hh+ARHeightR, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, ex, ey+Hdiv, hw, hh-Hdiv, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, sx, ey, 2*hw+ARWidthR, hh, MhDC, sx, sy, SRCCOPY); // }else if(hh == Hdiv){ // BitBlt(MhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, 2*hh+ARHeightR, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, sy+hh, hw+ARWidthR, 2*hh+ARHeightR, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, ex, sy-hh-ARHeightR, hw, 2*hh+ARHeightR, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, ex, sy+hh, hw, 2*hh+ARHeightR, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, sx, ey, 2*hw+ARWidthR, hh, MhDC, sx, sy, SRCCOPY); // }else if(hh < Hdiv){ // BitBlt(MhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, 3*hh-Hdiv+2*ARHeightR, MhDC, sx+hw, sy+Hdiv-hh-ARHeightR, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, ey-Hdiv, hw+ARWidthR, 2*hh+ARHeightR, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, ey+2*hh-Hdiv+ARHeightR, hw+ARWidthR, Hdiv-hh-ARHeightR, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, ex, sy-hh-ARHeightR, hw, Hdiv-hh+ARHeightR, MhDC, sx, ey+hh-Hdiv, SRCCOPY); // BitBlt(MhDC, ex, sy-2*hh+Hdiv-ARHeightR, hw, 2*hh+ARHeightR, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, ex, sy+Hdiv, hw, 3*hh-Hdiv+ARHeightR, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, sx, ey, 2*hw+ARWidthR, hh, MhDC, sx, sy, SRCCOPY); // } if (MainImageForm->iMainImage->Mask) { makeSpreadImage_HDVer(MainImageForm->iMainImage->Mask); // convert by celberus /* if(hh > Hdiv){ // BitBlt(MMhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, hh-Hdiv+ARHeightR, MMhDC, sx+hw, sy+hh+Hdiv, SRCCOPY); // BitBlt(MMhDC, sx-hw-ARWidthR, sy-Hdiv, hw+ARWidthR, 2*hh+ARHeightR, MMhDC, sx+hw, sy, SRCCOPY); // BitBlt(MMhDC, sx-hw-ARWidthR, ey-Hdiv, hw+ARWidthR, hh+Hdiv, MMhDC, sx+hw, sy, SRCCOPY); // BitBlt(MMhDC, ex, sy-hh-ARHeightR, hw, hh+Hdiv+ARHeightR, MMhDC, sx, sy+hh-Hdiv, SRCCOPY); // BitBlt(MMhDC, ex, sy+Hdiv, hw, 2*hh+ARHeightR, MMhDC, sx, sy, SRCCOPY); // BitBlt(MMhDC, ex, ey+Hdiv, hw, hh-Hdiv, MMhDC, sx, sy, SRCCOPY); // BitBlt(MMhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); // BitBlt(MMhDC, sx, ey, 2*hw+ARWidthR, hh, MMhDC, sx, sy, SRCCOPY); MainImageForm->iMainImage->Mask->CopyToItself( sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, hh-Hdiv+ARHeightR, sx+hw, sy+hh+Hdiv, SRCCOPY); // convert by celberus MainImageForm->iMainImage->Mask->CopyToItself( sx-hw-ARWidthR, sy-Hdiv, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->Mask->CopyToItself( sx-hw-ARWidthR, ey-Hdiv, hw+ARWidthR, hh+Hdiv, sx+hw, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->Mask->CopyToItself( ex, sy-hh-ARHeightR, hw, hh+Hdiv+ARHeightR, sx, sy+hh-Hdiv, SRCCOPY); // convert by celberus MainImageForm->iMainImage->Mask->CopyToItself( ex, sy+Hdiv, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->Mask->CopyToItself( ex, ey+Hdiv, hw, hh-Hdiv, sx, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->Mask->CopyToItself( sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); // convert by celberus MainImageForm->iMainImage->Mask->CopyToItself( sx, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); // convert by celberus }else if(hh == Hdiv){ BitBlt(MMhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, 2*hh+ARHeightR, MMhDC, sx+hw, sy, SRCCOPY); BitBlt(MMhDC, sx-hw-ARWidthR, sy+hh, hw+ARWidthR, 2*hh+ARHeightR, MMhDC, sx+hw, sy, SRCCOPY); BitBlt(MMhDC, ex, sy-hh-ARHeightR, hw, 2*hh+ARHeightR, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, ex, sy+hh, hw, 2*hh+ARHeightR, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); BitBlt(MMhDC, sx, ey, 2*hw+ARWidthR, hh, MMhDC, sx, sy, SRCCOPY); }else if(hh < Hdiv){ BitBlt(MMhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, 3*hh-Hdiv+2*ARHeightR, MMhDC, sx+hw, sy+Hdiv-hh-ARHeightR, SRCCOPY); BitBlt(MMhDC, sx-hw-ARWidthR, ey-Hdiv, hw+ARWidthR, 2*hh+ARHeightR, MMhDC, sx+hw, sy, SRCCOPY); BitBlt(MMhDC, sx-hw-ARWidthR, ey+2*hh-Hdiv+ARHeightR, hw+ARWidthR, Hdiv-hh-ARHeightR, MMhDC, sx+hw, sy, SRCCOPY); BitBlt(MMhDC, ex, sy-hh-ARHeightR, hw, Hdiv-hh+ARHeightR, MMhDC, sx, ey+hh-Hdiv, SRCCOPY); BitBlt(MMhDC, ex, sy-2*hh+Hdiv-ARHeightR, hw, 2*hh+ARHeightR, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, ex, sy+Hdiv, hw, 3*hh-Hdiv+ARHeightR, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); BitBlt(MMhDC, sx, ey, 2*hw+ARWidthR, hh, MMhDC, sx, sy, SRCCOPY); }*/ } if (MainImageForm->iMainImage->LayerMask) { makeSpreadImage_HDVer(MainImageForm->iMainImage->LayerMask); // convert by celberus /* if(hh > Hdiv){ BitBlt(LhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, hh-Hdiv+ARHeightR, LhDC, sx+hw, sy+hh+Hdiv, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, sy-Hdiv, hw+ARWidthR, 2*hh+ARHeightR, LhDC, sx+hw, sy, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, ey-Hdiv, hw+ARWidthR, hh+Hdiv, LhDC, sx+hw, sy, SRCCOPY); BitBlt(LhDC, ex, sy-hh-ARHeightR, hw, hh+Hdiv+ARHeightR, LhDC, sx, sy+hh-Hdiv, SRCCOPY); BitBlt(LhDC, ex, sy+Hdiv, hw, 2*hh+ARHeightR, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, ex, ey+Hdiv, hw, hh-Hdiv, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); BitBlt(LhDC, sx, ey, 2*hw+ARWidthR, hh, LhDC, sx, sy, SRCCOPY); }else if(hh == Hdiv){ BitBlt(LhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, 2*hh+ARHeightR, LhDC, sx+hw, sy, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, sy+hh, hw+ARWidthR, 2*hh+ARHeightR, LhDC, sx+hw, sy, SRCCOPY); BitBlt(LhDC, ex, sy-hh-ARHeightR, hw, 2*hh+ARHeightR, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, ex, sy+hh, hw, 2*hh+ARHeightR, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); BitBlt(LhDC, sx, ey, 2*hw+ARWidthR, hh, LhDC, sx, sy, SRCCOPY); }else if(hh < Hdiv){ BitBlt(LhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw+ARWidthR, 3*hh-Hdiv+2*ARHeightR, LhDC, sx+hw, sy+Hdiv-hh-ARHeightR, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, ey-Hdiv, hw+ARWidthR, 2*hh+ARHeightR, LhDC, sx+hw, sy, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, ey+2*hh-Hdiv+ARHeightR, hw+ARWidthR, Hdiv-hh-ARHeightR, LhDC, sx+hw, sy, SRCCOPY); BitBlt(LhDC, ex, sy-hh-ARHeightR, hw, Hdiv-hh+ARHeightR, LhDC, sx, ey+hh-Hdiv, SRCCOPY); BitBlt(LhDC, ex, sy-2*hh+Hdiv-ARHeightR, hw, 2*hh+ARHeightR, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, ex, sy+Hdiv, hw, 3*hh-Hdiv+ARHeightR, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, sx, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); BitBlt(LhDC, sx, ey, 2*hw+ARWidthR, hh, LhDC, sx, sy, SRCCOPY); }*/ } } else if (MainImageForm->ARTItem == AREPEAT_HDHOR) { //°¡·ÎºÐÇÒ makeSpreadImage_HDHor(MainImageForm->iMainImage->uBitmap); // convert by celberus /* if(hw > Wdiv){ // BitBlt(MhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw-Wdiv+ARWidthR, hh+ARHeightR, MhDC, sx+hw+Wdiv, sy+hh, SRCCOPY); // BitBlt(MhDC, sx-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, ex-Wdiv, sy-hh-ARHeightR, hw+Wdiv, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, ey, hw+Wdiv+ARWidthR, hh, MhDC, sx+hw-Wdiv, sy, SRCCOPY); // BitBlt(MhDC, sx+Wdiv, ey, 2*hw+ARWidthR, hh, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, ex+Wdiv, ey, hw-Wdiv, hh, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, ex, sy, hw, 2*hh+ARHeightR, MhDC, sx, sy, SRCCOPY); MainImageForm->iMainImage->uBitmap->CopyToItself( sx-hw-ARWidthR, sy-hh-ARHeightR, hw-Wdiv+ARWidthR, hh+ARHeightR, sx+hw+Wdiv, sy+hh, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( ex-Wdiv, sy-hh-ARHeightR, hw+Wdiv, hh+ARHeightR, sx, sy+hh, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx-hw-ARWidthR, ey, hw+Wdiv+ARWidthR, hh, sx+hw-Wdiv, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx+Wdiv, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( ex+Wdiv, ey, hw-Wdiv, hh, sx, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( ex, sy, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); // convert by celberus }else if(hw == Wdiv){ // BitBlt(MhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, sx+hw, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, ey, 2*hw+ARWidthR, hh, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, sx+hw, ey, 2*hw+ARWidthR, hh, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, ex, sy, hw, 2*hh+ARHeightR, MhDC, sx, sy, SRCCOPY); MainImageForm->iMainImage->uBitmap->CopyToItself( sx-hw-ARWidthR, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx+hw, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx-hw-ARWidthR, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx+hw, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( ex, sy, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); // convert by celberus }else if(hw < Wdiv){ // BitBlt(MhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, 3*hw-Wdiv+2*ARWidthR, hh+ARHeightR, MhDC, sx-hw+Wdiv-ARWidthR, sy+hh, SRCCOPY); // BitBlt(MhDC, ex-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, ex+2*hw-Wdiv+ARWidthR, sy-hh-ARHeightR, Wdiv-hw-ARWidthR, hh+ARHeightR, MhDC, sx, sy+hh, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, ey, Wdiv-hw+ARWidthR, hh, MhDC, ex+hw-Wdiv, sy, SRCCOPY); // BitBlt(MhDC, sx-2*hw+Wdiv-ARWidthR, ey, 2*hw+ARWidthR, hh, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, sx+Wdiv, ey, 3*hw-Wdiv+ARWidthR, hh, MhDC, sx, sy, SRCCOPY); // BitBlt(MhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, MhDC, sx+hw, sy, SRCCOPY); // BitBlt(MhDC, ex, sy, hw, 2*hh+ARHeightR, MhDC, sx, sy, SRCCOPY); MainImageForm->iMainImage->uBitmap->CopyToItself( sx-hw-ARWidthR, sy-hh-ARHeightR, 3*hw-Wdiv+2*ARWidthR, hh+ARHeightR, sx-hw+Wdiv-ARWidthR, sy+hh, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( ex-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( ex+2*hw-Wdiv+ARWidthR, sy-hh-ARHeightR, Wdiv-hw-ARWidthR, hh+ARHeightR, sx, sy+hh, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx-hw-ARWidthR, ey, Wdiv-hw+ARWidthR, hh, ex+hw-Wdiv, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx-2*hw+Wdiv-ARWidthR, ey, 2*hw+ARWidthR, hh, sx, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx+Wdiv, ey, 3*hw-Wdiv+ARWidthR, hh, sx, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, sx+hw, sy, SRCCOPY); // convert by celberus MainImageForm->iMainImage->uBitmap->CopyToItself( ex, sy, hw, 2*hh+ARHeightR, sx, sy, SRCCOPY); // convert by celberus }*/ if (MainImageForm->iMainImage->Mask) { makeSpreadImage_HDHor(MainImageForm->iMainImage->Mask); // convert by celberus /* if(hw > Wdiv){ BitBlt(MMhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw-Wdiv+ARWidthR, hh+ARHeightR, MMhDC, sx+hw+Wdiv, sy+hh, SRCCOPY); BitBlt(MMhDC, sx-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); BitBlt(MMhDC, ex-Wdiv, sy-hh-ARHeightR, hw+Wdiv, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); BitBlt(MMhDC, sx-hw-ARWidthR, ey, hw+Wdiv+ARWidthR, hh, MMhDC, sx+hw-Wdiv, sy, SRCCOPY); BitBlt(MMhDC, sx+Wdiv, ey, 2*hw+ARWidthR, hh, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, ex+Wdiv, ey, hw-Wdiv, hh, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, MMhDC, sx+hw, sy, SRCCOPY); BitBlt(MMhDC, ex, sy, hw, 2*hh+ARHeightR, MMhDC, sx, sy, SRCCOPY); }else if(hw == Wdiv){ BitBlt(MMhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); BitBlt(MMhDC, sx+hw, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); BitBlt(MMhDC, sx-hw-ARWidthR, ey, 2*hw+ARWidthR, hh, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, sx+hw, ey, 2*hw+ARWidthR, hh, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, MMhDC, sx+hw, sy, SRCCOPY); BitBlt(MMhDC, ex, sy, hw, 2*hh+ARHeightR, MMhDC, sx, sy, SRCCOPY); }else if(hw < Wdiv){ BitBlt(MMhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, 3*hw-Wdiv+2*ARWidthR, hh+ARHeightR, MMhDC, sx-hw+Wdiv-ARWidthR, sy+hh, SRCCOPY); BitBlt(MMhDC, ex-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); BitBlt(MMhDC, ex+2*hw-Wdiv+ARWidthR, sy-hh-ARHeightR, Wdiv-hw-ARWidthR, hh+ARHeightR, MMhDC, sx, sy+hh, SRCCOPY); BitBlt(MMhDC, sx-hw-ARWidthR, ey, Wdiv-hw+ARWidthR, hh, MMhDC, ex+hw-Wdiv, sy, SRCCOPY); BitBlt(MMhDC, sx-2*hw+Wdiv-ARWidthR, ey, 2*hw+ARWidthR, hh, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, sx+Wdiv, ey, 3*hw-Wdiv+ARWidthR, hh, MMhDC, sx, sy, SRCCOPY); BitBlt(MMhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, MMhDC, sx+hw, sy, SRCCOPY); BitBlt(MMhDC, ex, sy, hw, 2*hh+ARHeightR, MMhDC, sx, sy, SRCCOPY); }*/ } if (MainImageForm->iMainImage->LayerMask) { makeSpreadImage_HDHor(MainImageForm->iMainImage->LayerMask); // convert by celberus /* if(hw > Wdiv){ BitBlt(LhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, hw-Wdiv+ARWidthR, hh+ARHeightR, LhDC, sx+hw+Wdiv, sy+hh, SRCCOPY); BitBlt(LhDC, sx-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); BitBlt(LhDC, ex-Wdiv, sy-hh-ARHeightR, hw+Wdiv, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, ey, hw+Wdiv+ARWidthR, hh, LhDC, sx+hw-Wdiv, sy, SRCCOPY); BitBlt(LhDC, sx+Wdiv, ey, 2*hw+ARWidthR, hh, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, ex+Wdiv, ey, hw-Wdiv, hh, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, LhDC, sx+hw, sy, SRCCOPY); BitBlt(LhDC, ex, sy, hw, 2*hh+ARHeightR, LhDC, sx, sy, SRCCOPY); }else if(hw == Wdiv){ BitBlt(LhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); BitBlt(LhDC, sx+hw, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, ey, 2*hw+ARWidthR, hh, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, sx+hw, ey, 2*hw+ARWidthR, hh, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, LhDC, sx+hw, sy, SRCCOPY); BitBlt(LhDC, ex, sy, hw, 2*hh+ARHeightR, LhDC, sx, sy, SRCCOPY); }else if(hw < Wdiv){ BitBlt(LhDC, sx-hw-ARWidthR, sy-hh-ARHeightR, 3*hw-Wdiv+2*ARWidthR, hh+ARHeightR, LhDC, sx-hw+Wdiv-ARWidthR, sy+hh, SRCCOPY); BitBlt(LhDC, ex-Wdiv, sy-hh-ARHeightR, 2*hw+ARWidthR, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); BitBlt(LhDC, ex+2*hw-Wdiv+ARWidthR, sy-hh-ARHeightR, Wdiv-hw-ARWidthR, hh+ARHeightR, LhDC, sx, sy+hh, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, ey, Wdiv-hw+ARWidthR, hh, LhDC, ex+hw-Wdiv, sy, SRCCOPY); BitBlt(LhDC, sx-2*hw+Wdiv-ARWidthR, ey, 2*hw+ARWidthR, hh, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, sx+Wdiv, ey, 3*hw-Wdiv+ARWidthR, hh, LhDC, sx, sy, SRCCOPY); BitBlt(LhDC, sx-hw-ARWidthR, sy, hw+ARWidthR, 2*hh+ARHeightR, LhDC, sx+hw, sy, SRCCOPY); BitBlt(LhDC, ex, sy, hw, 2*hh+ARHeightR, LhDC, sx, sy, SRCCOPY); }*/ } } // if (MainImageForm->iMainImage->LayerMask) // MainImageForm->iMainImage->LayerMask->DeleteDC(LhDC); // if (MainImageForm->iMainImage->Mask) // MainImageForm->iMainImage->Mask->DeleteDC(MMhDC); // MainImageForm->iMainImage->uBitmap->DeleteDC(MhDC); convert by celberus return; fail: // if (MMhDC) MainImageForm->iMainImage->Mask->DeleteDC(MMhDC); // if (MhDC) MainImageForm->iMainImage->uBitmap->DeleteDC(MhDC); convert by celberus EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //---------------------------------------------------------------------------