Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: splitting an image
« Last post by Thaddy on Today at 04:52:43 pm »
LoadFromStream/SaveToStream?
2
:) Hello :)

I would like to share an experiment that I did:
https://poe.com/s/ELl4xkluKjNpEE1h6vuZ

In the example above, the bot translated a Python code to pascal without me asking. I intended to ask to translate but the AI predicted my intentions. I found the above example very impressive.

The above experiment was made with:
https://poe.com/CAI-NEURAL-API

In the case that you prefer ChatGPT, I have it also ready:
https://chat.openai.com/g/g-bqMxEDpIg-neural-api-free-pascal-developer

I have no intention in making money with POE nor ChatGPT. I configured these bots for my own usage. They contain the CAI interfaces so they know how to suggest coding.

:) I wish everyone happy pascal coding :)

Regarding the chatGPT interface version. Is that available as an assistant in the playground? I don't have a PRO account, but use the API through my (still limited) client.

3
General / Re: splitting an image
« Last post by madref on Today at 04:39:31 pm »
@Dzandaa


You use
Code: Pascal  [Select][+][-]
  1.                 Picture:= TBGRABitmap.Create;
  2.                 Picture.LoadFromFile(DOpenPicture.FileName);
  3.  
to load the picture.


But how do I do this from a TImageList
4
Graphics / Re: Drawing grid lines on a transparent image
« Last post by KodeZwerg on Today at 04:30:06 pm »
When needed, why not draw the lines to original image on the fly?
5
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?
6
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
7
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.
8
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.
9
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.
10
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.
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018