archive-com.com » COM » E » EFG2.COM

Total: 878

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • lpbi biClrUsed Already computed when bitmap was loaded nWidth lpbi biWidth nHeight lpbi biHeight nRowBytes nWidth bpp 31 and not 31 shr 3 Compute the cosine and sine only once cosine cos radang sine sin radang Compute dimensions of the resulting bitmap First get the coordinates of the 3 corners other than origin x1 ceil nHeight sine Originally floor at all places y1 ceil nHeight cosine x2 ceil nWidth cosine nHeight sine y2 ceil nHeight cosine nWidth sine x3 ceil nWidth cosine y3 ceil nWidth sine minx min 0 min x1 min x2 x3 miny min 0 min y1 min y2 y3 maxx max 0 max x1 max x2 x3 added max 0 maxy max 0 max y1 max y2 y3 added max 0 w maxx minx h maxy miny Create a DIB to hold the result nResultRowBytes w bpp 31 And not 31 div 8 len nResultRowBytes h hDIBResInfo GlobalAlloc GMEM MOVEABLE len nHeaderSize If hDIBResInfo 0 then Begin Result False Exit End hDIBResult PBitmapInfoHeader GlobalLock hDIBResInfo Initialize the header information CopyMemory hDIBResult lpbi nHeaderSize BITMAPINFO bmInfoResult LPBITMAPINFO hDIBResult hDIBResult biWidth w hDIBResult biHeight h hDIBResult biSizeImage len lpDIBBitsResult Pointer longint hDIBResult nHeaderSize Get the back color value index ZeroMemory lpDIBBitsResult len case bpp of 1 Begin Monochrome if clrBack RGB 255 255 255 then FillMemory lpDIBBitsResult len ff End 4 8 Begin Search the color table PtrClr PRGBQuad Longint lpbi lpbi bisize RBackClr GetRValue clrBack GBackClr GetGValue clrBack BBackClr GetBValue clrBack for i 0 to nColors 1 do Color table starts with index 0 Begin If PtrClr rgbBlue BBackClr and PtrClr rgbGreen GBackClr and PtrClr rgbRed RBackClr then Begin If bpp 4 then if bpp 4 i i i 0 And sourcex 0 And sourcey 0 then mask 80 shr x mod 8 PtrByte PByte longint lpDIBBitsResult nResultRowBytes

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/1025.txt (2016-02-14)
    Open archived version from archive



  • b c word var j byte begin for j 0 to 2 do p x j a b c j end begin bmp pixelformat pf24bit setlength a bmp height h bmp height 1 for x 0 to h do setlength a x bmp width w3 bmp width 3 1 for y 0 to h do begin p bmp scanline y x 0 while x w3 do begin for i 0 to 2 do a h y x div 3 i p x i inc x 3 end end if art grad90 or art grad270 then begin x bmp height bmp height bmp width bmp width x h bmp height 1 w3 bmp width 3 1 end w bmp width 1 for y 0 to h do begin p bmp scanline y x 0 while x w3 do begin case art of vert rechnen y x div 3 grad90 rechnen x div 3 y grad180 rechnen y w x div 3 horz rechnen h y w x div 3 else rechnen w x div 3 h y end inc x 3 end end a nil end end Sorry but I speak German only Look at the Attachment Many greetings DBR Examples

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/Graphics/DetlefBrettschneider_rotate.txt (2016-02-14)
    Open archived version from archive


  • data EMR POLYLINE RotateLeftPOLYLINE MetafileRecord displaySurface data EMR POLYGON RotateLeftPOLYGON MetafileRecord displaySurface data EMR POLYLINE16 RotateLeftPOLYLINE16 MetafileRecord displaySurface data EMR POLYGON16 RotateLeftPOLYGON16 MetafileRecord displaySurface data EMR EXTSELECTCLIPRGN RotateLeftEXTSELECTCLIPRGN MetafileRecord displaySurface data EMR FILLRGN Todo MetafileRecord displaySurface data EMR FRAMERGN Todo MetafileRecord displaySurface data EMR INVERTRGN Todo MetafileRecord displaySurface data EMR PAINTRGN Todo MetafileRecord displaySurface data EMR STRETCHBLT Todo MetafileRecord displaySurface data EMR MASKBLT Todo MetafileRecord displaySurface data EMR PLGBLT Todo MetafileRecord displaySurface data EMR SETDIBITSTODEVICE Todo MetafileRecord displaySurface data EMR STRETCHDIBITS Todo MetafileRecord displaySurface data EMR BITBLT Todo MetafileRecord displaySurface data EMR SETMETARGN Todo MetafileRecord displaySurface data else PlayEnhMetaFileRecord DisplaySurface MetafileTable MetafileRecord ObjectCount end Result 1 continue enumeration end procedure RotateLeftLINETO var rec TEnhMetaRecord dc HDC width longint var p PEMRLineTo begin p PEMRLineTo rec lineto dc width p ptl y p ptl x end procedure RotateLeftMOVETOEX var rec TEnhMetaRecord dc HDC width longint var p PEMRMoveToEx begin p PEMRMoveToEx rec movetoex dc width p ptl y p ptl x nil end procedure RotateLeftEXTTEXTOUTW var rec TEnhMetaRecord dc HDC width longint var p PEMRExtTextOut ptext PEMRText R TRect text PWideChar LogRec TLOGFONT Storage area for font information hf HFONT begin p PEMRExtTextOut rec ptext PEMRText p emrtext text PWideChar DWORD ptext ptext offstring div 2 2 R Rect width p rclBounds bottom p rclBounds left width p rclBounds top p rclBounds right SelectObject dc fdc TextOutW DC width p emrtext ptlReference y p emrtext ptlReference x PWideCHAR text ptext nChars end procedure RotateLeftEXTCREATEFONTINDIRECTW var rec TEnhMetaRecord dc HDC width longint var p PEMRExtCreateFontIndirect logf TLOGFONTW res boolean begin p PEMRExtCreateFontIndirect rec logf p elfw elfLogFont logf lfEscapement logf lfEscapement 2700 logf lfOrientation logf lfEscapement fdc CreateFontIndirectW logf SelectObject DC fdc end procedure RotateLeftRECTANGLE var rec TEnhMetaRecord dc HDC width integer var p PEMRRectangle begin p PEMRRectangle rec rectangle dc width p rclBox top p rclBox left width p rclBox bottom p rclBox right end procedure RotateLeftPOLYLINE var rec TEnhMetaRecord dc HDC width integer var p PEMRPolyline i integer ar array 0 200 of TPoint nb integer begin p PEMRPolyline rec nb p cptl for i 0 to nb 1 do ar i Point width p aptl i y p aptl i x polyline dc ar nb end procedure RotateLeftPOLYGON var rec TEnhMetaRecord dc HDC width integer var p PEMRPolygon i integer ar array 0 200 of TPoint nb integer begin p PEMRPolygon rec nb p cptl for i 0 to nb 1 do ar i Point width p aptl i y p aptl i x polygon dc ar nb end procedure RotateLeftPOLYLINE16 var rec TEnhMetaRecord dc HDC width integer var p PEMRPolyline16 i integer ar array 0 200 of TPoint nb integer begin p PEMRPolyline16 rec nb p cpts for i 0 to nb 1 do ar i Point width p apts i y p apts i x polyline dc ar nb end procedure RotateLeftPOLYGON16 var rec TEnhMetaRecord dc HDC width integer var p PEMRPolygon16 i integer ar array 0 200 of TPoint nb integer begin p PEMRPolygon16 rec nb

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/Graphics/FreddyDarsonvilleMetafileRotation.TXT (2016-02-14)
    Open archived version from archive


  • a bitmap It only works correctly if you move the mouse from topleft to rightbottom To make it properly you have to recalculate the concerning rectangle implementation R DFM var PDown TPoint PActually TPoint MouseIsDown Boolean procedure TForm1 Image1MouseDown Sender TObject Button TMouseButton Shift TShiftState x y Integer begin PDown Point x y PActually Point x y MouseIsDown TRUE Image1 Canvas DrawFocusRect Rect x y x y end procedure TForm1 Image1MouseMove Sender TObject Shift TShiftState x y Integer begin if MouseIsDown then begin Image1 Canvas DrawFocusRect Rect PDown x PDown y PActually x PActually y PActually Point x y Image1 Canvas DrawFocusRect Rect PDown x PDown y x y end end procedure TForm1 Image1MouseUp Sender TObject Button TMouseButton Shift TShiftState x y Integer begin Image1 Canvas DrawFocusRect Rect PDown x PDown y PActually x PActually y Image1 Canvas DrawFocusRect Rect PDown x PDown y x y PActually Point x y MouseIsDown FALSE end procedure TForm1 Button1Click Sender TObject var TmpBmp TBitmap begin Image1 Canvas DrawFocusRect Rect PDown x PDown y PActually x PActually y TmpBmp TBitmap Create with TmpBmp do try Width Round abs PActually x PDown x Height Round abs PActually y PDown y BitBlt Canvas Handle 0 0

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0716b.txt (2016-02-14)
    Open archived version from archive


  • the graphic is surrounded with white or any color borders typically when scanned Is there a good algorythm that will help me to detect the upperleft end lowerright corners of the graphic therefore enabling me to exclude the surrounding area with a rubberband Far better I have one bitmap which contains two or more small images in it I scan multiple photos in a row from my scanner and I want to be able to detect the border of every single photo unit Unit1 interface uses Windows Messages SysUtils Classes Graphics Controls Forms Dialogs StdCtrls ExtCtrls const PixelCountMax 32768 type pRGBArray TRGBArray TRGBArray array 0 PixelCountMax 1 of TRGBTriple type TForm1 class TForm Button1 TButton procedure FormCreate Sender TObject procedure FormDestroy Sender TObject procedure Button1Click Sender TObject private Private declarations public Public declarations end var Form1 TForm1 OBitmap DBitmap TBitmap implementation R DFM procedure TForm1 FormCreate Sender TObject begin Form1 color clLtGray OBitmap TBitmap Create OBitmap PixelFormat pf24bit DBitmap TBitmap Create DBitmap PixelFormat pf24bit end procedure TForm1 FormDestroy Sender TObject begin Obitmap Free DBitmap Free end procedure TForm1 Button1Click Sender TObject var BackColor TColor i INTEGER j INTEGER Row pRGBArray IsBlack Integer MyTop MyBottom MyLeft MyRight Integer TempTop TempBottom Integer begin OBitmap Width 100 Obitmap Height 100 OBitmap Canvas TextOut 20 20 Hello World Form1 Canvas Draw 0 0 OBitmap Retrieve Background Color BackColor OBitmap Canvas Pixels 0 0 MyTop 0 TempTop 0 MyBottom 0 TempBottom OBitmap Height MyLeft OBitmap Width MyRight 0 Find Top for j 0 to OBitmap Height 1 do begin Row pRGBArray OBitmap Scanline j isBlack 0 for i 0 to OBitmap Width 1 do begin if Row i rgbtRed GetGvalue BackColor and Row i rgbtBlue 0 Then MyTop TempTop end Find Bottom for j OBitmap Height 1 Downto 0 do begin Row pRGBArray OBitmap Scanline

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2000/0307.txt (2016-02-14)
    Open archived version from archive


  • Right 0 MemRect Bottom 0 tmpbmp Free end end procedure CropMouseMove image Timage zx zy integer Shift TShiftState X Y Integer var rect trect tmpbmp tbitmap begin if shift ssleft then begin tmpbmp Tbitmap Create try with rect do begin Left Zx Top Zy Right x Bottom y if top bottom then begin top y bottom zy end if left right then begin left x right zx end if right image Width then right image Width if bottom image Height then bottom image Height end tmpbmp Assign image Picture Graphic tmpbmp Canvas DrawFocusRect memrect tmpbmp Canvas DrawFocusRect rect image Picture Assign tmpbmp memrect rect finally tmpbmp Free end end end procedure CropMouseUp Image TImage zx zy integer Button TMouseButton Shift TShiftState X Y Integer var rect trect tmpbmp TBitmap begin if button mbleft then begin tmpbmp Tbitmap Create try with rect do begin Left Zx Top Zy Right x Bottom y if top bottom then begin top y bottom zy end if left right then begin left x right zx end if right image Width then right image Width if bottom image Height then bottom image Height end tmpbmp Assign image Picture Graphic tmpbmp Canvas DrawFocusRect memrect tmpbmp Canvas DrawFocusRect rect image Picture Assign tmpbmp memrect rect finally tmpbmp Free end end end procedure CropCopy Image Timage zx zy integer var rect destrect trect tmpbmp Tbitmap begin tmpbmp Tbitmap Create try rect Left memrect Left 1 rect Top memrect Top 1 rect Right memrect Right 1 rect Bottom memrect Bottom 1 tmpbmp Width image Picture Width tmpbmp Height image Picture Height tmpbmp Palette CopyPalette Image Picture Graphic Palette tmpbmp Canvas Draw 0 0 image Picture Graphic tmpbmp Width memrect Right memrect Left tmpbmp Height memrect Bottom memrect Top Destrect Left 0 Destrect Top 0 Destrect Right tmpbmp Width Destrect Bottom

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2000/0304b.txt (2016-02-14)
    Open archived version from archive


  • an image either horizontally vertically or both at once Interface Uses Graphics Type TMirror MT Horizontal MT Vertical MT Both Procedure Flip MirrorType TMirror BMp Graphics TBitmap implementation R dfm Procedure Flip MirrorType TMirror BMP Graphics TBitMap Var Dest TRect begin if assigned BMP then Case MirrorType of MT Horizontal begin Dest Left RotateBmp Width Dest Top 0 Dest Right RotateBmp Width Dest Bottom RotateBmp Height end MT Vertical Begin

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2002/0207.txt (2016-02-14)
    Open archived version from archive


  • Y1 X2 Y2 X3 Y3 X4 Y4 TPoint SRC DST TBitmap Well here s my variation of the theme not the most efficient as I only have Delphi2 no scanline but it works for me procedure TexMap Bmp TBitmap Dst TCanvas P0 P1 P2 TPoint Bl Boolean Blimit double var sx sy kx ky double tx ty integer x y integer xp yp integer w h integer k1 k2 double cl TColor xpd ypd double d1 d2 double c20x c10y integer x0 x1 y0 y1 integer P3 TPoint Trns TColor begin w Bmp Width h Bmp Height P3 x P0 x P1 x P0 x P2 x P0 x P3 y P0 y P1 y P0 y P2 y P0 y c20x P2 x P0 x c10y P1 y P0 y if c20x 0 then c20x 1 if c10y 0 then c10y 1 sx c20x w sy c10y h tx P0 x ty P0 y kx P2 y P0 y c20x ky P1 x P0 x c10y k1 1 0 sx kx ky sx k2 1 0 sy kx ky sy x0 Min P0 x Min P1 x Min P2 x P3 x x1 Max P0 x Max P1 x

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0520a.txt (2016-02-14)
    Open archived version from archive



  •