Blame | Last modification | View Log | Download
Attribute VB_Name = "Nasroj"Public ClrSet As ColorConstantsPublic dravvDeclare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As LongPublic Declare Function ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long, ByVal wFillType As Long) As LongPrivate Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As LongPublic ha As DoublePublic Type BITMAPINFOHEADERbiSize As LongbiWidth As LongbiHeight As LongbiPlanes As IntegerbiBitCount As IntegerbiCompression As LongbiSizeImage As LongbiXPelsPerMeter As LongbiYPelsPerMeter As LongbiClrUsed As LongbiClrImportant As LongEnd TypePublic Type RGBQUADrgbBlue As BytergbGreen As BytergbRed As BytergbReserved As ByteEnd TypePublic Type rgbR As Byteg As Byteb As ByteEnd TypePublic Type BITMAPINFObmiHeader As BITMAPINFOHEADERbmiColors As RGBQUADEnd TypePublic Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As LongPublic Declare Function CreateDIBSection Lib "gdi32" (ByVal hdc As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, ByVal lplpVoid As Long, ByVal handle As Long, ByVal dw As Long) As LongPublic Declare Function GetDIBits Lib "gdi32" (ByVal aHDC As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BITMAPINFO, ByVal wUsage As Long) As LongPublic Declare Function SetDIBitsToDevice Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal DX As Long, ByVal DY As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal Scan As Long, ByVal NumScans As Long, Bits As Any, BitsInfo As BITMAPINFO, ByVal wUsage As Long) As LongPublic Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As LongPublic Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As LongPublic Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As LongPublic Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongPublic Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As LongPublic Declare Function TranslateColor Lib "olepro32.dll" Alias "OleTranslateColor" (ByVal Clr As OLE_COLOR, ByVal palet As Long, col As Long) As Long'TUZKAPublic Sub Pencil(Img As PictureBox, x As Single, y As Single, Width As Long, Button As Integer, Clr As Long)Img.DrawWidth = WidthImg.AutoRedraw = TrueIf Button = 1 ThenIf dravv = False Thendravv = TrueImg.Line (x, y)-(x, y)ElseImg.Line -(x, y), ClrEnd IfImg.RefreshElsedravv = FalseEnd IfEnd Sub'Pencil Picture1, X, Y, 3, Button,&H0'KULATY ST.Public Sub Brush2(Img As PictureBox, x As Single, y As Single, Button As Integer, Clr As Long, Clr2 As Long, Value As Long)If Button = 1 ThenImg.RefreshImg.AutoRedraw = Truea = (Value / 2)DoImg.Circle (x + 1, y + 1), a, Clra = a - 1Loop Until a = 0a = (Value / 2)DoImg.Circle (x + 1, y), a, Clra = a - 1Loop Until a = 0a = (Value / 2)DoImg.Circle (x, y + 1), a, Clra = a - 1Loop Until a = 0a = (Value / 2)DoImg.Circle (x, y), a, Clra = a - 1Loop Until a = 0Img.AutoRedraw = FalseEnd IfIf Button = 2 ThenImg.RefreshImg.AutoRedraw = Truea = (Value / 2)DoImg.Circle (x + 1, y + 1), a, Clr2a = a - 1Loop Until a = 0a = (Value / 2)DoImg.Circle (x + 1, y), a, Clr2a = a - 1Loop Until a = 0a = (Value / 2)DoImg.Circle (x, y + 1), a, Clr2a = a - 1Loop Until a = 0a = (Value / 2)DoImg.Circle (x, y), a, Clr2a = a - 1Loop Until a = 0Img.AutoRedraw = FalseEnd IfIf Button = 0 ThenImg.RefreshImg.AutoRedraw = Falsea = (Value / 2)DoImg.Circle (x + 1, y + 1), a, Clra = a - 1Loop Until a = 0a = (Value / 2)DoImg.Circle (x + 1, y), a, Clra = a - 1Loop Until a = 0a = (Value / 2)DoImg.Circle (x, y + 1), a, Clra = a - 1Loop Until a = 0a = (Value / 2)DoImg.Circle (x, y), a, Clra = a - 1Loop Until a = 0End IfEnd Sub'HRANATY ST.Public Sub Brush1(Img As PictureBox, x As Single, y As Single, Button As Integer, Clr As Long, Clr2 As Long, Value As Long)If Button = 1 ThenImg.RefreshImg.AutoRedraw = TrueDoa = a + 1Img.Line (x + a, y)-(x + a, y + Value), ClrLoop Until a >= ValueImg.AutoRedraw = FalseEnd IfIf Button = 2 ThenImg.RefreshImg.AutoRedraw = TrueDoa = a + 1Img.Line (x + a, y)-(x + a, y + Value), Clr2Loop Until a >= ValueImg.AutoRedraw = FalseEnd IfIf Button = 0 ThenImg.RefreshImg.AutoRedraw = FalseDoa = a + 1Img.Line (x + a, y)-(x + a, y + Value), ClrLoop Until a >= ValueEnd IfEnd Sub'Brush1 Picture1, X, y, button, &H0, &HFF, 10'PLECHOVKAPublic Sub Vybarvi(Img As PictureBox, x As Single, y As Single, mode As Boolean, Clr As Long)'On Error Resume NextImgp = Img.Point(x, y)Img.FillColor = ClrImg.FillStyle = vbSolidIf mode = True Thenrtn = ExtFloodFill(Img.hdc, x, y, Clr2, 0)End IfIf mode = False Thenrtn = ExtFloodFill(Img.hdc, x, y, Imgp, 1)End If'Vybarvi Picture1, x, y, False, Picture2.BackColorEnd Sub'text:Public Sub Textwr(Img As PictureBox, x As Single, y As Single, Text As TextBox, Size As Long, Font As ComboBox, Tucne As CheckBox, Kurziva As CheckBox, Podtrzene As CheckBox, Preskrtle As CheckBox, Transparent As CheckBox, Clr As Long, Clr2 As Long)Img.CurrentX = xImg.CurrentY = yImg.Font.Name = FontImg.Font.Size = SizeIf Tucne = 0 Then Img.FontBold = FalseIf Tucne = 1 Then Img.FontBold = TrueIf Kurziva = 0 Then Img.FontItalic = FalseIf Kurziva = 1 Then Img.FontItalic = TrueIf Podtrzene = 0 Then Img.FontUnderline = FalseIf Podtrzene = 1 Then Img.FontUnderline = TrueIf Preskrtle = 0 Then Img.FontStrikethru = FalseIf Preskrtle = 1 Then Img.FontStrikethru = TrueIf Transparent = 0 Then Img.FontTransparent = FalseIf Transparent = 1 Then Img.FontTransparent = TrueImg.ForeColor = ClrImg.AutoRedraw = TrueImg.Print Property.tBoxImg.RefreshImg.AutoRedraw = FalseEnd Sub'Textwr Picture1, X, Y, Text1, 10, Combo1, Check3, Check4, Check5, Check6, Check7, &H0, &HFF'spray:Public Sub spray(Img As PictureBox, x As Single, y As Single, Button As Integer, Area As Long, Density As Long, Clr As Long)Randomize TimerIf Button = 1 ThenImg.DrawWidth = 1For a = 0 To (Density / 10) * Areat = Int(Rnd * 10)C = Int(Rnd * 10)If t <= 5 Then ttf = -1If t >= 5 Then ttf = 1If C <= 5 Then ttb = -1If C >= 5 Then ttb = 1Img.PSet (x + (Rnd * Area) * ttf, y + (Rnd * Area) * ttb), ClrNext aEnd If'spray Picture1, X, Y, Button, 40, 10, &H0End Sub'GuMaPublic Sub rubber(Img As PictureBox, Xa As Single, Ya As Single, Big As Long, Button As Integer)Img.RefreshImg.AutoRedraw = FalseImg.Line (Xa, Ya)-(Xa - Big, Ya - Big), &HFFFFFF, BFIf Button = 1 ThenImg.AutoRedraw = TrueImg.Line (Xa, Ya)-(Xa - Big, Ya - Big), &HFFFFFF, BFImg.AutoRedraw = FalseEnd If 'rubber Picture1, X, Y, 10, ButtonEnd Sub'kapatkoo:Public Sub Droper(Img As PictureBox, GetClr As PictureBox, Clr1 As PictureBox, Clr2 As PictureBox, Button As Integer, x As Single, y As Single, RGBr As TextBox, RGBg As TextBox, RGBb As TextBox)RGBmax = 256i = StretchBlt(GetClr.hdc, 0, 0, 80, 80, Img.hdc, x, y, 1, 1, 13369376)Imgp = GetClr.Point(5, 5)RGBb = Imgp \ RGBmax \ RGBmaxRGBg = (Imgp \ RGBmax) Mod RGBmaxRGBr = Imgp Mod RGBmaxIf Button = 1 Then Clr1.BackColor = GetClr.Point(5, 5)If Button = 2 Then Clr2.BackColor = GetClr.Point(5, 5)End Sub 'Droper Picture1, Picture2, Picture3, Picture4, Button, X, Y, Text1, Text2, Text3'lupa::Public Sub lupa(Img As PictureBox, outImg As PictureBox, x As Single, y As Single, zveceni As Byte)i = StretchBlt(outImg.hdc, 0, 0, outImg.ScaleWidth, outImg.ScaleHeight, Img.hdc, x, y, outImg.ScaleWidth / zveceni, outImg.ScaleHeight / zveceni, 13369376)End Sub'lupa Picture1, Picture4, X, Y, 2'AIRBRUSH::Public Sub Airbrush(Img As PictureBox, x As Single, y As Single, radius As Long, color As Long, hard As Long, Button As Integer)Dim iBitmap As LongDim iDC As LongDim i As IntegerDim bi24BitInfo As BITMAPINFO, bBytes() As ByteDim Cnt As LongDim xC As LongDim yC As LongDim Clr As rgbDim DimtmpRad As StringIf Button = 1 ThenClr = getRGB(color)Img.AutoRedraw = TruetmpRad = CStr(radius)For i = 1 To 9 Step 2If Right(tmpRad, 1) = i Thenradius = radius + 1Exit ForEnd IfNextWith bi24BitInfo.bmiHeader.biBitCount = 24.biCompression = 0&.biPlanes = 1.biSize = Len(bi24BitInfo.bmiHeader).biWidth = CLng(radius * 2).biHeight = CLng(radius * 2)End WithReDim bBytes(1 To (bi24BitInfo.bmiHeader.biWidth + 1) * (bi24BitInfo.bmiHeader.biHeight + 1) * 3) As ByteiDC = CreateCompatibleDC(0)iBitmap = CreateDIBSection(iDC, bi24BitInfo, 0, ByVal 0&, ByVal 0&, ByVal 0&)SelectObject iDC, iBitmapBitBlt iDC, 0, 0, bi24BitInfo.bmiHeader.biWidth, bi24BitInfo.bmiHeader.biHeight, Img.hdc, x - radius, y - radius, vbSrcCopyGetDIBits iDC, iBitmap, 0, bi24BitInfo.bmiHeader.biHeight, bBytes(1), bi24BitInfo, 0Cnt = 1For yC = -radius To radius - 1For xC = -radius To radius - 1If (xC * xC) + (yC * yC) <= (radius * radius) - 1 Thenaplha = CByte((255 * ((Sqr((radius * radius)) - Sqr((xC * xC) + (yC * yC))) / radius)) / 100 * hard)bBytes(Cnt) = getAlpha(CByte(aplha), CLng(Clr.b), CLng(bBytes(Cnt)))bBytes(Cnt + 1) = getAlpha(CByte(aplha), CLng(Clr.g), CLng(bBytes(Cnt + 1)))bBytes(Cnt + 2) = getAlpha(CByte(aplha), CLng(Clr.R), CLng(bBytes(Cnt + 2)))End IfCnt = Cnt + 3Next xCNext yCSetDIBitsToDevice Img.hdc, x - radius, y - radius, bi24BitInfo.bmiHeader.biWidth, bi24BitInfo.bmiHeader.biHeight, 0, 0, 0, bi24BitInfo.bmiHeader.biHeight, bBytes(1), bi24BitInfo, 0DeleteDC iDCDeleteObject iBitmapImg.RefreshEnd IfEnd SubPrivate Function getAlpha(Alpha As Byte, Clr1 As Long, Clr2 As Long)getAlpha = Clr2 + (((Clr1 * Alpha) / 255) - ((Clr2 * Alpha) / 255))End FunctionPrivate Function getRGB(C As Long) As rgbgetRGB.R = CByte(C Mod 255)getRGB.g = CByte((C \ 255) Mod 255)getRGB.b = CByte(C \ 255 \ 255)End Function'Airbrush Picture1, X, Y, 30, &H0, 21, button