Forum > BGRABitmap and LazPaint
Building a composite image
J-G:
--- Quote from: Handoko on June 10, 2022, 07:53:08 pm ---Maybe you can find something useful on my previous project - CATWW:
--- End quote ---
Thanks Handoko, I've had a quick look but naturally I will need to spend some time to fully understand what techniques may be useful. - 'Resize' will certainly be one but it may be 'Composition' that will deliver what I need - that is if 'Composition' means adding images together.
--- Quote from: Handoko ---The newest version 0.3 (see the image below), which has not been published, has improved further. But you still may find many useful techniques in the version 0.2, like:
- Image caching for performance improvement, multires version
- Runtime generating/showing a progress form when loading data
- BGRABitmap translate, resize, rotate, flip, resample, composition
Unfortunately the code is moderately optimized, it is a bit hard for novices to understand.
For your information, BGRABitmap is not fully hardware accelerated. If you want to do some real-time animations using it, you really need to do plenty of optimizations and/or image caching.
--- End quote ---
I'm not too concerned about 'Real-Time' animation in this case - I have been in the past, witness the attached ScreenGrab which shows two of the time-pieces that I wrote in 2016/19 - they are both 'Transparent' but use bitmaps created in CorelDRAW! rather than the 'ellipses' suggested by @Winni
This program will not have the gears 'animated', they will just be shown in the correct location relative to each other. If I wanted animation I would want the images to include the correct number of teeth and for them to 'mesh' correctly and I suspect that would demand that I would have to draw all 108 separate gears. :o - it may even yet come to that!
winni:
Hi!
There are a lot of overloaded versions of TBGRAbitmap.create.
This one creates a transparent bitmap:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---MyBmp := TBGRAbitmap.create (w,h);
A lot of your questions to BGRAbitmap is already anwered in the tutorial. Read it slow and not only once:
https://wiki.freepascal.org/BGRABitmap_tutorial
Winni
J-G:
--- Quote from: winni on June 11, 2022, 01:17:05 am ---There are a lot of overloaded versions of TBGRAbitmap.create.
A lot of your questions to BGRAbitmap is already anwered in the tutorial. Read it slow and not only once:
--- End quote ---
I have quite a few BGRA Tutorials open on a permanent basis and am constantly referring to them, though I will admit that the TChart one did not strike me as being useful in this particular instance :)
I've started a new project to better understand the facilities in BGRA..... but I've come up against a brick wall very quickly. I've put 'BGRABitmap' in the [Uses], specified a couple of 'Constants' and a few 'Vars' , created a TEdit and its associated 'OnEditingDone' event. This ought to be a simple initial test but it refuses to compile, reporting that it can't find BGRABitmap ???
I've checked [Package][OPM] and can confirm the BGRABitmap & BGRABitmapTypes are 'Installed', and I've compared the 'Paths' in this and the 'Gears' Project and they are identical. The issue can't be a mis-spelling, the entry in the 'Uses' is a Copy'n'Paste from the 'Gears' program.
I'm either tired or baffled but I can't see why :( - - It can't be the former, I've only done 18½ hours coding today :) - much of that has been asking and aswering questions though!
Since it is < 60 lines, here's the complete code :
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit ShowGears;{$mode objfpc}{$H+}interfaceuses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, BGRABitmap, BGRABitmapTypes; type { TForm1 } TForm1 = class(TForm) NoOfTeeth : TEdit; procedure FormCreate(Sender: TObject); procedure NoOfTeethEditingDone(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.lfm} Const DP : word = 20; M : single = 25.4;Var{ TForm1 } OD, PCD, Root : word; DM : single; tmp : TBGRABitmap; Centre : TPointF; T : byte; procedure TForm1.FormCreate(Sender: TObject);begin Width := 600; Height := 600; DM := 1 / DP;end; procedure TForm1.NoOfTeethEditingDone(Sender: TObject);begin T := StrToInt(NoOfTeeth.Caption); OD := Round(T * DM * M); OD := OD + OD Mod 2; tmp := TBGRABitmap.Create(OD,OD);end;end.
lainz:
Open the bgrabitmap package and add use, add to project. Done. Now you can use bgrabitmap.
Josh:
or add the requirement in project inspecter
Navigation
[0] Message Index
[#] Next page
[*] Previous page