Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3481858
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:29:38+00:00 2026-05-18T10:29:38+00:00

What im trying to do I have a drawing procedure (it works) it draws

  • 0

What im trying to do

I have a drawing procedure (it works) it draws to a bitmap “OBJmap” it then puts OBJmap into Wholemap. This all works but there is a issue. It seems to treat the undefined parts of objmap as white even though objmap and wholemap is set as PF32Bit, and hence when it puts objmap into wholemap I get a white box behind the pasted image that should be transparent.

This only happens on ATI machines, but this is for schools and they all have 100% ati because they are cheap (im not biased honest), so I was recommended to use AggPas to solve this issue.

My code

procedure DrawScene();
var
  ObjLength,LineLength,Filllength,Obj,lin,angle,i,x1,y1,x2,y2:integer;
  Npoints : array[0..1] of Tpoint;
  WG,OG: Tagg2d;

  Objmap,wholemap:TBitmap;
begin
  //Set up WholeMap Bitmap
  wholemap := TBitmap.Create;
  wholemap.PixelFormat:=pf32bit;
  wholemap.Transparent:=false;
  wholemap.Width:=area;
  wholemap.height:=area;

  WG:= Tagg2d.create;
  BitmapAlphaTransparency(wholemap, 0);
  WG.attach(wholemap,False);
  WG.ClearAll(255,0,0,255);
  //BitmapAlphaTransparency(wholemap, 255);

  //WG.MasterAlpha(255);

  // itterate through each object drawing the object to OBJmap
  ObjLength:=length(Objects);
  for Obj:=0 to (ObjLength-1) do
  if objects[Obj].Visible then
  begin
    //Set up Object map Bitmap
    Objmap := TBitmap.Create;
    Objmap.PixelFormat:=pf32bit;

    Objmap.Transparent:=true;
    Objmap.Width:=Objects[obj].Boundright-objects[obj].Boundleft+3;
    Objmap.height:=Objects[obj].BoundTop-objects[obj].Boundbottom+3;

    OG:= Tagg2d.create;
    OG.attach(Objmap,False);

    {OG.ClearAll(0,0,255,255);  // Clears all bitmap to transparrent
    OG.MasterAlpha(255);
    OG.LineWidth(5);
    og.AntiAliasGamma(255);
    OG.
    OG.LineColor(0,255,0,255);
    OG.FillColor(0,255,0,255);
    //OG.
    OG.MoveTo(0,0);
    OG.LineTo(Objmap.width-1,Objmap.height-1); }

    //Draw the Lines to Objmap
    LineLength:=length(objects[Obj].Lines)-1;
    angle:=objects[Obj].Rotation;
    for lin:=0 to (LineLength) do
    begin
      //Transform points
      for i:=0 to 1 do
        Npoints[i] := PointAddition(RotatePoint(objects[obj].Lines[lin].Point[i],angle),point(-objects[obj].boundleft,-Objects[obj].Boundbottom),false);
      //draw transformed points
      Objmap:=DrawLine(Npoints[0].x,Npoints[0].y,Npoints[1].x,Npoints[1].y,objects[obj].Lines[lin].Color,Objmap,OG);
    end;
    //Draw the Fills to Objmap
    Filllength:=length(objects[Obj].Fills)-1;
    for i:=0 to Filllength do
    begin
      //transform points
      Npoints[0]:=PointAddition(RotatePoint(objects[Obj].Fills[i].Point,objects[Obj].Rotation),point(-objects[obj].boundleft,-Objects[obj].Boundbottom),false);
      // fill points
      Objmap:=fillpoint( Npoints[0].x, Npoints[0].y,objects[Obj].Fills[i].color,Objmap);
    end;

    //draw objmap to wholemap
    x1:=objects[obj].Position.x+objects[obj].Boundleft-1;
    y1:=area-(objects[obj].Position.y+objects[obj].Boundtop)-2;
    x2:=x1+Objmap.Width;
    y2:=y1+Objmap.Height;

    WG.TransformImage(Objmap,x1,y1,x2,y2);  //this show border
    //WG.copyimage(Objmap,x1,y1);  //this draws the scene up but does not handle transparencies correctly
    //wholemap.Canvas.Draw(x1,y1,Objmap);//does not work in PF32bit or on ati machines


    //wg.Free; // this it does not like (crash) do i need it?
    Objmap.Free;
  end;


   // write wholemap to Visible Canvas
   mainwindow.bufferim.Canvas.Draw(0,0,wholemap);
   wholemap.Free;
   mainwindow.RobotArea.Picture.Graphic:=mainwindow.bufferim.Picture.Graphic;
end;

Image examples

Not working ,Working and ,current respectivly

alt text
alt text
alt text

I am only able to get working result on Nvidia machines with the default

wholemap.Canvas.Draw

Method and I wish to get it to work on all machines using aggpass.

What do I do how do I draw objmap onto wholemap but not draw the transparent bits?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:29:38+00:00Added an answer on May 18, 2026 at 10:29 am

    I had the same problem, you need to set the BlendMode before calling Transform Image

    WG.BlendMode(AGG_BlendSrcTop);
    

    This worked for me but you may need to try several blend modes before getting the right answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So i have been googling/binging trying to find an answer on this but drawing
I'm trying to do some basic quartz core drawing with arcs, but have an
I have been trying to figure this out all day. I've searched SO and
Hi I am trying out drawing app and have a problem when it comes
I am trying to do some drawing with android. I have an audioplayer, which
I'm trying to have a script automatically transform an xml file into several html
I have been trying desperately to draw some images into a view. The view
I have an GlSurfaceView that is drawing a square that i am trying to
I have no problem drawing a texture to the screen but I cant get
Ok, I have been working on solving this problem all day, and I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.