[vlc-devel] How to draw a line in subpicture_t region

Peter Tap ptrtap at yahoo.com
Mon Aug 27 22:40:40 CEST 2012


Olivier,

Thanks once again for your help.


It is not the algorithm that I need help with. It is VLC structures (picture_t) that I need help with on how to draw a line. 


Let's say I have to draw a line from (0, 0) to (100, 100) in RGB color 0xAABBCC.

Looking at some existing code, I guess I can start as the following:

int width = 100;
int height = 100;


picture_t* pPic = picture_New(VLC_CODEC_RGBA, width, height, 0, 1); 


Now, picture_t structure has four planes. I am guessing the first three planes are for R, G, and B, and the fourth plane is alpha.

for(int i=0;i<100;i++) {  *(pPic->p[0].p_pixels + (i * p[0].i_pitch) + i) = 0xAA;  

  *(pPic->p[1].p_pixels + (i * p[1].i_pitch) + i) = 0xBB;  

  *(pPic->p[2].p_pixels + (i * p[2].i_pitch) + i) = 0xCC;  

  *(pPic->p[3].p_pixels + (i * p[3].i_pitch) + i) = 0x00; // No transparency for alpha channel

}

Is this thought process correct? Am I missing something?


Regards,
Peter




----- Original Message -----
From: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
To: vlc-devel at videolan.org
Cc: 
Sent: Monday, August 27, 2012 11:59 AM
Subject: Re: [vlc-devel] How to draw a line in subpicture_t region

Hi 

On Mon, 2012-08-27 at 10:05 -0700, Peter Tap wrote:
> Hi Olivier,
> 
> Thank you for your help.
> 
> $ cd vlc/modules/video_filter
> $ grep -i svg *
> I don't get any matching files.
True, it is in fact a text renderer. If you feed it text, it will render
it through a template. If you feed it svg it will render svg.

> Can you please point me to a VLC sample that I can look up?
See the last post of http://forum.videolan.org/viewtopic.php?f=2&t=874&p=298269&hilit=svg#p298269

> Also, I am thinking just drawing a line should not be that hard. The problem is I cannot identify a sample file I can look up to get an idea. Most filters dealing with graphics seem to load/copy images.
See http://en.wikipedia.org/wiki/Line_drawing_algorithm
Bresenham algorithm is the most well known.

Regards,
Olivier


_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
http://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list