Recent

Author Topic: LazPaint (alpha-blending, antialiasing, filters)  (Read 651130 times)

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #30 on: February 10, 2011, 09:40:10 pm »

Here is the mac render screenshot. (Mac OS X 10.5.8)
1. Crosshair is disappear in the image drawing zone.
2. Something wrong with the OnPaint event, cos drawing on the canvas nothing happens after changing the form size it appears.
3. Zoom in and out arent working.
4. Close can be added to the File menu.
I havent tested all of the things but some of the problem mentioned above.
Here are some opinions about the application.
1. Tools form should be closed and visibility of Tools can be add to the Edit menu or something else.
2. Information of the x, y points and other related things can be shown at the StatusBar (TStatusBar)
Thanks, great job by the way.

P.S. Here I compiled on the Ubuntu 10.10 and crosshair is so slow.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #31 on: February 10, 2011, 11:06:32 pm »
Here is the mac render screenshot. (Mac OS X 10.5.8)
Thanks.

Quote
1. Crosshair is disappear in the image drawing zone.
P.S. Here I compiled on the Ubuntu 10.10 and crosshair is so slow.
Ok so I should give up with this way of doing the crosshair. I can use a normal cursor, but I do not know how to redefine it. There is a standard crosshair cursor, but it is using inverted pixels, so it is not visible on gray (127 xor 255 = 128). I would like to use a cross hair with black and white. Problem is how to embed it into the exe file and use it inside the application.

Quote
2. Something wrong with the OnPaint event, cos drawing on the canvas nothing happens after changing the form size it appears.
Do you mean that while you are drawing, you do not see anything, and the drawing shows up only after you resize the form ? If so, then it explains why you don't see the crosshair. It is painted in the picture like a standard drawing. But I don't understand why this happens.

Quote
3. Zoom in and out arent working.
I suppose it's the same problem. Maybe it is because direct drawing on Canvas is not possible. In this case, I should put a Repaint even each time the image is drawn.

Quote
4. Close can be added to the File menu.
Ok.

Quote
1. Tools form should be closed and visibility of Tools can be add to the Edit menu or something else.
I do not understand. How could the user choose the current tool ? The toolbox is the most convenient way.

Quote
2. Information of the x, y points and other related things can be shown at the StatusBar (TStatusBar)
Good idea.

Quote
Thanks, great job by the way.
Thank you, but I wonder what you have seen if it's not painted when you draw...
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #32 on: February 10, 2011, 11:41:23 pm »
IndianaJones, here is a new version (1.3b) designed to fix the problems you've mentionned. Can you give it a try ?

https://sourceforge.net/projects/lazpaint/files/lazpaint/
Conscience is the debugger of the mind

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #33 on: February 11, 2011, 03:02:06 am »

For the first question;
1. create the icon using any icon editor, painter...
2. convert ico file with using lazres. (resource file) which is in the /lazarus/tools directory.
3. http://wiki.lazarus.freepascal.org/Lazarus_Resources for the usage of the lazres.
4. add the lrs file to the initialization section.
5. try the following code.
Code: [Select]
var
  ico : TPicture;
begin
  ico:= TPicture.Create;
  ico.LoadFromLazarusResource('wi0126-32');
  Screen.Cursors[5] := ico.Icon.Handle;
//  Screen.Cursor:=5;
  Form1.Cursor:=5;
6. 'wi0126-32' is my icon file name in the resource file.
 
2. Right
3. Right

Quote
I do not understand. How could the user choose the current tool ? The toolbox is the most convenient way.
I mean just add in the menu (shortcut) to close and open the tool window.

Quote
Thank you, but I wonder what you have seen if it's not painted when you draw...
Things can be improved man. :)

So the last thing, I am going to test the new version later. (here four oclock in the morning)  %)
Thanks.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #34 on: February 11, 2011, 01:48:29 pm »
Thanks for these explanations. It seems works on Win64.  :)

I mean just add in the menu (shortcut) to close and open the tool window.
Ok.

Quote
Quote
Thank you, but I wonder what you have seen if it's not painted when you draw...
Things can be improved man. :)
I hope so.  ::)

Quote
So the last thing, I am going to test the new version later. (here four oclock in the morning)  %)
How come ? That's very late.  %)
Conscience is the debugger of the mind

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #35 on: February 11, 2011, 03:41:19 pm »
@circular, it works perfetto, congratulations.
Here is some modifications:
1. Clear the area can be added.
2. There is something wrong with the pen color. For example, when I select the pen color to blue(255) and drawing a rectangle which is red(?).
3. Color Dialog can be open like Tools menu, as attached image.
4. Minimizing the application to maximization doesnt work.
5. Floodfill doesnt work well. (sometimes it fills sometimes doesnt)
I will add some other related modifications later.
Thanks.
« Last Edit: February 11, 2011, 03:42:55 pm by IndianaJones »

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #36 on: February 11, 2011, 06:44:42 pm »
1. Clear the area can be added.
What do you mean ? Clear the whole bitmap, or clear the selected area ?
To clear the bitmap, you can do File>New, and to clear an area, select and Edit>Cut.

Quote
2. There is something wrong with the pen color. For example, when I select the pen color to blue(255) and drawing a rectangle which is red(?).
It is possible that red and blue channels are swapped. In this case :
blue becomes red
green stays green
red becomes blue
yellow becomes cyan
white stays white

Is it the case ?

Quote
3. Color Dialog can be open like Tools menu, as attached image.
You mean a permanent window to choose a color ? Good idea.

Quote
4. Minimizing the application to maximization doesnt work.
What happens ?

Quote
5. Floodfill doesnt work well. (sometimes it fills sometimes doesnt)
Strange. Because of the selection ?

Quote
Thanks.
Thank you too.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #37 on: February 11, 2011, 07:09:36 pm »
Here is a new version (1.4) with :

  • gamma expansion/compression in BGRABitmap : better gradient and better blend
  • empty selection rotation
  • coordinates
  • custom cursors

https://sourceforge.net/projects/lazpaint/files/lazpaint/
 8-)
Conscience is the debugger of the mind

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #38 on: February 11, 2011, 07:36:28 pm »
Some (probably platform specific) problem here. Linux + KDE (Qt 4.7.1).

Version: 1.4 - ../../../../Lazarus_Qt/lazarus/lcl/menus.pp(454,1) Fatal: Can't find unit Forms used by Menus
   (error on compilig)

Version: 1.3 - when resizing Form or when Save menu item selected from mainMenu then SIGSEGV + Can't find "image/qimage.cpp"
   this version run (problem with crosshair cursor is probably repaired in 1.4)

I don't now why because I use MainMenu, SaveDialog, resizing etc. in my App. and I never saw these bugs before.
« Last Edit: February 11, 2011, 07:39:34 pm by Blaazen »
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #39 on: February 11, 2011, 07:40:57 pm »
1.
Quote
What do you mean ? Clear the whole bitmap, or clear the selected area ?
Adding an shortcut to clear the bitmap, and a new for appear for the transparency of the cleared bitmap. (opacity, solid)

2.
Quote
Is it the case.
Yes, it is the case.

3.
Quote
You mean a permanent window to choose a color ? Good idea.
Yep

4.
Quote
What happens ?
After minimazing the application, it doesnt come up to the screen again.

5.
Quote
Strange. Because of the selection ?
No, I think the problem is related with the Tolerance, if the tolerance is bigger than 100, the problem occurs, below it works perfectly.

New cases:
1. Tolerance 0 gives 'Division by zero'
2. In the New window, have a look at the Cancel button.

Thanks.

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #40 on: February 11, 2011, 08:06:21 pm »
I confirm the problem which is reported by Blaazen.

../../lazarus/lcl/menus.pp(454,1) Fatal: Can't find unit Forms used by Menus

« Last Edit: February 11, 2011, 08:08:29 pm by IndianaJones »

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #41 on: February 11, 2011, 08:28:28 pm »
Some (probably platform specific) problem here. Linux + KDE (Qt 4.7.1).

Version: 1.4 - ../../../../Lazarus_Qt/lazarus/lcl/menus.pp(454,1) Fatal: Can't find unit Forms used by Menus
   (error on compilig)

Version: 1.3 - when resizing Form or when Save menu item selected from mainMenu then SIGSEGV + Can't find "image/qimage.cpp"
   this version run (problem with crosshair cursor is probably repaired in 1.4)

I don't now why because I use MainMenu, SaveDialog, resizing etc. in my App. and I never saw these bugs before.
I have no idea what to do about it. Maybe the unit clauses are different with Qt.

By the way, BGRABitmap may not work on Qt, there is only the right code for Windows and Gtk. It would be interesting to test it, and maybe add some specific directives and functions to ensure BGRA drawing.

1.
Quote
What do you mean ? Clear the whole bitmap, or clear the selected area ?
Adding an shortcut to clear the bitmap, and a new for appear for the transparency of the cleared bitmap. (opacity, solid)
I do not understand.

Quote
Yes, it is the case.
So there is a Red/Blue inversion. Can you try to replace the following function :
Code: Pascal  [Select][+][-]
  1. procedure TBGRAGtkBitmap.DataDrawOpaque(ACanvas: TCanvas; Rect: TRect;
  2.   AData: Pointer; ALineOrder: TRawImageLineOrder; AWidth, AHeight: integer);
  3. var Temp: TBitmap; RawImage: TRawImage; BitmapHandle, MaskHandle: HBitmap; CreateSuccess: Boolean;
  4. begin
  5.      if (AHeight=0) or (AWidth = 0) then exit;
  6.  
  7.      RawImage.Init;
  8.      {$IFDEF DARWIN}
  9.      RawImage.Description.Init_BPP32_R8G8B8_BIO_TTB(AWidth,AHeight);
  10.      SwapRedBlue;
  11.      {$ELSE}
  12.      RawImage.Description.Init_BPP32_B8G8R8_BIO_TTB(AWidth,AHeight);
  13.      {$ENDIF}
  14.      RawImage.Description.LineOrder:= ALineOrder;
  15.      RawImage.Description.LineEnd := rileDWordBoundary;
  16.      RawImage.Data:= PByte(AData);
  17.      RawImage.DataSize:= AWidth*AHeight*Sizeof(TBGRAPixel);
  18.      CreateSuccess := RawImage_CreateBitmaps(RawImage, BitmapHandle, MaskHandle, false);
  19.      {$IFDEF DARWIN}
  20.      SwapRedBlue;
  21.      {$ENDIF}
  22.      if not CreateSuccess then
  23.        raise FPImageException.Create('Failed to create bitmap handle');
  24.      Temp := TBitmap.Create;
  25.      Temp.Handle := BitmapHandle;
  26.      Temp.MaskHandle := MaskHandle;
  27.      ACanvas.StretchDraw(Rect,Temp);
  28.      Temp.Free;
  29. end;  


Quote
Quote
What happens ?
After minimazing the application, it doesnt come up to the screen again.
What happens if you try to debug it at this precise moment ?

Quote
No, I think the problem is related with the Tolerance, if the tolerance is bigger than 100, the problem occurs, below it works perfectly.
Ok. I think it is not a bug. The progressive floodfill has a transparency. When tolerance is big, many pixels are filled but with transparency so you may not notice it, all you see is that it paints multiple parts at the same time.

Quote
1. Tolerance 0 gives 'Division by zero'
Ok. I got this problem too. I'm fixing it.

Quote
2. In the New window, have a look at the Cancel button.
There is no problem here with this button.
« Last Edit: February 11, 2011, 08:30:09 pm by circular »
Conscience is the debugger of the mind

Sternas Stefanos

  • Full Member
  • ***
  • Posts: 170
  • Ex Pilot, M.Sc, Ph.D
    • http://www.pilotlogic.com
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #42 on: February 12, 2011, 07:49:19 am »
BGRABitmap working OK
and to Windows Mobile 6.5.3 WVGA (800x480)
CodeTyphon Architect and Programmer

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 255
    • Fresh sound.
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #43 on: February 12, 2011, 08:02:54 am »
Hello,

I suddenly can not compile the project anymore. LazPaint revision 10.

Always get: E:\lazarus\lcl\menus.pp(454,1) Fatal: Can't find unit Forms used by Menus

Lazarus 0.9.31 r29477 FPC 2.4.3 i386-win32-win32/win64

Just tested. revision 7 compiled. revision 8 does not.
« Last Edit: February 12, 2011, 08:22:22 am by DelphiFreak »
Linux Mint 20.3, Lazarus 2.3, Windows 10, Delphi 10.3 Rio, Delphi 11.1 Alexandria

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #44 on: February 12, 2011, 11:47:52 am »
Hello,

I suddenly can not compile the project anymore. LazPaint revision 10.

Always get: E:\lazarus\lcl\menus.pp(454,1) Fatal: Can't find unit Forms used by Menus

Lazarus 0.9.31 r29477 FPC 2.4.3 i386-win32-win32/win64

Just tested. revision 7 compiled. revision 8 does not.
Ok. How can I know the differences between revision 7 and revision 8 ?

Note : I'm using TortoiseSVN.

EDIT : I found how to compare revisions. I'm looking for a significative difference.

I do not understand what could be causing this. There is no modifications about Forms or Menus. I guess it is a problem of directories. The only significative change is that I added custom cursors. If you strip ucursors in the last version, what happens ?
« Last Edit: February 12, 2011, 12:05:43 pm by circular »
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018