• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Galfar

136
Ok thanks for the new lib, I'll include it in next Imaging release.
137
Hi,
to get rid of Extras dependency you can edit ImagingOptions.inc file in Source dir and
uncomment this line //{$DEFINE DONT_LINK_EXTRAS} (along with other stuff you don't need).

Or if you want to use something from Extras (OpenGL support maybe?), but don't want to have dependency on this dir, just copy related units to Source dir.

Maybe Extensions subdir (the one with actual Pascal units) of Extras could be moved under Source.
138
Try these two please: one is from TIFF test suite, another one is saved by Imaging with older LibTiff version.
139
Thanks, 
have you tested it with JPEG compressed TIFFs? I remember there were some problems before with those.
140
Sorry but this is not a DelphiX forum, try one of those. Or maybe some member here knows DelphiX well?
141
You need to use the canvas class which supports alpha blending.
This is my watermarking code, you can use it as inspiration:

Code (pascal) Select

  var
    Stream: TStream;
    CanvasPage: TImagingCanvas;
    Watermark: TSingleImage;
    CanvasWater: TImagingCanvas;
    R: TRect;
  begin
    Stream := TResourceStream.Create(HInstance, 'ImageWatermark', RT_RCDATA);
    Watermark := TSingleImage.CreateFromStream(Stream);
    Stream.Free;
    CanvasWater := TImagingCanvas.CreateForImage(Watermark);

    // Page.Image is a TSingleImage instance
    CanvasPage := TImagingCanvas.CreateForImage(Page.Image);
    if Page.Width > Page.Height then
      R := Rect(Round(Page.Width * 0.6), 0, Page.Width, Page.Height)
    else
      R := Rect(Round(Page.Width * 0.45), 0, Page.Width, Page.Height);
    R := ScaleRectToRect(Watermark.BoundsRect, R);
    R := Rect(R.Left, Page.Height - (R.Bottom - R.Top), R.Right, Page.Height);

    CanvasWater.StretchDrawAlpha(Watermark.BoundsRect, CanvasPage, R);   
 
    ... save to file, free canvases etc.

142
Help & Questions / Re: Get DPI
16 June 2010, 14:35:53
First you need the current sources from SVN repository.
Then you can use this code:

var
  XRes, YRes: Single;
begin
  ... load image
  if GlobalMetadata.GetPhysicalPixelSize(ruDpi, XRes, YRes) then
      ... do something with DPI info
 

If GetPhysicalPixelSize returns False that means no DPI info was present in the last loaded image. Also note that currently DPI info is read only from JPEG, PNG, and TIFF images.
143
Thanks for reporting this, I'll fix it right away. 
New features in the trunk haven't been tested that much yet.
144
Heh I was just going to start investigating myself (thought maybe it's just for some images because if this was affecting all JPEGs I would have noticed before) and forum soft fortunately told me that there are some unread posts in this thread when I hit Reply.
145
This is a quick test a put together that works, fades from black to the image and paints onto TPainBox. Be sure to use TFastARGB32Canvas. Also no need to increase alpha by 1, whole fade tooks about 3 seconds on my PC this way.


var
  Img, OutImg: TSingleImage;
  Canvas, OutCanvas: TImagingCanvas;
  I: Integer;
begin
  Img := TSingleImage.CreateFromFile('data\Tigers.png');
  Img.Format := ifA8R8G8B8;
  Canvas := TFastARGB32Canvas.CreateForImage(Img);
  OutImg := TSingleImage.CreateFromImage(Img);
  OutCanvas := TFastARGB32Canvas.CreateForImage(OutImg);
  OutCanvas.FillColor32 := pcBlack;
  OutCanvas.Clear;
  I := 0;
  Canvas.FillChannel(ChannelAlpha, I);

  while I <= 255  do
  begin
    OutCanvas.Clear;
    Canvas.FillChannel(ChannelAlpha, I);
    Canvas.DrawAlpha(Img.BoundsRect, OutCanvas, 0, 0);

    DisplayImage(PaintBox.Canvas, 0, 0, OutImg);

    Inc(I, 1);
  end;
end;
146
Help & Questions / Re: Quality of resizing
20 April 2010, 16:06:48
Thanks for locating the problem. I probably remove the "optimized" code path altogether, that's not the first problem with it and it's only marginally faster anyway.
147
What about calling Canvas.Release or Canvas.Refresh after the pixels are set?
148
Help & Questions / Re: Palettes
20 April 2010, 15:29:17
You can create new palette using NewPalette function in Imaging.pas (check out other palette functions there like CopyPalette, FindColor, FillCustomPalette, etc.).

After call to NewPalette you can modify palette entries easily, it's just array of RGBA values (Pal[10].R := 255).

Existing image can be mapped to palette using MapImageToPalette function.
149
With this code ImageCanvas.DrawStretchAlpha(Image.BoundsRect, ImageCanvas, CommonRect, rfBicubic) you're drawing part of the image on itself. Where's that PaintBox used?
DstWidth in BuildMappingTable is calculated as CommonRect.Right-CommonRect.Left (and CommonRect.Bottom-CommonRect.Top), with CommonRect value you posted you can't get negative number.
Could you post a bigger part of your project?



150
Instead of alpha testing:
glAlphaFunc( GL_GREATER, 0 );
glEnable( GL_ALPHA_TEST );

use alpha blending:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
or glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)


You can look at OpenGL demo of Imaging in Demos folder.


QuoteBy file format I've meant the format of data A8R8G8B8 or something like that.

Thar's setup for you in LoadGLTextureFromFile.
SMF spam blocked by CleanTalk