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

Post reply

Other options

Shortcuts: ALT+S save/post or ALT+P preview

Topic summary

Posted by shamballa
 -  5 August 2011, 15:45:39
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;
Posted by shamballa
 -  3 August 2011, 17:25:15
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.
Posted by Galfar
 -  2 August 2011, 17:25:53
You don't need ImagingExtras  for Graphics32 interface, that's only for auto-include of extra file format handlers. Adding ImagingGraphics32 should be enough. Maybe try putting it into Source directory directly and see if it will be found by Delphi there.
Posted by shamballa
 -  1 August 2011, 22:08:23
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.
Posted by shamballa
 -  1 August 2011, 19:10:50
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
Posted by Galfar
 -  1 August 2011, 18:22:20
Ok great.
Let me know if there are any more Imaging <=> Graphics32 interactions you may need
that are not supported by the current interface.
Posted by shamballa
 -  1 August 2011, 16:44:25
Solved it... I was adding it with the browser view (viewvc) instead of svnroot lol
Posted by shamballa
 -  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
SMF spam blocked by CleanTalk