Re: [android-developers] drawText and drawBitmap start location is different?

2010-04-04 Thread Stanley Li
Thanks a lot. You are right. The x,y for text is lower left.

On Sun, Apr 4, 2010 at 12:14 AM, SoftwareForMe.com SoftwareForMe.com <
softwareforme@gmail.com> wrote:

> I don't recall the exact details in Android, but in almost all graphics
> APIs the Y position for text is either the [baseline] (bottom of a letter
> 'o' or 'n') or [baseline + descent] (bottom of the letter 'g' or 'y').  In
> other words, (x,y) for bitmaps is top-left, (x,y) for text is lower left.
>
> A quick experiment would tell you whether it's the baseline or baseline +
> descent.
>
> On Sat, Apr 3, 2010 at 11:25 PM, Stanley Li  wrote:
>
>> Hi all,
>>
>> I want to draw a text on top of a bitmap.
>>
>> So in my onDraw function, i do the following:
>>
>> canvas.drawBitmap(myBitmap, 30, 30, mPaint);
>> textPaint.setTextSize(20);
>> canvas.drawText("Life X 3", 30, 30, textPaint);
>>
>> However, it ended up that the text is above the bitmap. (the X position is
>> correct, but the y position is not).
>>
>> Can anyone help me with this?
>>
>> Thanks in advance,
>> Stanley
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.


Re: [android-developers] drawText and drawBitmap start location is different?

2010-04-04 Thread SoftwareForMe.com SoftwareForMe.com
I don't recall the exact details in Android, but in almost all graphics APIs
the Y position for text is either the [baseline] (bottom of a letter 'o' or
'n') or [baseline + descent] (bottom of the letter 'g' or 'y').  In other
words, (x,y) for bitmaps is top-left, (x,y) for text is lower left.

A quick experiment would tell you whether it's the baseline or baseline +
descent.

On Sat, Apr 3, 2010 at 11:25 PM, Stanley Li  wrote:

> Hi all,
>
> I want to draw a text on top of a bitmap.
>
> So in my onDraw function, i do the following:
>
> canvas.drawBitmap(myBitmap, 30, 30, mPaint);
> textPaint.setTextSize(20);
> canvas.drawText("Life X 3", 30, 30, textPaint);
>
> However, it ended up that the text is above the bitmap. (the X position is
> correct, but the y position is not).
>
> Can anyone help me with this?
>
> Thanks in advance,
> Stanley
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.


[android-developers] drawText and drawBitmap start location is different?

2010-04-03 Thread Stanley Li
Hi all,

I want to draw a text on top of a bitmap.

So in my onDraw function, i do the following:

canvas.drawBitmap(myBitmap, 30, 30, mPaint);
textPaint.setTextSize(20);
canvas.drawText("Life X 3", 30, 30, textPaint);

However, it ended up that the text is above the bitmap. (the X position is
correct, but the y position is not).

Can anyone help me with this?

Thanks in advance,
Stanley

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.