Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
Graphics / Drawing grid lines on a transparent image
« Last post by Tomi on Today at 04:15:29 pm »
Hello!

I would like draw some lines for a grid in my program onto a TImage, but my code always shows a black background under the grid.
As I did so far on the based on my modest knowledge and searching on the internet, I draw a TImage on a ScrollBox and make an other TImage on this and a bitmap onto this with the grid lines.
Here is my code:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.gridButtonMouseUp(Sender: TObject; Button: TMouseButton;
  2.   Shift: TShiftState; X, Y: Integer);
  3. var bm: TBitmap;
  4.   hlines,vlines: word;
  5. begin
  6.   if showgrid=true then
  7.   begin
  8.      showgrid:=false;
  9.      if gridon=true then
  10.      begin
  11.        FreeAndNil(gridimage);
  12.        gridon:=false;
  13.      end;
  14.   end
  15.   else
  16.   begin
  17.     showgrid:=true;
  18.     if gridon=false then
  19.     begin
  20.       gridimage:=TImage.Create(terrainScrBox);
  21.       gridimage.Parent:=terrainScrBox;
  22.       gridimage.Left:=0;
  23.       gridimage.Top:=0;
  24.       gridimage.width:=terrainCanvas.width; //terrainCanvas is a TImage component.
  25.       gridimage.height:=terrainCanvas.Height;
  26.       gridimage.Transparent:=true;
  27.       bm:=TBitmap.Create;
  28.       bm.width:=terrainCanvas.width;
  29.       bm.height:=terrainCanvas.Height;
  30.       bm.PixelFormat:=pf32Bit;
  31.       bm.Transparent:=true;
  32.       vlines:=tilewidth;
  33.       hlines:=tileheight;
  34.       bm.canvas.pen.color:=clBlue;
  35.       while vlines<terrainCanvas.width do
  36.       begin
  37.           bm.canvas.line(vlines,0,vlines,terrainCanvas.height);
  38.           inc(vlines,tilewidth);
  39.       end;
  40.       while hlines<terrainCanvas.height do
  41.       begin
  42.           bm.canvas.line(0,hlines,terrainCanvas.width,hlines);
  43.           inc(hlines,tileheight);
  44.       end;
  45.       gridimage.picture.graphic:=bm;
  46.       FreeAndNil(bm);
  47.     end;
  48.     gridon:=true;
  49.   end;
  50. end;

How can I make a transparent image with draw on it to show only its draw onto an other image? Is it possible?
2
General / Re: Lazarus features in a non-graphical environment
« Last post by Laksen on Today at 03:46:15 pm »
It is a bit bothering that FPC/Lazarus can cross-compile from Linux to e.g. Windows, but cannot cross-compile it to another Linux. Can there be an easy solution?
Likely not.
I think that sadly this is seen as a "feature" of Linux that you are forced to recompile on a target machine once your project requires sufficiently advanced features (dynamic linking mostly). I don't think this can realistically be fixed from pascal's side
3
General / Re: Parameter passing oddities
« Last post by KodeZwerg on Today at 03:41:49 pm »
Correct.
IKR.  :D
Thaddy says yes, so I'll accept that and leave it at it.
Cool that since 2 pages, where almost everyone told same, me included, gets ignored.

Just for fun
Ask your AI better questions, like in what relation are the arguments or what are your "legal" choices to play with them.
Ask your AI if should be forbid to write to a "var/out" variable.
Ask your AI for a demo that handle all your wishes, I am curious.
4
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by KodeZwerg on Today at 03:24:20 pm »
[sarcasm]
...blame FPC that it doesn't work...
dont we all do this from time to time when something seems to be unlogic and work not as excepted, ofc its fpc's fault since I am purrfect  ;D
[/sarcasm]

Anyway, congratulations paule32 to find out that your way is a dead end  :-[
At least you learned something about binary executable file structures even when I think it's from time to time misunderstood, wrong interpreted or wrong expressed.

As mentioned very early by me, if filesize is your only concern, Pascal is the wrong horse to ride with.
5
General / Re: Parameter passing oddities
« Last post by Nitorami on Today at 03:22:01 pm »
Just for fun, I asked Microsoft's Copilot for its opinion. Here is the response.

Certainly! Let’s analyze the provided Pascal code:

Code: Pascal  [Select][+][-]
  1. procedure add(const a, b: integer; var c: integer);
  2. begin
  3.   c := a + b;
  4. end;
  5.  
  6. var
  7.   C1, C2, C3: integer;
  8. begin
  9.   add(C1, 8, C1);
  10. end.

The code defines a procedure called add that takes two constant parameters (a and b) and one variable parameter (c). The procedure adds a and b and assigns the result to c.

However, there is an issue with the code. In Pascal, a constant parameter cannot be modified within the procedure. The line add(C1, 8, C1); attempts to modify the constant parameter C1, which is not allowed.

To fix this, you should either change the parameter c to be a variable parameter or avoid modifying C1 within the procedure.
6
General / Web Applications with Pascal
« Last post by Nate897 on Today at 03:17:43 pm »
Hey guys  8) 

I recently considered using FPC for web services.

I found this interesting video on the Internet, and found it amusing, and I think it raises good points.

There ideas are expressed better than words. Basically it says that it sounds absurd to convert a lower-level, statically typed, etc. language to a higher level one, and that important strengths of Pascal are lost, and that some comparisons are nonsensical, among other things.

I think nobody got to answer my other topic and it was erased ? I don't understand. If it's really necessary I will remove the link. It is really harmless, not SPAM, any type of promotion or things like that. It speaks better than words, and is just about 5 minutes long.

What do you guys think about the subject? Please discuss.
7
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by paule32 on Today at 02:41:34 pm »
I will revert the misunderstanding comment, and I will apologies me.
I was on first step with study the internals of FPC.
I was new to 64-Bit Microsoft Windows programming in assembly.

This depends in different ABI call's and API function's for
the different kind of CPU's and Operating System.
8
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by rvk on Today at 02:37:13 pm »
But I think, this is a thing that the TVmt struct grounded.
Because I write earlier: I use my own RTL.
So with the standard RTL it works correctly...
and you blame FPC that it doesn't work with your custom RTL %)
9
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by paule32 on Today at 02:29:58 pm »
@rvk:
nono, ...
I can import C functions from external DLL files.
I can NOT import PAS functions from FPC created DLL files.

But I think, this is a thing that the TVmt struct grounded.
Because I write earlier: I use my own RTL.

As such, I completely remove RTTI, and Debug stuff using the SED tool.
Did you don't look to the build.bat ?
10
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by rvk on Today at 02:25:31 pm »
So, you came to the conclusion that FPC your RTL really doesn't support DLL import's at current time  ::)

That's something completely different  ;)
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018