### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: BGRA Controls  (Read 158067 times)

#### circular

• Hero Member
• Posts: 3438
##### Re: BGRA-Controls
« Reply #45 on: September 16, 2014, 10:36:06 pm »
Congratulations!
Conscience is the debugger of the mind

#### circular

• Hero Member
• Posts: 3438
##### Re: BGRA-Controls
« Reply #46 on: September 19, 2014, 07:04:51 am »
Ahah I like that gameboy filter

If I may, you can optimise it by not dividing by 3 and do the case with the numbers multiplied by 3.

It is also possible to reduce the number of comparisons by first checking if the value is above or below the middle, and then in each case to check if it is the lower or higher quarter.
Conscience is the debugger of the mind

#### lainz

• Hero Member
• Posts: 3692
• Leandro Diaz
##### Re: BGRA-Controls
« Reply #47 on: September 19, 2014, 01:58:26 pm »
Thanks, i've seen on internet, tried with Corel Photopaint, worked, then programmed

You have svn access to this repository, i've improved it but can't figure how to improve multiply by 3 instead of div (changed the values, but doesn't look good)

I don't know how to programm dithering, maybe is easy for you to understand.
http://en.wikipedia.org/wiki/Dither#Algorithms

I've already used Threshold, is the same as GameBoy filter.

For the GameBoy filter the best seems to be Bayer matrix or "void-and-cluster", it looks like old video-games.

For photos, everything else.

#### circular

• Hero Member
• Posts: 3438
##### Re: BGRA-Controls
« Reply #48 on: September 19, 2014, 09:14:22 pm »
About the multiplication by 3, to do this, simply remove the "div 3", and then when checking the value, use the values multiplied by 3. So if it was 128, then it becomes 128*3.

About dithering, I always thought it was too complicated for me. However now that I read the Floyd-Steinberg dithering page on wikipedia, it seems to be rather simple. Well, when I have got some time, I might implement dithering in BGRABitmap.
« Last Edit: September 19, 2014, 09:20:10 pm by circular »
Conscience is the debugger of the mind

#### lainz

• Hero Member
• Posts: 3692
• Leandro Diaz
##### Re: BGRA-Controls
« Reply #49 on: September 19, 2014, 10:38:51 pm »
About the multiplication by 3, to do this, simply remove the "div 3", and then when checking the value, use the values multiplied by 3. So if it was 128, then it becomes 128*3.

About dithering, I always thought it was too complicated for me. However now that I read the Floyd-Steinberg dithering page on wikipedia, it seems to be rather simple. Well, when I have got some time, I might implement dithering in BGRABitmap.

Yeah the problem was I did not change the data from byte to integer.

Yeah does not seem hard the Floyd-Steinberg dithering, I will try too.

#### Mike.Cornflake

• Hero Member
• Posts: 1251
##### Re: BGRA-Controls
« Reply #50 on: September 19, 2014, 11:31:18 pm »
Hi guys :-)   This has nothing to do with BGRA-Controls, but everyone in here seems to be graphics savvy :-)

Any chance one of you guys can check the TCanvas.AngleArc patch in http://bugs.freepascal.org/view.php?id=7290 and let us know if it's good?

Looks good to me, but I don't really know what I'm looking at :-)
Lazarus Trunk/FPC Trunk on Windows [7, 10]
Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

#### lainz

• Hero Member
• Posts: 3692
• Leandro Diaz
##### Re: BGRA-Controls
« Reply #51 on: September 21, 2014, 11:35:06 pm »
Hi guys :-)   This has nothing to do with BGRA-Controls, but everyone in here seems to be graphics savvy :-)

Any chance one of you guys can check the TCanvas.AngleArc patch in http://bugs.freepascal.org/view.php?id=7290 and let us know if it's good?

Looks good to me, but I don't really know what I'm looking at :-)

Sorry I have no idea.

In BGRA-Controls SVN:
- Added GameBoy, GameBoyDithering and BlackAndWhiteDithering filters in BCFilters.
- Added pix2svg in test_extra: a tool to convert from bitmap to a map of rectangles, ellipses or hexagons stored in a svg file (maybe is usefull for artists only).

#### lainz

• Hero Member
• Posts: 3692
• Leandro Diaz
##### Re: BGRA-Controls
« Reply #52 on: September 26, 2014, 09:22:13 pm »

Added test_bctilemap, a project that opens a .ini tile map and draw into a BGRAVirtualScreen, and also support for 'painting' selecting the Tile ID in a combobox and then changing the map with the mouse (the most basic code in order to start a map editor).

• New Member
• Posts: 11
##### Re: BGRA-Controls
« Reply #53 on: October 01, 2014, 06:33:26 pm »
HI,
I create an instance of this library.
the question is what should I do and what I should not do?

#### lainz

• Hero Member
• Posts: 3692
• Leandro Diaz
##### Re: BGRA-Controls
« Reply #54 on: October 01, 2014, 08:20:09 pm »
HI,
I create an instance of this library.
the question is what should I do and what I should not do?

If you solve bugs or make improvements you can share patch files here and we can apply them and it will remain in the same library, that you can use for commercial or non-comercial use.

If you do modifications of the library, basically you must: keep as software library, add to the files the changes you made, license for free, provide 'functional' source code.

I don't know if modify is the same as, for example, create inherited classes from the objects in the library..

PD: We must update to LGPL v3?

LGPL v2:
Code: [Select]
`  2. You may modify your copy or copies of the Library or any portionof it, thus forming a work based on the Library, and copy anddistribute such modifications or work under the terms of Section 1above, provided that you also meet all of these conditions:    a) The modified work must itself be a software library.    b) You must cause the files modified to carry prominent notices    stating that you changed the files and the date of any change.    c) You must cause the whole of the work to be licensed at no    charge to all third parties under the terms of this License.    d) If a facility in the modified Library refers to a function or a    table of data to be supplied by an application program that uses    the facility, other than as an argument passed when the facility    is invoked, then you must make a good faith effort to ensure that,    in the event an application does not supply such function or    table, the facility still operates, and performs whatever part of    its purpose remains meaningful.    (For example, a function in a library to compute square roots has    a purpose that is entirely well-defined independent of the    application.  Therefore, Subsection 2d requires that any    application-supplied function or table used by this function must    be optional: if the application does not supply it, the square    root function must still compute square roots.)`

• New Member
• Posts: 11
##### Re: BGRA-Controls
« Reply #55 on: October 02, 2014, 12:44:43 am »
Sorry, I do not modify but create a derived class from the library without the slightest change.

About modifying, I've made ​​a little change on bcimagebutton. because if it is not modified hover state is not lost when modal show on the button.

So, how do I send these changes?

#### lainz

• Hero Member
• Posts: 3692
• Leandro Diaz
##### Re: BGRA-Controls
« Reply #56 on: October 02, 2014, 01:10:23 am »
Ok if you don't modify the library you don't need to do anything.

If you're using SVN you can make a patch, or just upload the modified pas file here, since there is no other change in bcimagebutton we can see the changes easily.

• New Member
• Posts: 11
##### Re: BGRA-Controls
« Reply #57 on: October 02, 2014, 04:30:23 am »
Yappss,
Means I may make a derived class.
and I could use the library derived for commercial and non-commercial?
If I change the library I'll tell you. Thank you ..

I changed in this section

Code: [Select]
`procedure TBCCustomImageButton.DoMouseUp;var  Ctrl : TControl;begin  FFade.Mode := fmFadeIn;  if Animation then    FFade.Step := 20  else    FFade.Step := 255;  Ctrl := Application.GetControlAtMouse;  if Ctrl = Self then    DoMouseEnter  else    DoMouseLeave;  inherited DoMouseUp;end;`
« Last Edit: October 02, 2014, 04:49:59 am by riad02 »

#### lainz

• Hero Member
• Posts: 3692
• Leandro Diaz
##### Re: BGRA-Controls
« Reply #58 on: October 02, 2014, 05:13:23 pm »
Yappss,
Means I may make a derived class.
and I could use the library derived for commercial and non-commercial?
If I change the library I'll tell you. Thank you ..

Thanks for the patch. About a derived class I have no idea I will ask here:
http://forum.lazarus.freepascal.org/index.php/topic,26009.0.html

#### CM630

• Hero Member
• Posts: 910
• Не съм сигурен, че те разбирам.
##### Re: BGRA-Controls
« Reply #59 on: October 06, 2014, 06:31:19 pm »
I cannot find a control in BGRAControls which can show GIF files. Is there such one?
Лазар 2,0,8; W10 or W7 64bit; FPC3,2,0; rev 62944