Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: splitting an image
« Last post by Dzandaa on Today at 11:15:40 am »
Hi,

You cant try this skeleton (using BGRABitmap)

B->
2
General / Re: how to tweek fpmake to compile RTL?
« Last post by marcov on Today at 10:35:11 am »
So to be clear: the rtl, toplevel and compiler makefiles use an older build system; makefiles generated from a template by FPCMAKE and fpmake

Before say 2015, nearly everything was like that.
3
General / Re: splitting an image
« Last post by TRon on Today at 10:34:19 am »
the image is loaded like this from a TImageList. It is depended on a color:
That answers at least one of my questions ....  :P

Ah well, let's see how far you are able to get with the following (you would have to adjust to meet your specific requirements).

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   sameArea: TRect;
  4.   srcRect: TRect;
  5.   dstRect: TRect;
  6. begin
  7.   // split original image into two separated ones
  8.  
  9.   // left part of original image has the exact same rectangle coordinates as
  10.   // the destination image and is 165 pixels width.
  11.   sameArea    := Bounds(0,0,165, Image1.Height);
  12.   // Copy rectangle area from image1 (leftmost part) to image2
  13.   Image2.Canvas.CopyRect(sameArea, Image1.Canvas, sameArea);
  14.  
  15.   // right part of original image is located 165 pixels from the left
  16.   srcRect := Bounds(165, Image1.Canvas.ClipRect.Top, Image1.Canvas.ClipRect.Width-165, Image1.Canvas.ClipRect.Height);
  17.   // copied image starts at topleft of canvas and is 200 pixels width
  18.   dstRect := Bounds(  0,                          0,                              200, Image1.Canvas.ClipRect.Height);
  19.   // copy rectangel from image1 (rightmost part) to image3
  20.   Image3.Canvas.CopyRect(dstRect, Image1.Canvas, srcRect);
  21. end;
  22.  
4
Beginners / Re: Can function be used for change event
« Last post by Thaddy on Today at 10:24:31 am »
You can look at how the modified property is implemented for edit/memo
You can also have a look at the observer/observed pattern that is available for any control
https://www.freepascal.org/docs-html/rtl/classes/ifpobserved.fponotifyobservers.html
Also note that you can indeed define a function, since TMethod accepts not only a procedure, but also a function.



5
General / Re: splitting an image
« Last post by madref on Today at 10:18:58 am »
the image is loaded like this from a TImageList. It is depended on a color:
Code: Pascal  [Select][+][-]
  1.   case KleurPop of
  2.     Oranje : ImageList_Divisie.GetBitmap(0,Image_Divisie.Picture.Bitmap); // Oranje
  3.     Rood   : ImageList_Divisie.GetBitmap(1,Image_Divisie.Picture.Bitmap); // Rood
  4.     Blauw  : ImageList_Divisie.GetBitmap(2,Image_Divisie.Picture.Bitmap); // Blauw
  5.     Groen  : ImageList_Divisie.GetBitmap(3,Image_Divisie.Picture.Bitmap); // Groen
  6.     Paars  : ImageList_Divisie.GetBitmap(4,Image_Divisie.Picture.Bitmap); // Paars
  7.     Geel   : ImageList_Divisie.GetBitmap(5,Image_Divisie.Picture.Bitmap); // Geel
  8.     Zwart  : ImageList_Divisie.GetBitmap(6,Image_Divisie.Picture.Bitmap); // Zwart
  9.   end;  // case
the idea was to, if possible, split this image into 2 images. So the idea is to have 2 TImage placeholders
1 is holding the left part of the image and the other 1 is holding the right part of this image.
i have added an example image
6
General / Re: Parameter passing oddities
« Last post by Nitorami on Today at 09:59:28 am »
When I call your example as "add (C1,C2,C1)", then C1 will be changed. The compiler cannot detect that, it does not know that two parameters are at the same address.

So I do change a const parameter.

The wiki says on constref (https://wiki.freepascal.org/Constref): "not only the parameter, but also the variable (...) passed by the caller (...) must not be changed until the call with the constref parameter has returned."

So - is that legal or not ?
7
General / Re: splitting an image
« Last post by TRon on Today at 09:40:23 am »
@madref:
1. Do you write the text yourself with code into the image ?
2. Are you sure you want to have two separate TImage components in return ? (resulting in a total of 3 TImage components on your form)
3. in case 2 applies do these two other TImage components already exist
4. in case answer to 2 is no then where do you want the resulting "splitted" images to be stored ?
5. Is the splitting process itself a manual step, e.g. you have to click a button or should it be done when something specific happens on the form ?
8
General / Re: splitting an image
« Last post by paule32 on Today at 09:23:22 am »
I don't write anything about "saving".

You maybe over read it:
the principle is:
- load a file (that can be done with "LoadFromFile")
- and BitBlt (copy a view port of the memory region of the image) to a destination Canvas

This Canvas can be any "displayable" device (screen, printer, or memory)
9
General / Re: splitting an image
« Last post by madref on Today at 09:18:14 am »
I don't need to save or do anything to the image.
I just want to split the image in two parts.
The image contains text (like "Text Example") that I want to split
And I want to display it as:


Text
Example
10
General / Re: splitting an image
« Last post by paule32 on Today at 09:13:32 am »
- you can use multiple images, that you can "TImage.LoadFromFile"
=> Then you have more loading time
=> Then you can store the images on Form's - but they overlapped eventually
=> Then you can exchange the images from each load time/update of your software
=> Then you can load/un-load the images which means, allocate/de-allocate memory

- you can use one or multiple tile images, load it per LoadFromFile, store it into a background Canvas/Handle, and BitBlt (copy) the background data into the foreground (enabled/viewing view port on TForm or other TComponent)
=> Then you can gzip/zlib (compress) these file/s to save storage space
=> Then you can copy in-Memory data into background Canvas/foreground Canvas in time faster than if you use TImage.LoadFromFile
=> Then you need a little bit lesser memory
=> Then you can hold one copy of the image in the memory
=> Eventually, you need more memory.

On tile images, you have to know the exact position of the tiles - when not, then you have eventually image garbage on the device where you display/print the image's/tile's.
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018