Recent

Author Topic: IMAGEN TRANSPARENTE  (Read 3256 times)

donalejo

  • New member
  • *
  • Posts: 6
IMAGEN TRANSPARENTE
« on: July 25, 2018, 05:37:26 pm »
Buenos dias , estimados amigos del foro:

Estoy dibujando la ruta del gps, quisiera que el canvas sea transparente cuando las rutas se cruzen o se solapen. Tienen Alguna idea de como se soluciona?

Les dejo la imagen y parte del codigo.

  pbRoute.Canvas.Brush.Color:=0 and ($ff shl 32);
        pbRoute.Canvas.Pen.Color:= clBlue + (($ff-$66) shl 32);
  pbRoute.Canvas.Pen.Width:=1;
  pbRoute.Canvas.Polygon(Movil);     

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6629
Re: IMAGEN TRANSPARENTE
« Reply #1 on: July 25, 2018, 05:38:56 pm »
(Moved to Spanish. The general forums are English only)

Handoko

  • Hero Member
  • *****
  • Posts: 2694
  • My goal: build my own game engine using Lazarus
Re: IMAGEN TRANSPARENTE
« Reply #2 on: July 25, 2018, 08:11:25 pm »
Translated using Google Translate:
Quote
Good morning, dear friends of the forum:

I'm drawing the route of the GPS, I want the canvas to be transparent when the routes intersect or overlap. Do you have any idea how it is solved?

I leave the image and part of the code.

Did you mean you want to do polygon clipping?

I don't think you can do it using just TCanvas, you need to use third party library maybe:
http://www.angusj.com/delphi/clipper.php

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: IMAGEN TRANSPARENTE
« Reply #3 on: July 25, 2018, 08:51:33 pm »
don't use polygon. Polygon is a shape it uses both a pen.color for its outline and a brush.color for its area use pbRoute.Canvas.Polyline(Movil) instead.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

donalejo

  • New member
  • *
  • Posts: 6
Re: IMAGEN TRANSPARENTE
« Reply #4 on: July 27, 2018, 02:31:26 pm »
Perfecto pero eso no me soluciona el problema , necesito que las imagenes sean trasnparentes.

Edson

  • Hero Member
  • *****
  • Posts: 952
Re: IMAGEN TRANSPARENTE
« Reply #5 on: July 27, 2018, 05:59:34 pm »
¿Las polilíneas no son transparentes? Las políneas son solo conjunto de líneas. Debería servirte.
También podrías dibujar simplemente línea por línea.
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

440bx

  • Sr. Member
  • ****
  • Posts: 393
Re: IMAGEN TRANSPARENTE
« Reply #6 on: July 27, 2018, 06:47:34 pm »
¿Las polilíneas no son transparentes? Las políneas son solo conjunto de líneas. Debería servirte.
También podrías dibujar simplemente línea por línea.

I can give you a solution using the Winbdows API.  You simply set the brush to NULL_BRUSH (which is what is used to fill the polygon).  With the API you do it this way: SelectObject(hdc, GetStockObject(NULL_BRUSH)); that will produce transparent polygons (or any other shape that uses a brush to fill the enclosed area/region.)

Hopefully someone that knows components can help you with how you set that into the Canvas (which should be just a handle to a device context.)

Another way would be to use PolyLine or PolyPolyline.  Those don't fill the resulting area, therefore you don't even need to set the brush. 

Hopefully someone else can help you implement that in the component you are using.

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: IMAGEN TRANSPARENTE
« Reply #7 on: July 27, 2018, 10:47:52 pm »
Perfecto pero eso no me soluciona el problema , necesito que las imagenes sean trasnparentes.
google translate
Quote
Perfect but that does not solve the problem, I need the images are transparent.
depends on what pbRoute is if it is a timage/tbitmap then you need to change the pixel format to pf32bit after that you need to play with the canvas.pen.color which is a 4 byte integer to set its alpha channel to what ever transparency level you want a good one is around 200 its mostly opaque but it will show you vague changes underneath.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

FJSS

  • Newbie
  • Posts: 1
Re: IMAGEN TRANSPARENTE
« Reply #8 on: August 16, 2018, 06:00:13 am »
Saludos a todos.

En esencia lo que busca el amigo donalejo es esto de la imagen. Ya en Windows 32/64 bits se logró, mas no en WinCE, que es el real objetivo.

Quote
depends on what pbRoute is if it is a timage/tbitmap...
Es un TPaintBox el componente utilizado para dibujar.