* * *

Author Topic: New version of BGRABitmap  (Read 75000 times)

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: New version of BGRABitmap
« Reply #30 on: March 22, 2015, 09:23:20 pm »
Make a plan for documentation and we come to help.
Some one like me may not write documentation but can help in organizing,checking,making demo and many tiny stuff that make you bored.
« Last Edit: March 22, 2015, 09:58:43 pm by aradeonas »

circular

  • Hero Member
  • *****
  • Posts: 2592
    • Personal webpage
Re: New version of BGRABitmap
« Reply #31 on: March 23, 2015, 10:04:30 am »
I don't really know where to start. Maybe make a reference of all functions and of all classes? Generate it automatically?
Conscience is the debugger of the mind

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: New version of BGRABitmap
« Reply #32 on: March 23, 2015, 04:39:19 pm »
Yes sure its needed.Because when some one like me with no experience browse source don't know what these functions do.A summary comment do the job like TBlendOperation,What each one do?
But for a graphic library full of color there is big need for functions demos to developer see the difference.It help very much,without your old demos and tutorial I'm sure I cant learn much. A big demo application that like tour show how functions works like my previous example show what is the difference of TBlendOperation.
I know it may need much work but @circular you made a brilliant work but when I test introducing it to my friends they its not clear for them how much power it has.
More user is like more blood in BGRABitmap's body.
For these you make a plane and I will help in whatever you think I can useful.


aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: New version of BGRABitmap
« Reply #33 on: March 23, 2015, 11:46:34 pm »
There are many documentation tools that you can simply find but I think its good to look it this.
Its used for BIG mORMot documentation and maybe it works for BGRABitmap.

circular

  • Hero Member
  • *****
  • Posts: 2592
    • Personal webpage
Re: New version of BGRABitmap
« Reply #34 on: March 24, 2015, 12:49:53 am »
We could for example do a reference like this:
http://wiki.lazarus.freepascal.org/TBGRABitmap_class

What do you think?
Conscience is the debugger of the mind

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: New version of BGRABitmap
« Reply #35 on: March 24, 2015, 01:07:39 am »
Its clean and being part of wiki has its benefits.
But we have a problem that all you or any body else write specialty about functions remain just in wiki and not in source,I think it can be better to use a system like I said that have documentation in code and a separate documentation.
Also I stick to demos,They are more useful to show how system works specially for a graphic library that work with eye.It can get more work but has many benefits.

circular

  • Hero Member
  • *****
  • Posts: 2592
    • Personal webpage
Re: New version of BGRABitmap
« Reply #36 on: March 24, 2015, 01:25:41 am »
I understand.

In the code, there is inheritance and overriding, so many functions have headers in multiple files. So where to put the description? A copy of the description in BGRABitmapTypes and in BGRADefaultBitmap?
Conscience is the debugger of the mind

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: New version of BGRABitmap
« Reply #37 on: March 24, 2015, 01:34:25 am »
Yes.
Some one like me and many others use Ctrl+Mouse hover for browsing the code and best place I think is BGRADefaultBitmap because always I want to check a function I will go to it and read comments.

circular

  • Hero Member
  • *****
  • Posts: 2592
    • Personal webpage
Re: New version of BGRABitmap
« Reply #38 on: March 24, 2015, 02:37:12 am »
I have added on SVN the same info as inline comments. It looks like this:
Code: [Select]
    { Draws the UTF8 encoded string, with color c.
      If align is taLeftJustify, (x,y) is the top-left corner.
      If align is taCenter, (x,y) is at the top and middle of the text.
      If align is taRightJustify, (x,y) is the top-right corner.
      The value of FontOrientation is taken into account, so that the text may be rotated. }
    procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel; align: TAlignment); override; overload;

    { Same as above functions, except that the text is filled using texture.
      The value of FontOrientation is taken into account, so that the text may be rotated. }
    procedure TextOut(x, y: single; sUTF8: string; texture: IBGRAScanner; align: TAlignment); override; overload;

    { Same as above, except that the orientation is specified, overriding the value of the property FontOrientation. }
    procedure TextOutAngle(x, y: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; align: TAlignment); override; overload;
    procedure TextOutAngle(x, y: single; orientationTenthDegCCW: integer; sUTF8: string; texture: IBGRAScanner; align: TAlignment); override; overload;

    { Draw the UTF8 encoded string at the coordinate (x,y), clipped inside the rectangle ARect.
      Additional style information is provided by the style parameter.
      The color c or texture is used to fill the text. No rotation is applied. }
    procedure TextRect(ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; c: TBGRAPixel); override; overload;
    procedure TextRect(ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; texture: IBGRAScanner); override; overload;

    { Returns the total size of the string provided using the current font.
      Orientation is not taken into account, so that the width is along the text.  }
    function TextSize(sUTF8: string): TSize; override;

Is this what you had in mind?
Conscience is the debugger of the mind

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: New version of BGRABitmap
« Reply #39 on: March 24, 2015, 09:41:19 am »
Exactly.Thank you very much.explanation is enough and easy to understand.
But for another example for my idea about demo consider this that for complex functions like "FillEllipseLinearColorAntialias" its hard to explain it and also to understand just with reading.

circular

  • Hero Member
  • *****
  • Posts: 2592
    • Personal webpage
Re: New version of BGRABitmap
« Reply #40 on: March 24, 2015, 12:10:59 pm »
Ok, I think I get the idea.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 2592
    • Personal webpage
Re: New version of BGRABitmap
« Reply #41 on: April 02, 2015, 04:16:06 pm »
Here is a new version of BGRABitmap 8.1 with some fixes:

- Memory leak fix for palettes, fix for weighted palette
- Better reliability of color reduction in BGRAColorQuantization

And some new features:

- Loading and saving palettes in various formats (Paint.NET, Gimp, Adobe Swatch Exchange, KOffice, Jasc Paint Shop Pro)
- TBGRABitmap.SaveToStreamAs procedure (to specify the format using TBGRAImageFormat enum)

http://sourceforge.net/projects/lazpaint/files/src/bgrabitmap8.1.zip/download
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 2592
    • Personal webpage
Re: New version of BGRABitmap
« Reply #42 on: April 14, 2015, 12:05:48 pm »
New version of BGRABitmap (8.2) with two new methods for TBGRABitmap object:
Code: [Select]
    procedure LoadFromDevice(DC: THandle);
    procedure LoadFromDevice(DC: THandle; ARect: TRect);
    procedure TakeScreenshotOfPrimaryMonitor;
    procedure TakeScreenshot(ARect: TRect);

To take a screenshot of a monitor, you can do:
Code: [Select]
bmp.TakeScreenShot(Screen.Monitors[numMonitor].BoundsRect);
To take a screenshot of the whole desktop, you can do:
Code: [Select]
bmp.TakeScreenShot(Screen.DesktopRect);
http://sourceforge.net/projects/lazpaint/files/src/bgrabitmap8.2.zip/download
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 2592
    • Personal webpage
Re: New version of BGRABitmap
« Reply #43 on: April 14, 2015, 07:08:27 pm »
Quote
There is some challenge here, to do text rendering without LCL. For now, BGRABitmap uses TBitmap to render text.
AggPas accomplishes that without problem. The code is there if you want to take a peek. ;)
Well yes and no. It works if a truetype font file is provided as far as I remember. One could parse the font directory of the system, but that would take some time, and would be complicated to port. And still only TrueType fonts would be handled.

Also BGRABitmap needs UTF8 classes to access files (unit lazutf8classes).
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 2592
    • Personal webpage
Re: New version of BGRABitmap
« Reply #44 on: April 15, 2015, 02:44:06 pm »
When trying to get BGRABitmap to work with fpGUI, I cannot find the following:
- to get a canvas to draw on a TfpgImage like on a window (this could be used to render text)
- to get an image from any canvas (not essential however)
- to draw data directly from data (opaque or transparent) : this can be achieved of course by creating an image
- to read an icon file (the type TIcon is in LCL)
- average level tree (the unit AvgLvlTree is in LCL)
- reading DOM/XML (the units laz2_DOM, laz2_XMLRead, laz2_XMLWrite are in LCL)

About UTF8 classes, it is ok as there as some functions in FreePascal to do that.

What would you suggest Graeme?
Conscience is the debugger of the mind

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus