Recent

Author Topic: [CLOSED] BGRAControls  (Read 549911 times)

lainz

  • Guest
Re: BGRAControls
« Reply #555 on: October 23, 2012, 03:42:13 am »
Is it faster than redrawing whole button?

Is faster than BGRAImageButton (that was using BGRABitmapThemeUtils) because the code for slice scaling the image is optimized by circular =)

Is faster than BGRASpriteAnimation because in BGRASpriteAnimation I strp each frame of the bitmap in each frame redraw, the whole component isn't optimized. With a TTimer and a TBGRAMultiSliceScaling I can load and draw each frame faster.

It can be faster than drawing from BGRABitmap (well, I don't know), because for example I can apply effects to the button in Photoshop (i.e layer styles) and save it to a png file, then load with BGRASliceScaling and is just stretching and drawing a bitmap, all the effects are in the plain png.

To understand how it works, test the customdrawn_windows7 and see the code, for example, to draw a button or to draw a progress bar.

Edit: or just run the customdrawn_windows7 project and clic 'Debug' button, and move the sliders to change the progressbar percent, you'll understand it quickly.
« Last Edit: October 23, 2012, 04:17:55 am by lainz »

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #556 on: October 23, 2012, 02:06:08 pm »
I can't run this demo, I get SIGSEGV error in line 285 of BGRASliceScaling unit. But I understand how it working. This bring me old idea which you are implementing.
Creating GUI by using gimp/photoshop is much easier than doing this programatically. So I wanted create some style manager (or custom drawn drawer) which only manage mouse and controls states, and all styles are just PNG images. Drawing ready png image should be faster than whole complicated mathematic drawing. This solution powered by BGRABitmap tools give unlimited possibilities for creating modern and nice looking GUI like in web applications. I'm realy impressend with BGRAImageButton and it animation property.
Just imagine this GUI sliced to separated png files and managed by style manager:
http://dribbble.s3.amazonaws.com/users/13307/screenshots/562878/attachments/42390/Full-size.jpg

But I stuck with resizing problem and seems that your slice tool is solution

Osvaldo Arruda

  • New Member
  • *
  • Posts: 27
Re: BGRAControls
« Reply #557 on: October 23, 2012, 02:30:55 pm »
when the novel ends and when the bug will be fixed in svn and posted for us to test? I can not install the component in Lazarus 1.0.3

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #558 on: October 23, 2012, 02:40:40 pm »
You mean bug in ubuntu (GTK)? I found what was a problem and waiting for response on lazarus bugtracker. If you don't want wait for solution, you can easily fix it:

1. Open file BGRAGtkBitmap.pas from BGRABitmap package
2. Go to method TBGRAGtkBitmap.DrawTransparent
3. Replace this existing code:
Code: Pascal  [Select][+][-]
  1.   gdk_pixbuf_render_to_drawable(FPixBuf,
  2.     TGtkDeviceContext(ACanvas.Handle).Drawable,
  3.     TGtkDeviceContext(ACanvas.Handle).GC,
  4.     0,0,
  5.     TGtkDeviceContext(ACanvas.Handle).Offset.X+Rect.Left,
  6.     TGtkDeviceContext(ACanvas.Handle).Offset.Y+Rect.Top,
  7.     Width,Height,
  8.     GDK_RGB_DITHER_NORMAL,0,0);  
  9.  

by:
Code: Pascal  [Select][+][-]
  1.   gdk_pixbuf_render_to_drawable(FPixBuf,
  2.     TGtkDeviceContext(ACanvas.Handle).Drawable,
  3.     TGtkDeviceContext(ACanvas.Handle).GC,
  4.     0,0,
  5.     TGtkDeviceContext(ACanvas.Handle).ClipRect.X+Rect.Left,
  6.     TGtkDeviceContext(ACanvas.Handle).ClipRect.y+Rect.Top,
  7.     Width,Height,
  8.     GDK_RGB_DITHER_NORMAL,0,0);  
  9.  

4. Rebuild/reinstal BGRABitmap package

Osvaldo Arruda

  • New Member
  • *
  • Posts: 27
Re: BGRAControls
« Reply #559 on: October 23, 2012, 02:52:13 pm »
the problem may be that, but it is not the only.

[ unit bgragtkbitmap.pas ]

{$IFDEF LCLgtk2}
type TGtkDeviceContext = TGtk2DeviceContext;
{$ENDIF}

/home/osvaldo/lazarus/components/bgrabitmap/bgragtkbitmap.pas(70,44) Error: Identifier not found "TGtk2DeviceContext"

???

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #560 on: October 23, 2012, 02:54:32 pm »
Comment this type

lainz

  • Guest
Re: BGRAControls
« Reply #561 on: October 23, 2012, 03:11:59 pm »
I can't run this demo, I get SIGSEGV error in line 285 of BGRASliceScaling unit. But I understand how it working. This bring me old idea which you are implementing.
Creating GUI by using gimp/photoshop is much easier than doing this programatically. So I wanted create some style manager (or custom drawn drawer) which only manage mouse and controls states, and all styles are just PNG images. Drawing ready png image should be faster than whole complicated mathematic drawing. This solution powered by BGRABitmap tools give unlimited possibilities for creating modern and nice looking GUI like in web applications. I'm realy impressend with BGRAImageButton and it animation property.
Just imagine this GUI sliced to separated png files and managed by style manager:
http://dribbble.s3.amazonaws.com/users/13307/screenshots/562878/attachments/42390/Full-size.jpg

But I stuck with resizing problem and seems that your slice tool is solution

Exactly. I you has the PSD source is easy to export each button to PNG and then slice scale.

Osvaldo Arruda

  • New Member
  • *
  • Posts: 27
Re: BGRAControls
« Reply #562 on: October 23, 2012, 03:41:35 pm »
Very good, but ... the executable size, hehehehe

thanks all

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #563 on: October 23, 2012, 04:06:16 pm »
Very good, but ... the executable size, hehehehe
?
Exactly. I you has the PSD source is easy to export each button to PNG and then slice scale.
What about this SIGSEGV error?

lainz

  • Guest
Re: BGRAControls
« Reply #564 on: October 23, 2012, 04:27:48 pm »
Very good, but ... the executable size, hehehehe
?
Exactly. I you has the PSD source is easy to export each button to PNG and then slice scale.
What about this SIGSEGV error?

I think that the executable size is about putting all the bitmaps in the 'Bitmap' property, that Isn't recommendable, maybe in future in BGRAImageButton I'll delete that property and just use directly the bitmap property of the BGRASliceScaling.

About the error I've no idea, I'm using Windows, latest svn of BGRA and latest svn of Lazarus.
« Last Edit: October 23, 2012, 04:58:47 pm by lainz »

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #565 on: October 23, 2012, 09:04:40 pm »
Lainz, could you create some simple tutorial how to use BGRASliceScaling?  I can't run demo on linux

lainz

  • Guest
Re: BGRAControls
« Reply #566 on: October 24, 2012, 12:42:30 am »
Lainz, could you create some simple tutorial how to use BGRASliceScaling?  I can't run demo on linux

Well If this test project works for you, the problem is in TBGRAMultiSliceScaling and not in TBGRASliceScaling.

If this doesn't works, I've no idea.

How to use it: change the size of the Window. And if you want to hide the red lines, edit the code and set the boolean value to false.

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRAControls
« Reply #567 on: October 24, 2012, 06:59:27 pm »
It's not about speed, but about having various kinds of buttons, that would be complicated to do otherwise.
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRAControls
« Reply #568 on: October 25, 2012, 02:58:05 pm »
Ok.

BTW Dibo it works or not for you?

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #569 on: October 25, 2012, 03:37:31 pm »
Yes, it is working very well. I forgot to answer

 

TinyPortal © 2005-2018