• 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 - shamballa

1
This issue is now solved. I asked on Stack Overflow as it was more to do with Graphics32 than your library.

For anyone else interested the solution was:

Code (delphi) Select
function IsWhite(Color32: TColor32): Boolean;
  begin
    Result:= (TColor32Entry(Color32).B = 255) and
             (TColor32Entry(Color32).G = 255) and
             (TColor32Entry(Color32).R = 255);
  end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  with Image321 do
  begin
    Bitmap.ResetAlpha;
    for Y := 0 to Bitmap.Height-1 do
      for X := 0 to Bitmap.Width-1 do
      begin
        if IsWhite(Bitmap.Pixel[X, Y]) then
          Bitmap.Pixel[X,Y]:=Color32(255,255,255,0);
      end;
    Png:= TPortableNetworkGraphic32.Create;
    Png.Assign(Bitmap);
    Png.SaveToFile('C:\Temp\NowTransparent.png');
    Png.Free;
  end;
end;
2
Hello

Thank you - I have done that and now it is found.

I have tried to set the OuterColor to a known pixel but as this is a QRCode which will change I have not had much luck in that either
bmp.OuterColor := image.Bitmap.Pixel[0,?];

Here is my repainting code:

Code (delphi) Select
procedure TForm1.Button8Click(Sender: TObject); // Paint the barcode
var
  bmp: TBitmap32;
  Coords: TRect;
begin
bmp := TBitmap32.Create;
bmp.SetSize(image.Width, image.Height);
bmp.Canvas.Brush.Color := color;
bmp.Canvas.Rectangle(-1, -1, image.Width+2, image.Height+2);

bmp.DrawMode := dmTransparent;
bmp.OuterColor := $F0F0F0;
// bmp.OuterColor := image.Bitmap.Pixel[0,0];

// make Coords the size of image
Coords := Rect(0,0,image.Width,image.Height);

// psBarcodeComponent1.Options := [boTransparent];
psBarcodeComponent1.PaintBarCode(bmp.Canvas, Coords);
image.Bitmap.Assign(bmp);
end;


If I save as gif then there is no transparency and in png everything is transparent but shows as a black thumbnail. What am I doing wrong in the code above? It must be something I am missing or doing completely wrong.
3
I have tried adding the unit: ImagingExtras and even directly ImagingGraphics32 but the function ConvertBitmap32ToImage is not available. Delphi can see the unit ImagingExtras but not ImagingGraphics32. I have removed all old paths and added all the correct paths.
4
Hello

Thank you for your reply.

I have installed the latest SVN release but which unit should I be using for interfacing with the TImage32 of Graphics32?

What I am doing is painting a QR Code onto the Bitmaps Canvas but was having alot of problems trying to save it as a png keeping the transparency. I am setting the OuterColor to clWhite32 which is transparent while displayed in the control but when saved it is the opposite way around, the black is transparent and the white is not! This was done from a function using TPortableNetworkGraphic32

I then remembered your library which I have used once before for saving in png and a few other formats - I just don't know how I should reference the TImage32 as I can only get TBitmap in the ConvertBitmapToImage function.

Thanks for your time and your earlier reply.

Chris
5
Solved it... I was adding it with the browser view (viewvc) instead of svnroot lol
6
Help & Questions / Cannot Download from SVN
1 August 2011, 15:34:13
Hello

I am trying to download the latest version from the SVN as I see that a Graphics32 interface has been added which I really need, however when trying to checkout with TortoiseSVN using: http://imaginglib.svn.sourceforge.net/viewvc/imaginglib/trunk/ An Error is returned: Repository moved temporally to '/viewvc/imaginglib/trunk/'; please relocate
7
Hi,

Thank you very much, it works very well and is shorter code!

shamballa
8
ok I think I have found a way but not sure if it is the best way!

var
  ImgStream: TMemoryStream;
begin
  try
    ImgStream := TMemoryStream.Create;
    FImage := TMultiImage.Create;
    ASCIIImg.Picture.Graphic.SaveToStream(ImgStream);
    ImgStream.Position := 0;
    FImage.LoadMultiFromStream(ImgStream);
  finally
    ImgStream.Free;
  end;


...Then I am saving this way like in the Demo

var
  CopyPath: string;
begin
  SaveDlg.Filter := Imaging.GetImageFileFormatsFilter(False);
  SaveDlg.FileName := ChangeFileExt(ExtractFileName(FFileName), '');
  SaveDlg.FilterIndex := Imaging.GetFileNameFilterIndex(FFileName, False);
  if SaveDlg.Execute then
  begin
    CopyPath := ChangeFileExt(SaveDlg.FileName, '.' +
      Imaging.GetFilterIndexExtension(SaveDlg.FilterIndex, False));
    FImage.SaveToFile(CopyPath);
  end;


* This code "is" saving the images, but is there a better way?

Many thanks

Shamballa
9
Help & Questions / Saving from a TImage...
5 June 2009, 04:50:13
Hi,

This may be a stupid question but is it possible to use a normal TImage with this library?

Basically what I am doing is converting Extended ASCII characters to a Bitmap which I then want to save in other formats but I am a little confused as to how I can do this with a normal TImage Component using this library or if this is even possible?

Please could you inform me if it is?

Many thanks

Shamballa
SMF spam blocked by CleanTalk