Recent

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

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #525 on: April 09, 2014, 01:37:07 am »
Yeah sometimes you press next> next> (and not read) and all is changed and well.. problems!

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #526 on: May 02, 2014, 08:08:25 pm »
The next version of BGRABitmap is coming. It is not completely finished yet but if you can help me test it, I would be happy.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #527 on: May 02, 2014, 09:28:34 pm »
The next new version of LazPaint will be 6.0. It uses BGRABitmap 7.4.

New features for colors (menu Colors)
- curve adujstments
- posterize
- complementary colors
- easier brightness/contrast
- in the color window, there is now displayed the hexadecimal value and the CSS name. you can click on it to enter your own hexadecimal value or CSS name

New features for reading files (menu File)
- image browser with thumbnails (File>Open), it also displays the recent directories
- preview of new image proportions (File>New)
- texture mapping on 3d object (File>Import 3d object)
- reading PSD (flattened photoshop)
- reading TGA and TIFF
- reading linux formats XPM, XWD
- writing TGA and TIFF

New features for tools
- when drawing curves, it is possible to specify to draw angles/curves or use autodetection (Tool > Curve, Select > Select curve)
- the eraser can be used to soften an image (in the toolbar, after erase opacity)
- the key Escape can be used to cancel current drawing
- the text tool allows the cursor to move in the current line, and to select/copy/paste text

New features for image handling
- little preview for canvas size, repeat and resample

Other changes
- better handling of keys, correction of bug preventing to use +/- keys to zoom
- better rendering of icons on Linux (using TBGRAImageList)
- better antialiasing of the selection
- optimization of the rendering
- faster undo/redo
- custom blur is now threaded (so it does not lock the program for a big image/a big mask)
- eraser width is now independent from pen width (and by default bigger)
- new set of icons for layer tools
- UTF8 filenames are better handled
- top most window are better handled
- file assocations will be unchecked by default in the installer

Features not added yet
- layer rotation is not implemented
- no feature to print yet

I am testing it on a Windows 32-bit. If you have Win64, Linux or MacOS, please give me some feedback on how it runs on your computer.

To compile you will need BGRAControls and BGRABitmap. LNet is optional. If you remove it from the project, then be sure to remove $DEFINE LAZPAINT_USE_LNET from uonline.pas.

The test version is number 5.9. It is not a release. Here are the download links of the source code:
http://sourceforge.net/projects/lazpaint/files/src/lazpaint5.9_src.zip/download
http://sourceforge.net/projects/lazpaint/files/src/bgrabitmap7.4.zip/download
http://sourceforge.net/projects/bgra-controls/files/bgra-controls-3.0/bgra-controls-3.2-20140421.7z/download
http://sourceforge.net/projects/lazpaint/files/src/inet0.6.6.zip/download

Dependencies:
- LazPaint depends on BGRAControls, BGRABitmap and LNetVisual.
- BGRAControls depends on BGRABitmap.
« Last Edit: May 03, 2014, 08:18:11 am by circular »
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #528 on: May 08, 2014, 03:32:47 pm »
Hi,

I've already tested the new file open explorer! Cool.

Windows x64

- Well first I got a memory leak, something in uonline.pas, but I don't know if this is a bug in lazpaint or in lnet. (see the picture attached).

- In the layer window, the button rotate layer works? Or I don't know how to use it..

- Filter > Pixelate crashes LazPaint (win64)

Code: [Select]
SYSTEM_MOVE$formal$formal$INT64
0000000000403500 4c89c0                   mov    %r8,%rax
0000000000403503 4829d1                   sub    %rdx,%rcx
0000000000403506 0f8491000000             je     0x40359d <SYSTEM_MOVE$formal$formal$INT64+157>
000000000040350C 7309                     jae    0x403517 <SYSTEM_MOVE$formal$formal$INT64+23>
000000000040350E 4801c8                   add    %rcx,%rax
0000000000403511 0f826d010000             jb     0x403684 <SYSTEM_MOVE$formal$formal$INT64+388>
0000000000403517 4983f808                 cmp    $0x8,%r8
000000000040351B 0f8c63000000             jl     0x403584 <SYSTEM_MOVE$formal$formal$INT64+132>
0000000000403521 f6c207                   test   $0x7,%dl
0000000000403524 7437                     je     0x40355d <SYSTEM_MOVE$formal$formal$INT64+93>
0000000000403526 f6c201                   test   $0x1,%dl
0000000000403529 740c                     je     0x403537 <SYSTEM_MOVE$formal$formal$INT64+55>
000000000040352B 8a0411                   mov    (%rcx,%rdx,1),%al
000000000040352E 49ffc8                   dec    %r8
0000000000403531 8802                     mov    %al,(%rdx)
0000000000403533 4883c201                 add    $0x1,%rdx
0000000000403537 f6c202                   test   $0x2,%dl
000000000040353A 740f                     je     0x40354b <SYSTEM_MOVE$formal$formal$INT64+75>
000000000040353C 668b0411                 mov    (%rcx,%rdx,1),%ax
0000000000403540 4983e802                 sub    $0x2,%r8
0000000000403544 668902                   mov    %ax,(%rdx)
0000000000403547 4883c202                 add    $0x2,%rdx
000000000040354B f6c204                   test   $0x4,%dl
000000000040354E 740d                     je     0x40355d <SYSTEM_MOVE$formal$formal$INT64+93>
0000000000403550 8b0411                   mov    (%rcx,%rdx,1),%eax
0000000000403553 4983e804                 sub    $0x4,%r8
0000000000403557 8902                     mov    %eax,(%rdx)
0000000000403559 4883c204                 add    $0x4,%rdx
000000000040355D 4d89c1                   mov    %r8,%r9
0000000000403560 49c1e905                 shr    $0x5,%r9
0000000000403564 7538                     jne    0x40359e <SYSTEM_MOVE$formal$formal$INT64+158>
0000000000403566 4d89c1                   mov    %r8,%r9
0000000000403569 49c1e903                 shr    $0x3,%r9
000000000040356D 7415                     je     0x403584 <SYSTEM_MOVE$formal$formal$INT64+132>
000000000040356F 90                       nop
0000000000403570 488b0411                 mov    (%rcx,%rdx,1),%rax
0000000000403574 488902                   mov    %rax,(%rdx)
0000000000403577 4883c208                 add    $0x8,%rdx
000000000040357B 49ffc9                   dec    %r9
000000000040357E 75f0                     jne    0x403570 <SYSTEM_MOVE$formal$formal$INT64+112>
0000000000403580 4983e007                 and    $0x7,%r8
0000000000403584 4d85c0                   test   %r8,%r8
0000000000403587 7e14                     jle    0x40359d <SYSTEM_MOVE$formal$formal$INT64+157>
0000000000403589 66666690                 data32 data32 xchg %ax,%ax
000000000040358D 666690                   data32 xchg %ax,%ax
0000000000403590 8a0411                   mov    (%rcx,%rdx,1),%al
0000000000403593 8802                     mov    %al,(%rdx)
0000000000403595 48ffc2                   inc    %rdx
0000000000403598 49ffc8                   dec    %r8
000000000040359B 75f3                     jne    0x403590 <SYSTEM_MOVE$formal$formal$INT64+144>
000000000040359D c3                       retq   
000000000040359E 4981f900200000           cmp    $0x2000,%r9
00000000004035A5 7209                     jb     0x4035b0 <SYSTEM_MOVE$formal$formal$INT64+176>
00000000004035A7 4881f900100000           cmp    $0x1000,%rcx
00000000004035AE 7333                     jae    0x4035e3 <SYSTEM_MOVE$formal$formal$INT64+227>
00000000004035B0 4883c220                 add    $0x20,%rdx
00000000004035B4 488b4411e0               mov    -0x20(%rcx,%rdx,1),%rax
<<< the last line

( BTW I don't have bitmaps of more of 4GB, at least nowdays .-. )

Debug:
With the new Lazarus 1.2 now we can debug x64 applications installing the tools. Add a 'Debug x64' compilation mode.

Other:

I know that there is available custom blur, you can try to add a shortcut for something called 'bokeh blur'? Basically is how blur is the most nice blur ever.

When editing a curve:
-- when curve is done but is still curve, no bitmap, allow to change the type of node (something like clic the node and press a key or something like that..)
-- if you double click add a new node.
-- if you double click and 'delete' toggle button is activated, delete a node.
-- Keep as 'curve layer' or something instead of making it bitmap.

Things that works:

Color features: OK, curves are great
Reading files: OK, 3D is faster than photoshop, and has best quality!
New features for tools: OK, awesome! Is easier than Inkscape and CorelDRAW / Illustrator to draw "Easy Bézier" - something like b-spline? You can add that tool as plugin in Illustrator hehe, millons of people will buy it, oh what is free in LazPaint! Export path as SVG will be the future?
The erazer has that blurry thing! + and - shortctus: cool for notebooks that does not have the middle mouse button.
Image handling: OK

Well now that I can compare with photoshop:
- The preview of all blend operations in one window is only available in lazpaint
- All the layer shortcuts to flip are cool
- It's amazing the speed improvement. And the whole LazPaint is better than ever.

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #529 on: May 08, 2014, 08:26:40 pm »
Thanks 007!  :)

Windows 64
- About the memory leak, it is a bug in LNet, however that has no consequence.
- The rotate layer is not implemented yet.
- For the pixelate crash, it would help me to have the line of code where it crashes (the first entry in the stack trace)

About the debug in 64, I am not sure I can add it with my 32 bit windows, but I will have a look. If you can send me an updated project file with this mode, I can simply replace the current one.

About bokeh blur, it is a good idea. The current blur system does not produce such blur, even if "disk blur" is a bit like that.

Curve
- you can change the type of node by pressing one of the keys S(pline) / X(angle) / A(utomatic). I guess I can add that clicking a node would do that. However clicking is also used to move points so that may be confusing.
- adding and removing node is a good idea
- keep as a curve layer, well, good idea too, but that implies a lot of things

About color curves, yes it is quite good now.  :)

About SVG, well yes, that could be an improvement, with a new version of BGRABitmap supporting natively SVG stuff. I am not sure however how to connect this with FPVectorial.

About doing a plugin for illustrator, lol well you are right, theoretically I could become rich :)

Thanks again for the feedback!
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #530 on: May 09, 2014, 07:53:35 pm »
In fact you will become rich :) don't forget the old 007 hehe

The debugger doesn't work (in BGRABitmapPack i've changed the settings and recompiled, no idea) but i've debugged it by hand

The problem is in BGRAResample.pas
Code: [Select]
procedure StretchPutImage(bmp: TBGRACustomBitmap; NewWidth, NewHeight: integer;
  dest: TBGRACustomBitmap; OffsetX, OffsetY: Integer; ADrawMode: TDrawMode; AOpacity: byte);

In the first iteration of
Code: [Select]
  for y_dest := targetRect.Top to targetRect.Bottom - 1 do
  begin     

Somewhat here
Code: [Select]
begin
      if tempData = nil then
        move((dest.ScanLine[y_dest-1+OffsetY]+OffsetX+targetRect.Left)^,(dest.ScanLine[y_dest+OffsetY]+OffsetX+targetRect.Left)^,(targetRect.Right-targetRect.Left)*sizeof(TBGRAPenStyle))
      else
        PutPixels(dest.ScanLine[y_dest+OffsetY]+OffsetX+targetRect.Left,tempData,targetRect.right-targetRect.left,ADrawMode,AOpacity);
    end

The assembler window is the same as I put you before. SYSTEM_MOVE$formal$formal$INT64

So I think that this is the line
Code: [Select]
move((dest.ScanLine[y_dest-1+OffsetY]+OffsetX+targetRect.Left)^,(dest.ScanLine[y_dest+OffsetY]+OffsetX+targetRect.Left)^,(targetRect.Right-targetRect.Left)*sizeof(TBGRAPenStyle))
In the x86_64.inc is defined Move
Code: [Select]
procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];assembler;nostackframe;
{ Linux: rdi source, rsi dest, rdx count
  win64: rcx source, rdx dest, r8 count }
asm
{$ifndef win64}
    mov    %rdx, %r8
    mov    %rsi, %rdx
    mov    %rdi, %rcx
{$endif win64}

...

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #531 on: May 09, 2014, 08:23:05 pm »
Thank you very much. I guess I know what the problem is. There is TBGRAPenStyle instead of TBGRAPixel. I guess I did not check enough what Intellisense proposed here!!

It is fixed in BGRABitmap 7.5.
« Last Edit: May 09, 2014, 08:31:15 pm by circular »
Conscience is the debugger of the mind

CaptBill

  • Sr. Member
  • ****
  • Posts: 435
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #532 on: May 12, 2014, 06:45:28 pm »
Hi Circular,
Excellent work.

I have installed it to TinyCore no problems. (fpc2.4.2/laz1_0_8). The file browser shows as full screen and the list box fields are overlapping/not wide enough but only after minimizing the dialog. Also, it crashes when I press the far left button (show icons button?)

I had no luck so far with win7 64 CodeTyphon installation. Seems to be a issue with CodeTyphon though. The 'Small IDE' doesn't want to install new components to the pallet for some reason. ??

I played around with the 'layers' feature. Really nice. Seems to work great.

Cheers

« Last Edit: May 12, 2014, 07:20:24 pm by CaptBill »

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #533 on: May 20, 2014, 12:42:56 pm »
Thank you CaptBill.

Here is a new test version 5.9b of LazPaint.

New features
- Print dialog
- Noise filter
- Ability to edit curve when you draw it (add/remove points)
- Better blend op dialog, button to select blend op in layer stack
- Rotate layer tool

Optimisations
- Move layer tool optimisation
- Optimisation of selection rotation

Linux fixes
- Browse image fix for Linux
- Toolbar height fix for Linux (spinedits are a bit bigger)

Links:
http://sourceforge.net/projects/lazpaint/files/src/lazpaint5.9b_src.zip/download
http://sourceforge.net/projects/lazpaint/files/src/bgrabitmap7.5.zip/download
http://sourceforge.net/projects/bgra-controls/files/bgra-controls-3.0/bgra-controls-3.2-20140421.7z/download
http://sourceforge.net/projects/lazpaint/files/src/inet0.6.6.zip/download

Possible remaining issues:
- problem of update of the screen, the image being displayed not up-to-date after doing colorize or changing blend mode

Regards

Note: if you would like to help with the translation, please use the language files of this test version (5.9b) as it contains some new labels. Thanks
« Last Edit: May 20, 2014, 12:44:39 pm by circular »
Conscience is the debugger of the mind

CM630

  • Hero Member
  • *****
  • Posts: 1091
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #534 on: May 29, 2014, 10:23:23 am »
I have attached a patch, adding a percentage option for the resize dialogue, I functionality I missed. Also, the patch enlarges two labels, which are too short for my language.
Something else I miss are scrollbars in the image panel.


if i can suggest you for the next steps:
 + multiple images open in tabs?
This is needed, in order to interact with several image in the same time.


Anyway, a useful feature will be a panel with images for processing, or in details:
Several files are added to the panel (with a file open menu or drag and drop). In the panel there shall be Prev and Next button. When the Next button is pressed current image closes and the next one is open. No memory will be wasted for opening multiple images at the same time, and there will be no effort for opening each file separately.
If you accept contributions, I might check if I can do something for that feature, which I need for processing scanned multipage documents.
« Last Edit: May 29, 2014, 10:26:28 am by paskal »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #535 on: May 29, 2014, 12:52:07 pm »
Thank you. I applied your patch. I modified a bit so that the ratio is also kept with percentages. I also added code to prevent de size from being zero (1% of 20 is zero for example).

I am happy to have your contributions.  :)

About scrollbars, I take a note of this.

About having a panel for image processing, that is a good idea. It would be a light alternative to the tabs and multiple images opened at the same time.

There is some refactoring to do here. I guess what would be needed is a TMainFormLayout class that handles the parts of the main form, and return the coordinates of those. For now, there is TMainFormMenu that handles the main menu and the toolbar, and it only returns the toolbar height.

This layout class would get the Resize event from the main form, use the TMainFormMenu class, and would recturn the area for the picture. There are two different modes: with a PaintBox or without PaintBox. If there is a PaintBox, it is used to render the picture. If there is none, the picture is rendered on the form.

Toolbars position are computed with custom code, so it is not possible to use the Anchors or Align property. So the layout class need to handle that.

I can take care of the layout if you like, so that you can focus on the panel you would like to add.

However if you would like to do that layout too, tell me.
« Last Edit: May 29, 2014, 12:58:27 pm by circular »
Conscience is the debugger of the mind

airpas

  • Full Member
  • ***
  • Posts: 179
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #536 on: May 29, 2014, 01:41:44 pm »
is it possible to move a layer over another one  using arrow keys , and not the cursor
« Last Edit: May 29, 2014, 01:44:33 pm by airpas »

CM630

  • Hero Member
  • *****
  • Posts: 1091
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #537 on: May 29, 2014, 02:06:55 pm »
Here are some more feature I miss in LazPaint.
1. Selected areas, layers, drawing (with pen, etc) etc. shall be draggable with the arrow keys, too, not only with the mouse. Maybe it will be better if some hot keys are enabled, for example:
Left arrow- drag 1 pixel left
Left arrow+ Ctrl- drag 10 pixel left.
Left arrow + Alt- drag 5% of the image size left (sometimes 10 pixel are nothing, sometimes they are too much, depending on the size of the image).
2.  I am used to using GIMP, though I do not like latest versions. That is why I was searching for the "Open as new layer" in the file menu. Finally I found it in the layers panel, but I still think it should be available in the File menu.

3. Alpha channel cannot be disabled for the image editing session.
 

About having a panel for image processing, that is a good idea. It would be a light alternative to the tabs and multiple images opened at the same time.

 

That is not an absolute alternative, since if I need to copy from one image into another, I need both images open, but for other purposes it is better.
 


I applied your patch. I modified a bit so that the ratio is also kept with percentages. I also added code to prevent de size from being zero (1% of 20 is zero for example).
 
I will check changes when I update the SVN. Percentage is needed in the Canvas resize dialogue, too, I will check what I can do.

 

I can take care of the layout if you like, so that you can focus on the panel you would like to add.

However if you would like to do that layout too, tell me.
I suppose I won't be able to start before say 10 of June.
There is also a problem, that LazPaint does not show the default extension when saving images, I would take care for that, too.
« Last Edit: May 29, 2014, 02:13:55 pm by paskal »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #538 on: May 29, 2014, 10:35:15 pm »
1. Selected areas, layers, drawing (with pen, etc) etc. shall be draggable with the arrow keys, too, not only with the mouse. Maybe it will be better if some hot keys are enabled, for example:
Left arrow- drag 1 pixel left
Left arrow+ Ctrl- drag 10 pixel left.
Left arrow + Alt- drag 5% of the image size left (sometimes 10 pixel are nothing, sometimes they are too much, depending on the size of the image).
Good idea.

Quote
2.  I am used to using GIMP, though I do not like latest versions. That is why I was searching for the "Open as new layer" in the file menu. Finally I found it in the layers panel, but I still think it should be available in the File menu.
This is an easy one. I have done it.

Quote

About having a panel for image processing, that is a good idea. It would be a light alternative to the tabs and multiple images opened at the same time.
 

That is not an absolute alternative, since if I need to copy from one image into another, I need both images open, but for other purposes it is better.
Well the thing is that tabs is out of the scope of version 6.0, as I would like to publish it soon, lets say in June or July.

Quote
I will check changes when I update the SVN. Percentage is needed in the Canvas resize dialogue, too, I will check what I can do.
Ok.

Quote

I can take care of the layout if you like, so that you can focus on the panel you would like to add.

However if you would like to do that layout too, tell me.
I suppose I won't be able to start before say 10 of June.
Ok. I may have done it in the meatime.

Quote
There is also a problem, that LazPaint does not show the default extension when saving images, I would take care for that, too.
Ok.
Conscience is the debugger of the mind

CM630

  • Hero Member
  • *****
  • Posts: 1091
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: LazPaint (alpha-blending, antialiasing, filters)
« Reply #539 on: June 04, 2014, 07:31:10 pm »
Quote

I can take care of the layout if you like, so that you can focus on the panel you would like to add.

However if you would like to do that layout too, tell me.
I suppose I won't be able to start before say 10 of June.
Ok. I may have done it in the meatime.
 
I have started working slowly on it.

There is a boring issue- when I close the SVN version of LazPaint it shows some (probably debug) mesages. How am I to disable them?
Speaking of layouts , am I the only one who hates the scattered Gimpish/Lazarusish style of panels everywhere and over everything? :'(


Edit: I just came upon a bug under WinXp. In the new file open dialog, I tried to paste a string (a path actually), but pasting does not work, neither with ctrl+c, nor with rightclick->popup menu.
« Last Edit: June 04, 2014, 08:10:48 pm by paskal »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

 

TinyPortal © 2005-2018