Lazarus

Programming => Graphics => Graphics and Multimedia => BGRABitmap and LazPaint => Topic started by: circular on July 12, 2015, 09:46:11 pm

Title: BGRA Contest
Post by: circular on July 12, 2015, 09:46:11 pm
Hello BGRABitmap users!

We would like to announce a graphic contest with BGRABitmap !

The principle is that anyone can participate and write a program that will be put into the lights on this thread.

The contest aims at:
- Testing your skills, giving yourself a little challenge!
- Showing your skills, so that we can enjoy them!
- Teaching others as they can look at your code afterwards.

Every program will be mentionned at the end of the contest and their code published as GPL or any other open source variants.

Programs that are considered to be in a similar category will be ranked using a public poll. The first of each category will be a winner! The others will be venerable participants.

Note: if you are not registerd on the forum already, it is easy to do so in a few mintues. You can start by clicking on Register in the top right corner.

...Suggested categories of program:
- UI design: create controls and an interface using BGRABitmap. You can get some inspiration from BGRAControls.
- Photo manipulation: create new images from exiting photos using code, create filters, etc.
- Rendering: create images from scratch just using code, create textures, etc.
- Gaming: create a 2d game using BGRABitmap. If you need high speed rendering on the whole screen, it is recommended to use BGRAOpenGL.

Those categories are suggested. You are free to do something different.

If you would like to participate, please indicate it in this thread or send me a PM. Once the contest has started, there will be about one month time to code. While it is ok to use some code you already wrote, we would like you to make something special for this contest. Also don't forget to give credits to people who helped you!
Title: Re: BGRA Contest
Post by: lainz on July 12, 2015, 10:11:54 pm
I'm in. It will be awesome!

I'll do my best. Rendering category remembers me the Demoscene contest (you can look at youtube). That kind of contest was my inspiration on suggesting this.
Title: Re: BGRA Contest
Post by: typo on July 13, 2015, 12:10:18 am
Good thing. Congratulations.
Title: Re: BGRA Contest
Post by: aradeonas on July 13, 2015, 12:36:13 am
It will be useful and fun!
I'm in.
Title: Re: BGRA Contest
Post by: lainz on July 13, 2015, 06:12:45 am
category: Rendering.
using: BGRABitmap, BGRAControls.
video composition: Blender.
music: The Rain by YouTube Audio Library.
name: by007 - Koala in TV.
duration: 42s.

Video (720p 60 FPS):
https://youtu.be/jogtqbRUa8A

Description:
This is the story of the most famous Koala in the world, the one that comes with Windows 7 pictures folder. He or She lives in an old TV that is not working very well. Then when is updated to color it becomes crazy and get's stretched and blured in a chaotic way until the end comes with the fast passing credits and then everything becomes black.

Usefull info:
This can be played in realtime at 320x240 and looks awesome until the final blur filters are called and the slowdown comes. No music in realtime playing. There are bugs like the 'no fading' at the end (I want a fading ending).  :'( . All the code was made on the go so I've not optimized nothing at all.

Attached the source but not the picture. Search in google for Koala Windows 7 and you'll get it. is 1024x768.

Less usefull info:
2.38 GB of png images (output) 1280x720
2529 frames (aprox. some empty end frames deleted)
a _ l o t _ of time rendering
291 lines of code
it needs BGRAControls because uses NoiseBWA in BCFilters unit and BGRAVirtualScreen.
this uses a lot of random so it will never look the same.
Title: Re: BGRA Contest
Post by: circular on July 13, 2015, 07:55:28 pm
I'll do my best. Rendering category remembers me the Demoscene contest (you can look at youtube). That kind of contest was my inspiration on suggesting this.
Ah yeah I remember. In particular the famous Future crew.  :)
Title: Re: BGRA Contest
Post by: macmike on July 13, 2015, 08:27:06 pm
I'm in. BGRABitmap is the 2nd best thing since sliced bread.
Title: Re: BGRA Contest
Post by: aradeonas on July 14, 2015, 01:47:54 am
Is there limits for participant's programs count in any way?
Title: Re: BGRA Contest
Post by: lainz on July 14, 2015, 03:38:25 am
Is there limits for participant's programs count in any way?

I think there is not. I think should be only one by category.

Edit: If you do more than one by category maybe will be right to choose just one to participate in the poll so everyone has the same chances to win.
Title: Re: BGRA Contest
Post by: circular on July 14, 2015, 08:18:41 am
There is no limit in participant (neither lower or upper limit).

What end date for registration? What end date for posting the programs?
Title: Re: BGRA Contest
Post by: aradeonas on July 14, 2015, 11:14:46 am
Quote
I think there is not. I think should be only one by category.

Edit: If you do more than one by category maybe will be right to choose just one to participate in the poll so everyone has the same chances to win.
You are right but because its the first contest and maybe low participants count it will good to havent limit for now but Im agree with you and try to choose only one.
Quote
What end date for registration? What end date for posting the programs?
I don't have idea for registration but for posting one month is good I think.

PS.I think you should post about contest in mail list.
Title: Re: BGRA Contest
Post by: lainz on July 14, 2015, 02:43:07 pm
You are right but because its the first contest and maybe low participants count it will good to havent limit for now but Im agree with you and try to choose only one.
Quote
What end date for registration? What end date for posting the programs?
I don't have idea for registration but for posting one month is good I think.

I mean upload all your stuff but for example if you have 2 UI choose just one for the poll.
But circular said no limit at all so do it that way he is the organizer!

A month is good, not too much time please :)
For registration maybe no time, at least this first contest.
Title: Re: BGRA Contest
Post by: BitBangerUSA on July 14, 2015, 04:26:58 pm
kewl contest...

as i've not done anything with BGRABitmap, i haz a sad.
Title: Re: BGRA Contest
Post by: aradeonas on July 14, 2015, 04:41:16 pm
Quote
kewl contest...

as i've not done anything with BGRABitmap, i haz a sad.
You have time,Please do.
Title: Re: BGRA Contest
Post by: lainz on July 14, 2015, 06:05:51 pm
Yes, enter the contest!

I'll keep my submission video but I'll optimize my code to keep it more readable and faster.
Title: Re: BGRA Contest
Post by: circular on July 14, 2015, 08:15:43 pm
There are 4 people in the contest for now as far as I know.
Title: Re: BGRA Contest
Post by: aradeonas on July 14, 2015, 08:24:08 pm
you don't want to participate circular? ;)
Title: Re: BGRA Contest
Post by: BitBangerUSA on July 14, 2015, 09:08:44 pm
Quote
kewl contest...

as i've not done anything with BGRABitmap, i haz a sad.
You have time,Please do.

actually, i don't... a good % of my 'free' time is better used studying to a Cisco Cert...
but i look forward to what others do with the contest.
Title: Re: BGRA Contest
Post by: circular on July 14, 2015, 09:29:57 pm
@aradeonas: I've counted myself  8)
Title: Re: BGRA Contest
Post by: aradeonas on July 15, 2015, 12:58:04 am
Quote
@aradeonas: I've counted myself  8)
Very very good.
Title: Re: BGRA Contest
Post by: lainz on July 15, 2015, 08:40:32 pm
Hi everyone,

As maybe you already know, this is my participation for the Rendering category
http://forum.lazarus.freepascal.org/index.php/topic,29038.msg182716.html#msg182716

...
I'll keep my submission video but I'll optimize my code to keep it more readable and faster.

Now I've made another version
- Runs from start to finish in real time
- Internal resolution can be set (default 320 by 240)
- Everything is inside an object and commented
- Calculations of position and other stuff is precalculated
- Runs faster at any resolution (default 1024x768)

It looks more retro even by the default internal resolution. Also I've trimmed the 'crazy stuff' when the Koala recovers the color. And also the credits are more visible now. Its a nicer version :)

Download (Source and pre compiled win32)
Edit: I've optimized it a bit more thanks to circular for help http://forum.lazarus.freepascal.org/index.php/topic,29072.msg182956/topicseen.html#new

This is the new download:
http://sourceforge.net/projects/lainz007/files/by007_koala_final.7z/download
Title: Re: BGRA Contest
Post by: circular on July 17, 2015, 11:17:31 pm
That's cool stuff 007. You still have much time to add things to your project. Either before, after, during, ...

So people, let's say the contest starts now! So you are invited to start to do your programming for this contest.

Some people are clearly participating, others are considering it.

You can join later if you like. The only thing is that you have less time if you start later. But you can still get a good result. And in fact, most people are not available everyday so your exact start date is not very important.

We need to decide of an end date. This date can be something like the 17th of august. What do you think?
Title: Re: BGRA Contest
Post by: aradeonas on July 17, 2015, 11:28:28 pm
I think its enough time for every one wants to participate.
And like contests RUN!
007 start faster than us and done a very good job but I will come :D
Title: Re: BGRA Contest
Post by: lainz on July 17, 2015, 11:36:39 pm
I'll keep Koala as is. Video + the 2 source codes (video one and realtime one).

I'll do another one! Since there's no limit of projects. The last one I'll publish one of the lasts days of the contest.

17th august is fine for me.
Title: Re: BGRA Contest
Post by: lainz on July 19, 2015, 05:54:39 pm
Hi, I've created a repository on GitHub where all the participations will be uploaded in time. (GitHub because it's easy, just install and clone and commit.. you know).

Here:
https://github.com/bgrabitmap/bgracontest

I've uploaded my participations
- by007_koala (source and video source)
- by007_target

This is my last participation by007 "Target" Video:
https://www.youtube.com/watch?v=giHRejMyd20&feature=youtu.be

Is what you want to be :) Compile the source and play with your mouse at the rhythm of your favourite music (open in your favourite music player first..) and enjoy!

Credits: all two bitmaps are made by me, except the background that's a free background from somewhere.
Music: Ipanema Daydream (YouTUBE Music Library).
Title: Re: BGRA Contest
Post by: aradeonas on July 19, 2015, 06:39:31 pm
Its great,Thank you 007.You are very good at FX.
Title: Re: BGRA Contest
Post by: lainz on July 19, 2015, 09:53:39 pm
Thanks :)

Without bgrabitmap I can't even imagine how to do it.
Title: Wall of covers
Post by: aradeonas on July 20, 2015, 09:19:44 am
Welcome to the Wall of covers!

Name: Wall of covers.
Category: UI design (Controls,Animation,Rendering and others).
Author: Ara
Platforms : In theory every graphical platform that Lazarus and FreePascal support but checked only in Windows 8 and Ubuntu.
Description: This application is a fake music player that shows a beautiful wall made of album covers while playing music.
Idea: A proof of concept of if I can make a slightly complicated UI like Zune player with Lazarus and BGRAbitmap.
How it works: It will use covers in the covers folder for making a random wall and for that it will resize them and make them black and white and then put a big effect on all the wall made with some gradients and in the end show some controls,also don't forget to animate the covers!

How to use:
1) Run application.
2) Sit back.
3) And watch!
4) Don't forget to play with buttons.
5) When you tired of this or want to check the source press esc or back button.

Some notes:
-This is a demo of WallOfTiles and its not made especially for a music player so you can use it differently .
-All the works are in real time and take me a while to optimize it.
-If you delete covers it shows you random colors and I like it if you make BlackAndWhite option off.
-Animations are random so take some time to show that,also they made with AnimateEasing easing library.
-All the times and options are configurable.
-Buttons are vector and paint in real time so you can make them any size you want.
-I'm not a professional developer and I this code hasn't any comment so if you have questions let me know.
-If you want to make this application real player please let me know.
-Its mainly a fake application so everything is just for testing so don't except playing music!

Known problems and wishes:
-Not truly random,I used Random function and try to make everything random but honestly I don't like it much,I wish to make it better.Yes I know computers don't make truly random numbers but there is ways to make it better in this application.
-Slow gradient,it take time to make a main effect and I want to make it live so change colors in a while but I couldnt because it is slow.
-Its not moving! I like to move wall very slowly like a moving camera and it needs moving lower than 1 pixel at a time and I try that but it lose quality so I removed it.If anyone want to give it a try make BitmapX and BitmapY into single and change them in TimerOnTimer  and probably you should use PutImageSubpixel in RedrawBitmapContent instead of PutImage.
-Slow cover resize,I used resemble but if there is way to make it faster I be more than happy.I used it mainly in Effects.

Thanks to:
-Circular for the lovely BGRAbitmap and who ever help him and his kind helps.
-BGRAcontrols authors.
-007 for helping me as always and great contest idea.
-Appzgear for icons.
-Norbert Mereg because of AnimateEasing.
-Who made album covers.
-Zune designer and it's developers for making such a beautiful application.
-And who ever I forgot to thanks ;)

for more info take a look at source.

Download links:
Executable (Windows) (http://bit.ly/1IdY2oz)
Source and executable (Windows) (http://bit.ly/1JrPDZf)
Source (http://bit.ly/1I4Ur62)
Title: Re: BGRA Contest
Post by: lainz on July 20, 2015, 03:14:52 pm
This is one of the finesse applications I ever seen!

Everything is on place, and you even used vector buttons. And is fullscreen!

About speed, welcome to the software render :) But maybe circular knows how to speed up things. Maybe using a precomputed gradient and applying a filter to it to swap colors you can do what you want.

I'm adding it to the bgracontest repository.
Title: Re: BGRA Contest
Post by: aradeonas on July 20, 2015, 03:36:38 pm
Thank you  :P

Gradient will compute only one time and even for animation I will crop the gradient and paint it one time but problem is in first time compute that take time even I make gradient simpler.
Title: Re: BGRA Contest
Post by: Leledumbo on July 20, 2015, 05:09:18 pm
Nicely compiled and tested on x64_64-linux-qt, looks good for a music player visualization.
Title: Re: BGRA Contest
Post by: aradeonas on July 20, 2015, 05:16:53 pm
Nicely compiled and tested on x64_64-linux-qt, looks good for a music player visualization.
Thanks.As I said if anyone want to make it real please let me know.
Title: Re: BGRA Contest
Post by: circular on July 20, 2015, 08:33:10 pm
Very nice program aradeonas!

What I can suggest to speed it up: use rmSimpleStretch only for resampling. When resampling smaller, there is not much difference between rmSimpleStretch and rmFineResample however rmFineResample is much slower. This applies to GetTileBitmap.

For the gradient, in WallEffect1 function, I would suggest to draw each gradient once and apply BlendImage multiple times. For now, it creates the gradient before each BlendImage.

You can also skip the allocation of the layer by allocating before and after the big loop.

Also you can use horizontal bands of less than 65536 pixels. This allows to use the memory cache.

Putting all this together you get the following:
Code: [Select]
function TWallOfTiles.WallEffect1(w, h: integer; Percent: single): TBGRABitmap;
var
  layer: TBGRABitmap;
  i, j, ww, hh: integer;
  p1, p2: TPointF;
  c1, c2: TBGRAPixel;
  co: integer;
  band,bandVertSize,bandCount,remainY,deltaY: integer;
begin
  Result := TBGRABitmap.Create(w, h);
  ww := Result.Width;
  hh := Result.Height;
  bandVertSize := 65536 div ww;
  if bandVertSize < 8 then bandVertSize := 8;
  bandCount := (hh+bandVertSize-1) div bandVertSize;
  layer := TBGRABitmap.Create(ww,bandVertSize);
  for i := 1 to 5 do
  begin
    case i of
      1:
      begin
        c1 := BGRA(179, 130, 210, 255);
        c2 := BGRA(255, 255, 255, 255);
        p1 := PointF(-ww / 5, -hh / 5);
        p2 := PointF(ww, hh);
        co := 2;
      end;
      2:
      begin
        c1 := BGRA(49, 206, 148, 255);
        c2 := BGRA(255, 255, 255, 255);
        p1 := PointF(ww / 3, hh * 1.1);
        p2 := PointF(0, 0);
        co := 2;
      end;
      3:
      begin
        c1 := BGRA(131, 198, 57, 255);
        c2 := BGRA(255, 255, 255, 255);
        p1 := PointF(ww * 1.1, hh / 2);
        p2 := PointF(ww * 0.2, hh / 2);
        co := 2;
      end;
      4:
      begin
        c1 := BGRABlack;
        c2 := BGRA(255, 255, 255, 255);
        p1 := PointF(ww, -hh / 2);
        p2 := PointF(ww / 2, hh / 2);
        co := 1;
      end;
      5:
      begin
        c1 := BGRA(0, 0, 0, 0);
        c2 := BGRAWhite;
        p1 := PointF(-ww / 5, hh * 1.2);
        p2 := PointF(ww / 4, hh * 4 / 5);
        co := 3;
      end;
    end;
    remainY := hh;
    deltaY := 0;
    for band := 0 to bandCount-1 do
    begin
      deltaY += bandVertSize;
      layer.GradientFill(0, 0, layer.Width, remainY, c1, c2, gtRadial, PointF(p1.x,p1.y - deltaY),
        PointF(p2.x,p2.y - deltaY), dmSet);
      for j := 1 to co do
        Result.BlendImage(0, deltaY, layer, boMultiply);
      remainY -= bandVertSize;
    end;
  end;
  layer.Free;
end;

It is a bit faster, however, a radial gradient is a bit slow as it computes square roots. Maybe it is possible to make an "almost" radial gradient that would be fast to compute with the CPU.

Regards
Title: Re: BGRA Contest
Post by: aradeonas on July 20, 2015, 09:05:41 pm
Thanks.
Yes it faster but I colunt understand your changes for gradient.can you explain it more?
Ah,I made it in two days and in a hurry so I forgot rmSimpleStretch for GetTileBitmap!
Title: Re: BGRA Contest
Post by: circular on July 20, 2015, 09:12:07 pm
What lines you would like me to explain?
Title: Re: BGRA Contest
Post by: aradeonas on July 20, 2015, 09:14:48 pm
band part,what it do?
Title: Re: BGRA Contest
Post by: circular on July 20, 2015, 09:16:55 pm
The principle is to use a small amount of memory at one moment. So instead of having a fullscreen gradient to apply, we can have an horizontal band (horizontal size like the picture, vertical size is a fraction of the picture height).
Title: Re: BGRA Contest
Post by: aradeonas on July 20, 2015, 09:25:11 pm
Ah.Its interesting so it should use low memory?because I didn't notice anything.
Also how can I make a simple 3 color gradient?
Title: Re: BGRA Contest
Post by: circular on July 20, 2015, 09:28:59 pm
It uses less memory for the layer, but what matters here is that at a given moment, it accesses a small amount of memory.

You can use TBGRAGradientTriangleScanner of BGRAGradientScanner. Create an instance, and then call TBGRABitmap.Fill with the gradient as a parameter.

Or did you want to say a gradient from a color A to a color C via a color B? In this case, you can use TBGRAMultiGradient in BGRAGradientScanner, and pass it as a parameter to TBGRABitmap.GradientFill.
Title: Re: BGRA Contest
Post by: circular on July 20, 2015, 09:48:58 pm
Hi Leledumbo! How are you doing?
Title: Re: BGRA Contest
Post by: aradeonas on July 20, 2015, 09:52:42 pm
Both,I thought maybe this way can speed things a little in some places.Thank you.
Title: Re: BGRA Contest
Post by: Leledumbo on July 20, 2015, 10:10:41 pm
Hi Leledumbo! How are you doing?
Fine, I'm still here, in other sections to be precise. I'm bad at applications like this, I'm more comfortable to code non (or at least simple) UI things such as writing libraries or framework, services, web grabbers, etc. so I'm just gonna be a spectator here.
Title: Re: BGRA Contest
Post by: circular on July 20, 2015, 10:27:24 pm
Alright. Well you are welcome here to enjoy :)
Title: Re: BGRA Contest
Post by: lainz on July 25, 2015, 11:10:44 pm
What are you preparing Circular? You want to win us with something big, I feel it.. ;)
Title: Re: BGRA Contest
Post by: aradeonas on July 25, 2015, 11:16:10 pm
What are you preparing Circular? You want to win us with something big, I feel it.. ;)
I feel that too ,but it not easy as it seems :D
Title: Re: BGRA Contest
Post by: circular on July 26, 2015, 07:18:09 pm
Well you did a very good job, it is not going to be easy.

But anyway, I am very happy that your demos are great.  :)

And mine will be too!  8-)
Title: Re: BGRA Contest
Post by: aradeonas on July 26, 2015, 07:25:17 pm
Well you did a very good job, it is not going to be easy.

But anyway, I am very happy that your demos are great.  :)

And mine will be too!  8-)
Dont let it for the late,so maybe we got time to try again :D
Title: Re: BGRA Contest
Post by: BitBangerUSA on July 26, 2015, 08:32:28 pm
kewl use of 'media-style controls' aradeonas.

i could see this as being - sort of - a desktop screen saver, if you had the program reading a users media folder.
but then there *could* be a copyright issue...
Title: Re: BGRA Contest
Post by: aradeonas on July 26, 2015, 08:37:35 pm
Thanks.But why?
Title: Re: BGRA Contest
Post by: Zittergie on July 26, 2015, 10:12:11 pm
@aradeonas: Nice... I would love to use this in XiXMusicPlayer (http://www.xixmusicplayer.org (http://www.xixmusicplayer.org))

I already have a Fullscreen MediaMode, but it would be nice to create some plugin support, so extras like this can be added on the fly instead of hardcoded in the XiX Source code. :D
Title: Re: BGRA Contest
Post by: aradeonas on July 26, 2015, 10:25:20 pm
@aradeonas: Nice... I would love to use this in XiXMusicPlayer (http://www.xixmusicplayer.org (http://www.xixmusicplayer.org))

I already have a Fullscreen MediaMode, but it would be nice to create some plugin support, so extras like this can be added on the fly instead of hardcoded in the XiX Source code. :D
Thank you.I will be more than happy.
If you want any help just tell me,also if you add this in the project.
Title: Re: BGRA Contest
Post by: lainz on July 27, 2015, 06:17:41 am
@aradeonas: Nice... I would love to use this in XiXMusicPlayer (http://www.xixmusicplayer.org (http://www.xixmusicplayer.org))

I already have a Fullscreen MediaMode, but it would be nice to create some plugin support, so extras like this can be added on the fly instead of hardcoded in the XiX Source code. :D

I suggest you to use .dll or will be a hell trying to implement everything needed with scripting like pascal script or la-pe (bgra is working more with la-pe, but I don't know what's the current implementation status...). pascal script is slow and it does not support the necessary stuff to do it.

Like calling predefined functions passing canvas as parameter for example, to draw each element needed. Its a very tiny start :)
Title: Re: BGRA Contest
Post by: lainz on July 28, 2015, 01:45:01 am
I have your plugin working ;)

Well..

This is an example and only works under Windows.

This is the DLL that implements "DrawSomething" that receives a TCanvas where to draw. Use of bgrabitmap is optional, but I choose to use it.
Code: [Select]
library project1;

{$mode objfpc}{$H+}

uses
  Classes, BGRAGraphics, BGRABitmap, BGRABitmapTypes, Math;

procedure DrawSomething(ACanvas: TCanvas); stdcall;
var
  bmp: TBGRABitmap;
begin
  bmp := TBGRABitmap.Create(ACanvas.Width, ACanvas.Height);
  bmp.Rectangle(Random(10), Random(10), RandomRange(10, 50), RandomRange(10, 50), BGRABlack, BGRAWhite, dmSet);
  bmp.Draw(ACanvas, 0, 0);
  bmp.Free;
end;

exports
  DrawSomething;

begin
end.


This is the Form that uses the DLL (it does not requires to be compiled BGRABitmap to work).

The DLL must be in the folder 'plugins' and it must be named 'project1.dll'. Of course you can imagine how to have a lot of dll in that folder and load just the one that you choose.

Code: [Select]
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  Windows;

type

  TDrawSomething = procedure (ACanvas: TCanvas); stdcall;

  { TForm1 }

  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormPaint(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
    MyLib: HINST;
    DrawSomething: TDrawSomething;
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

function GetPlugin: string;
begin
  result := ExtractFilePath(ParamStr(0)) + 'plugins\project1.dll';
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  MyLib := LoadLibrary(PChar(GetPlugin));

  if MyLib = 0 then
    ShowMessage('Error loading library.')
  else
    DrawSomething := TDrawSomething(GetProcAddress(MyLib, PChar('DrawSomething')));

  if DrawSomething <> nil then
  begin
    ShowMessage('Library loaded.');
  end
  else
  begin
    ShowMessage('Error loading procedure.');
    Application.Terminate;
  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  if FreeLibrary(MyLib) then
    ShowMessage('Library freed.');
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  if DrawSomething = nil then
    exit;

  DrawSomething(Canvas);
end;

end.
         

The code I've done according to this website: http://www.informit.com/articles/article.aspx?p=27837&seqNum=3

It can be done better.

There is a cross platform way of doing this?

Well, at least you have an option for your media player!
Title: Re: BGRA Contest
Post by: BitBangerUSA on July 28, 2015, 02:24:25 am
Thanks.But why?

why? - as a 'sort of' screen saver?

or

why? - as copyright issue?

i just tend to be conservative/careful... if the user didn't have album cover images already downloaded, could be an issue having code to do so... i don't know...

anyway, it may be that you wrote the proggy only for the contest... you can safely ignore my copyright comments... :)
Title: Re: BGRA Contest
Post by: aradeonas on July 28, 2015, 08:18:06 am
Thank you Lainz , its a good demo.
BitBangerUSA I meant copyright and no it will not a problem because its only a demo and also in real program it should get covers from music files but thank you for notice.
Title: Re: BGRA Contest
Post by: Zittergie on July 28, 2015, 08:56:48 pm
Incorporated aradeonas his work in XiX Music Player:  https://youtu.be/DYpDzOzGI6w (https://youtu.be/DYpDzOzGI6w)

It is still a bit slow and a few things like an active 'shuffle' button and three states for the repeat button needs to be added.
Next up is trying to put this in plugins.
Title: Re: BGRA Contest
Post by: aradeonas on July 28, 2015, 09:05:10 pm
Very good.
If you want my help give me a way or source and I will work on it.
In the video there is a delay in mouse hover on buttons,why?
Title: Re: BGRA Contest
Post by: Zittergie on July 28, 2015, 11:03:35 pm
@aradeonas:
My guess it that it is MacOS related.  The compiled source of your demo does the same when pictures are found.  Without pictures it is faster.  I already did the changes circular posted.  I need to test it in Linux and Windows.
Another problem is that when used in XiX only one (sometimes two) tiles animate.  It is always the same tile that animates, while in the source demo, the tiles change.
A nice trick would be that the tiles under the mouse pointer hover up, and clicking the cover plays the album.  When the album gets played, the place of the tile gets taken by another album cover.  %)

Any help is welcome.  Do you have a Sourceforge account?  I can add you to the SVN list.
Latest SVN commit does not yet have the CD Cover Browser (still needs to be polished) and does not yet contain your added demo.

I will put up a link with the latest changes too.

Title: Re: BGRA Contest
Post by: lainz on July 28, 2015, 11:45:39 pm
@aradeonas, @Zittergie:

You can use the unit "dynlibs" instead of "Windows" in order to do the plugin loading cross platform. Everything should work on the example provided, except for this line:
Code: [Select]
    MyLib: HINST; 
That you must replace with:
Code: [Select]
    MyLib: TLibHandle; 
And must be working in all major platforms.

Also check if instead of "stdcall" you must use "cdcall" under Linux and Mac both in the dynamic library .dll / .so / .dylib and in the project itself. (Try using ifdefs to get it in blocks).

For example in the bgrabitmap.dll we're using:
Code: [Select]
{$IFDEF windows}stdcall;{$ELSE}cdecl;{$ENDIF}
Edit: Of course maybe you already know all of this, I'm so intrigued to do my own plugin ;) Like the old Winamp and Windows Media Player ones!
Title: Re: BGRA Contest
Post by: aradeonas on July 29, 2015, 07:34:04 am
Zittergien ,yes I have,my username here is also in sf.
Lainz: thank you I should check this out ;)
Title: Re: BGRA Contest
Post by: Zittergie on July 30, 2015, 09:35:57 pm
In the video there is a delay in mouse hover on buttons,why?

The overall drawing speed is very slow.  Just did a recompile in Windows and everything runs smooth, even on a low budget 99 Euro Windows 8 Tablet :)
I had the same problem on MacOS when drawing the Spectrum Analyzer using a timer to do the drawing.  Changing from TTimer to a seperated Thread the problem was solved.  So I will check if we can change it to a seperated Thread.  Don't know if AnimateEasing also has to be threaded, or the Timer is good enough.

The problem that always the same tile was changing is solved.  I had to put a second instance of randomize in the used unit.  I asumed that calling randomize in the Main form (used to randomize the playing queue) was enough.
Title: Re: BGRA Contest
Post by: aradeonas on July 30, 2015, 09:43:45 pm
I think putting the class in thread will be enough .
About MacOS maybe Circular can help.
Title: Re: BGRA Contest
Post by: lainz on July 30, 2015, 11:03:43 pm
I think putting the class in thread will be enough .
About MacOS maybe Circular can help.

He doesn't have a Mac. A virtual machine with a Mac system is not as easy to create too.
Title: Re: BGRA Contest
Post by: aradeonas on July 30, 2015, 11:05:34 pm
Yes I test that in it was a pain ;)
Title: Re: BGRA Contest
Post by: aradeonas on July 31, 2015, 12:01:32 am
I think putting the class in thread will be enough .
About MacOS maybe Circular can help.

He doesn't have a Mac. A virtual machine with a Mac system is not as easy to create too.

So lets make an application or library on BGRABitmap and buy him one as a gift :D
Title: Re: BGRA Contest
Post by: lainz on July 31, 2015, 12:05:44 am
So lets make an application or library on BGRABitmap and buy him one as a gift :D

It's a good idea. What we can do?
Title: Re: BGRA Contest
Post by: aradeonas on July 31, 2015, 12:11:52 am
So lets make an application or library on BGRABitmap and buy him one as a gift :D

It's a good idea. What we can do?
I dont know,may things :P we can talk about it if you want ;)
Title: Re: BGRA Contest
Post by: lainz on July 31, 2015, 12:19:57 am
Well, this must be something that can be sold, right?

I just make free software, so I have no idea :D
Title: Re: BGRA Contest
Post by: aradeonas on July 31, 2015, 12:22:20 am
Well, this must be something that can be sold, right?

I just make free software, so I have no idea :D
:D all humans can change :D
Title: Re: BGRA Contest
Post by: lainz on July 31, 2015, 12:29:04 am
I think we can improve LazPaint and make a commercial edition with more features, like plugins, more brushes and so on.
I have no other idea right now.

BTW I first must know how to do it. Understand the LazPaint code. I've just contributed with the setup file, translations and ideas basically.

Also Circular at some point was suggested by a company or something to include ads in LazPaint setup, but he refused. Ads are annoying.

Well, I'll try to do the plugins thing, at least in a separate demo.
Title: Re: BGRA Contest
Post by: aradeonas on July 31, 2015, 12:33:50 am
Yes maybe ;)
Title: Re: BGRA Contest
Post by: lainz on July 31, 2015, 06:52:25 am
BTW no one here is more qualified than Circular to do it. And if he choose to don't do it he must have their reasons, I think.

This contest derived on a lot of things. Is like a consortium of graphics now.
Title: Re: BGRA Contest
Post by: aradeonas on July 31, 2015, 11:26:31 am
If there will be a new paint like program there is no need to ad,I can work on something like this but problem is the core will be out of my abilities and some one else should prepare that.
Let see what Circular think.
Title: Re: BGRA Contest
Post by: circular on July 31, 2015, 11:56:43 pm
Hi! It is heartwarming to see you trying to find a way to buy me a Mac.  :)

I have started a new job, so hopefully I will have some money soon.

However it is true that plugins could help LazPaint. At some point, I was thinking about running the plugins of other software, like Paint.NET, Gimp or Photoshop.

Many free plugins exist and it would be great to be able to use them in LazPaint.

Indeed, we are talking about everything here.  :)
Title: Re: BGRA Contest
Post by: aradeonas on August 01, 2015, 12:09:35 am
Congratulate ;)

Circular do you have time for a project like we talked?
Title: Re: BGRA Contest
Post by: lainz on August 01, 2015, 12:37:52 am
Congratulations :)

I talked with aradeonas and I said him I'm starting univeristy. But If I can do something in the free time I get I'll do.

If you want more plugins and some that already are out there that will be amazing.

You know, aradeonas is really nice person that is also waiting to do some really cool.

This contest is officialy the source of new ideas.
Title: Re: BGRA Contest
Post by: aradeonas on August 01, 2015, 12:49:27 am
Thank you very much Lainz.
contes is very good idea thanks to you.

About project we can talk about ideas if all wants.
I like LazPaint and we can work on it or peak a new project but if we take LazPaint we can even make new one on the core from beginig with a new structure or interface and I can work on it but some one should take care of core.
As I said we can tallk about it.
Title: Re: BGRA Contest
Post by: mica on August 01, 2015, 11:57:55 am

To reach other Pascal users too someone can post at PGD about the contest.
http://www.pascalgamedevelopment.com/
Title: Re: BGRA Contest
Post by: lainz on August 02, 2015, 06:15:45 am
The contest is finishing soon, about 2 weeks, making a game takes more time, well, I think there they don't know how to use bgrabitmap, they maybe are using directx or opengl or other kind of libs. BGRA has opengl but is not the same :)
Title: Re: BGRA Contest
Post by: circular on August 02, 2015, 10:51:38 am
It is true that they use other libraries however I don't know if they may be interested in participating.

In all cases, it is too short notice. But for next contest, clearly that's a good idea to post it on PGD.
Title: Re: BGRA Contest
Post by: Zittergie on August 03, 2015, 05:54:31 pm
Hi,

for the WallCDCover project that aradeonas has started, I would like to make a graphic listbox component using BGRABitmap.
I have never made a component before, so I will need some help.

Already succeeded in creating a component out of BGRAGraphicControl and install it, but I don't get how to add things like buttons and Listbox.

I've made a small movie what I would like to achieve in the component.  The Test Items should come from TStringList
See @ http://www.xixmusicplayer.org/download/XiXListbox.mp4 (http://www.xixmusicplayer.org/download/XiXListbox.mp4)  or  http://www.xixmusicplayer.org/download/Export.mov (http://www.xixmusicplayer.org/download/Export.mov)
Title: Re: BGRA Contest
Post by: circular on August 03, 2015, 10:20:01 pm
Hello Zittergie! It depends what you would like to do. You can make different controls for different buttons and listbox or make one control that contains everything. A TBGRAGraphicControl cannot contain other controls. A TBGRAVirtualScreen can.
Title: Re: BGRA Contest
Post by: aradeonas on August 03, 2015, 10:22:06 pm
Zittergie about controls Lainz know what is the good way because of experienced.
Circular Im waiting for your answer.
Title: Re: BGRA Contest
Post by: circular on August 03, 2015, 10:25:02 pm
Here is my demo. It is not finished yet: it ends after the earth.

category: Rendering.
using: BGRABitmap, BGRAOpenGL.
name: Probability.
duration: 42s.

Description:
This is the story of the universe, from the ocean of probability to the planet earth.

Usefull info:
It is optimised using BGRAOpenGL to run in real time at a high frame rate.

Most of the images are computed from random numbers.

Download:
http://consume.o2switch.net/lazarus/probability.zip
Title: Re: BGRA Contest
Post by: circular on August 03, 2015, 10:26:46 pm
@aradeonas: about time, currently I don't have much free time.
Title: Re: BGRA Contest
Post by: aradeonas on August 03, 2015, 10:28:25 pm
@aradeonas: about time, currently I don't have much free time.
Normaly I should be sad when find out this but Im going to check your demo so Im not so much ;) but please consider this,maybe we can do something good.
Title: Re: BGRA Contest
Post by: aradeonas on August 03, 2015, 10:34:55 pm
Holly!
That's really good specially light and starts part,I feel I'm hypnotized.
There is bugs in FullHD screen like soon chain disappearing.
But very good and fast ;)
Thank you.
Title: Re: BGRA Contest
Post by: circular on August 03, 2015, 10:39:53 pm
If you feel hypnotized, then I did a good job. I would not want people to get bored!

I take a note of the chain disappearing.

The fact that I don't have much time does not prevent people from contributing to LazPaint. It is just that my personal contribution cannot be very much.
Title: Re: BGRA Contest
Post by: aradeonas on August 03, 2015, 10:47:02 pm
Yes you did as always.also in star scene you can see some of the light scene in the top.
I also working on some project and probably I havent time (I always have time for cotest :D ) but  working with developers like you and Lainz is exciting as working on a project,but sure Im considering working on it alone.
Title: Re: BGRA Contest
Post by: circular on August 03, 2015, 11:01:43 pm
I understand you would like to work together on the project. Of course, you won't be on your own if you contribute, I am around.   ;)
Title: Re: BGRA Contest
Post by: lainz on August 04, 2015, 12:45:19 am
@Zittergie,

As Circular said, TBCGraphicControl can't contain other controls inside, but you can use TBCCustomControl. Both are in the unit BCBaseCtrls. Check the controls that comes with BGRA-Controls, most of them inherit from one of those.

@Circular

Good job, it runs smoothly at 1080p, the stars part is somewhat slow (really a tiny nothing). Good use of fading! Hopefully I can get how to do a proper fading some day. I can't get the bug of chain disapearing, maybe because I just seen in hd and in no other resolution...

The next part of course is when BGRABitmap conquers the world and expand upon other universes, in order to connect different reality scenarios with the power of interdimensional links of pixels.

You can imagine an array of 5 dimensional things, like x, y, z, time and materia? (well, we can do in 2d something =)
Title: Re: BGRA Contest
Post by: circular on August 04, 2015, 07:53:04 pm
Conquering the world and expand upon other universes  :D You may be slightly overestimating the importance of BGRABitmap!

But surely to connect universes, interdimensional pixels would be the way to do it!  :D
Title: Re: BGRA Contest
Post by: BitBangerUSA on August 04, 2015, 09:47:43 pm
'interdimensional pixels' would likely require some new-fangled graphics hardware.
Title: Re: BGRA Contest
Post by: lainz on August 05, 2015, 11:56:15 am
I've added your participation to the public repository on github 'bgracontest'.

Is anyone left? Or we can start the finish of this first contest, I think there is no one waiting to publish their participation right now..
Title: Re: BGRA Contest
Post by: aradeonas on August 05, 2015, 12:12:46 pm
Lets finish it ;)
Title: Re: BGRA Contest
Post by: lainz on August 05, 2015, 02:35:23 pm
Here the sources

https://github.com/bgrabitmap/bgracontest

Here are all the participants (in order of appear)

Koala in TV (lainz#007)
http://forum.lazarus.freepascal.org/index.php/topic,29038.msg182716.html#msg182716
(Variation: http://forum.lazarus.freepascal.org/index.php/topic,29038.msg182959.html#msg182959)

Target (lainz#007)
http://forum.lazarus.freepascal.org/index.php/topic,29038.msg183211.html#msg183211

Wall of covers (aradeonas)
http://forum.lazarus.freepascal.org/index.php/topic,29038.msg183247.html#msg183247
(Video here: http://forum.lazarus.freepascal.org/index.php/topic,29038.msg183862.html#msg183862)

Probability (circular)
http://forum.lazarus.freepascal.org/index.php/topic,29038.msg184328.html#msg184328
Title: Re: BGRA Contest
Post by: aradeonas on August 05, 2015, 03:33:35 pm
Few but good ;)
So how we choose winner?Open online vote or just replay on this topic?
Title: Re: BGRA Contest
Post by: Zittergie on August 05, 2015, 09:17:55 pm
@Circular:  nice done.  Al it needs now is a mod file playing in the background and your name scrolling :)
BTW, it runs well on MacOS

You are all winners here ...
Title: Re: BGRA Contest
Post by: circular on August 06, 2015, 06:48:15 am
Cool! Thanks for the feedback about MacOS, .  :)

My name scrolling, hmm written in little letters then.  :-[

Yes all projects are great!
Title: Re: BGRA Contest
Post by: lainz on August 13, 2015, 02:07:07 pm
Who wins? I win? LOL
Title: Re: BGRA Contest
Post by: aradeonas on August 13, 2015, 02:31:27 pm
008 is right who wins Circular?I win? :D
Title: Re: BGRA Contest
Post by: circular on August 15, 2015, 03:09:33 pm
And the winners are....

For the demo category, I suggest we vote.

I vote for 008 because I quite liked the koala demo. Also I did not have time to finish my demo.

For the category UI, the winner is aradeonas, with a great UI. There was no competitor, but it would have been quite a challenge to do something as great! Here is your trophee!
Title: Re: BGRA Contest
Post by: Carver413 on August 15, 2015, 03:21:27 pm
Nice trophee, did you do that with laz paint ?
Title: Re: BGRA Contest
Post by: aradeonas on August 15, 2015, 03:24:51 pm
Thank you,Thank you :D its good to haven't any competitor. Im sure if you or 008 make something sure I faced to trouble ;)
About rendering it hard to choose really,I like Circular because its more complicated and also I liked star part but I like how koala fill ;)
I dont know how to choose so If I can I will vote for both.
Let see others beside of participates choose  :P

Also thanks for the trophee , Im Excited like child  :P
Title: Re: BGRA Contest
Post by: macmike on August 15, 2015, 03:56:26 pm
Doh! I was away on holiday and then for work - did I miss the deadline?
Title: Re: BGRA Contest
Post by: aradeonas on August 15, 2015, 03:57:52 pm
Doh! I was away on holiday and then for work - did I miss the deadline?
Yes but prepare for the next one ;)
Title: Re: BGRA Contest
Post by: macmike on August 15, 2015, 04:04:50 pm
Oops! Oh well, I've got some code done so I'll keep my eye out for next time!
Title: Re: BGRA Contest
Post by: lainz on August 15, 2015, 07:13:47 pm
I vote for Circular, it runs smoothly and in fullscreen.

Congrats aradeonas, well UI, it get into real applications so no one can beat that.
Title: Re: BGRA Contest
Post by: aradeonas on August 15, 2015, 07:51:27 pm
Congrats aradeonas, well UI, it get into real applications so no one can beat that.
Thank you ;)
Title: Re: BGRA Contest
Post by: circular on August 15, 2015, 08:12:15 pm
Nice trophee, did you do that with laz paint ?
Partially. I've tweaked a trophee image to add "UI" and "aradeonas" on it. Original credit for the trophee goes to Dan Prihoi:
http://danprihoi.info/timelines

Doh! I was away on holiday and then for work - did I miss the deadline?
You did not really miss the end of the contest. The official end date is 17/08/2015. So you have two days left to post your art piece.

So for now, the UI winner is aradeonas and for the demo, there is 2 votes for me and 2 votes for 008.

We may have a surprise with macmike. He may enter into the race within the last two days!

Title: Re: BGRA Contest
Post by: macmike on August 15, 2015, 08:58:15 pm
Well I was planning a UI entry rather than a demo, so maybe I'll hold off til next time :)
Title: Re: BGRA Contest
Post by: circular on August 15, 2015, 09:03:35 pm
Ok. You are free to do as you prefer.
Title: Re: BGRA Contest
Post by: aradeonas on August 15, 2015, 09:08:01 pm
Well I was planning a UI entry rather than a demo, so maybe I'll hold off til next time :)
At least you can vote ;)
Title: Re: BGRA Contest
Post by: lainz on August 17, 2015, 06:38:26 pm
Next time I'll do just UI graphics :)

Maybe it will be an idea for future contest to make one not only about using BGRABitmap, but a global lazarus graphics contest? In the graphics forum and using any library, I think more people will join, of course we need more help to organize this and it gets really bigger enough.
Title: Re: BGRA Contest
Post by: aradeonas on August 17, 2015, 07:55:47 pm
Next time I'll do just UI graphics :)

Maybe it will be an idea for future contest to make one not only about using BGRABitmap, but a global lazarus graphics contest? In the graphics forum and using any library, I think more people will join, of course we need more help to organize this and it gets really bigger enough.
Good idea.
Title: Re: BGRA Contest
Post by: lainz on August 28, 2015, 06:29:18 am
I think it's finished. At least I can say I'm at the same level of circular, with a "dead heat".
Title: Re: BGRA Contest
Post by: aradeonas on August 28, 2015, 10:39:23 am
It is a good idea and I learned from it and have fun,thank you 008 and Im waiting for the next one ;)
Title: congrats !
Post by: mai on October 29, 2015, 11:45:34 pm
great win for the Koala !


works in Wine , but native Linux binary kinda throws error at runtime here.

great contest ! keep it going !
Title: Re: BGRA Contest
Post by: lainz on November 11, 2015, 07:11:30 pm
This was amazing, anyone interested to keep this going on, what about a second event?!
Title: Re: BGRA Contest
Post by: aradeonas on November 11, 2015, 09:46:50 pm
Yes Im in  :D
I Hope more people come this time,This time I will go for another category probably
Title: Re: BGRA Contest
Post by: lainz on May 13, 2016, 11:41:30 pm
I know this is an old post, but anyone interested in do a new bgra contest?

I'm in and aradeonas, circular maybe is in also of course, but any other people wants to participate?

Maybe with a longer period of time this time..
Title: Re: BGRA Contest
Post by: aradeonas on May 13, 2016, 11:49:38 pm
Yea, come and play :D 
Title: Re: BGRA Contest
Post by: aradeonas on May 13, 2016, 11:53:31 pm
Lainz I like your previous comment about using any library, maybe we can see others including Graeme, I like his works.
Title: Re: BGRA Contest
Post by: lainz on May 14, 2016, 12:34:56 am
Lainz I like your previous comment about using any library, maybe we can see others including Graeme, I like his works.

Alright so lets organize a graphics contest instead of a bgra contest, so any graphics library that can be used with FPC and Lazarus can be used.

Ask is the moderator of the graphics forum, maybe we need to tell him first?
Title: Re: BGRA Contest
Post by: aradeonas on May 14, 2016, 08:02:21 am
Very good, Lets wait to see what Circular thinks but feel free to contact moderator but I think there is no need unless you have special plan?
Title: Re: BGRA Contest
Post by: lainz on May 14, 2016, 03:15:14 pm
Alright, just waiting.
Title: Re: BGRA Contest
Post by: circular on May 14, 2016, 03:42:34 pm
Yeah that would be probably more inclusive to accept any graphics library.  8-)
Title: Re: BGRA Contest
Post by: lainz on May 14, 2016, 04:00:02 pm
Alright I'm creating the new topic.
Title: Re: BGRA Contest
Post by: fxc on May 14, 2016, 04:09:02 pm
dose the contest open for other graphic libs ?
Title: Re: BGRA Contest
Post by: lainz on May 14, 2016, 04:17:06 pm
dose the contest open for other graphic libs ?

yes, the new contest thread is here:
http://forum.lazarus.freepascal.org/index.php/topic,32626.msg210454/topicseen.html#new
Title: Re: BGRA Contest
Post by: aradeonas on May 14, 2016, 05:22:19 pm
Very good :D
I'm coming :D
2 month time? I dont know what to do with this much time :D :P
Lainz do you want to do UI this time or something else or both?
Circular take easy on me and please help me on that blur thing :D
Title: Re: BGRA Contest
Post by: lainz on May 15, 2016, 02:02:23 am
Very good :D
I'm coming :D
2 month time? I dont know what to do with this much time :D :P
Lainz do you want to do UI this time or something else or both?
Circular take easy on me and please help me on that blur thing :D

Double the time that the last year! :)

I think I will do UI, not animation, but you can do what you want!

What's about that blur thing?!
Title: Re: BGRA Contest
Post by: aradeonas on May 15, 2016, 08:39:45 am
Quote
What's about that blur thing?!
It's a secret between me and Circular :D
Kidding, he work on optimizing motion blur and I think maybe I can use it.
Title: Re: BGRA Contest
Post by: circular on May 15, 2016, 06:24:07 pm
Ara requested that I would optimize the vertical motion blur. That's on SVN. By the way I would like to release a new version of BGRABitmap with the latest changes.
TinyPortal © 2005-2018