Search Results

Search found 84 results on 4 pages for 'drawtext'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Quality gets worse using ffmpeg and Flash

    - by HOpety
    I have bunch of flash videos and am adding my brand to all of them. The problem is quality gets worse. I am doing with this command: ffmpeg -i /input.flv -vhook "/usr/loca/vhook/drawtext.so -f /usr/share/fonts/somefont.ttf -x 5 -y 5 t MyBrand" -f flv -s 320x240 - | flvtools2 -U stdin /output.flv Please tell me what I am doing wrong. I need the same quality.

    Read the article

  • Quality gets worse

    - by HOpety
    I have bunch of flash videos and am adding my brand to all of them. The problem is quality gets worse. I am doing with this command: ffmpeg -i /input.flv -vhook "/usr/loca/vhook/drawtext.so -f /usr/share/fonts/somefont.ttf -x 5 -y 5 t MyBrand" -f flv -s 320x240 - | flvtools2 -U stdin /output.flv Please tell me what I am doing wrong. I need the same quality.

    Read the article

  • Quality gets worse

    - by Hopery
    I have bunch of flash videos and am adding my brand to all of them. The problem is quality gets worse. I am doing with this command: ffmpeg -i /input.flv -vhook "/usr/loca/vhook/drawtext.so -f /usr/share/fonts/somefont.ttf -x 5 -y 5 t MyBrand" -f flv -s 320x240 - | flvtools2 -U stdin /output.flv Please tell me what I am doing wrong. I need the same quality.

    Read the article

  • How to get the application font color in Qt

    - by Solitaire
    Hi, I want to put some text on my UI, I am drawing the text in paint event of a widget using painter.. Here is the sample code, which shows how I am drawing the text.. QWidget::paintEvent(painter); QPainter paint(this); paint.drawText(QPoint(10,30),"Duplex"); but, the text color is looks like the default theme color, how to set the application font color to the text in paint event.. Thanks

    Read the article

  • Quality gets worse

    - by Hopery
    I have bunch of flash videos and am adding my brand to all of them. The problem is quality gets worse. I am doing with this command: ffmpeg -i /input.flv -vhook "/usr/loca/vhook/drawtext.so -f /usr/share/fonts/somefont.ttf -x 5 -y 5 t MyBrand" -f flv -s 320x240 - | flvtools2 -U stdin /output.flv Please tell me what I am doing wrong. I need the same quality.

    Read the article

  • What are useful functions for drawing text (MFC)?

    - by kobac
    I'm creating a line chart control, and I need to write (or better say draw) the axis names and axis values. I found DrawText and TextOut functions, but the text they show is flickering and don't know how to set the font and text orientation (I will need vertical text orientation as well as horizontal). Are there any other functions you could recoommend or how to use these stated above and get the results I need? Thanks in advance. Cheers.

    Read the article

  • Blackberry ListField Text Wrapping - only two lines.

    - by Diego Tori
    Within my ListField, I want to be able to take any given long String, and just be able to wrap the first line within the width of the screen, and just take the remaining string and display it below and ellipsis the rest. Right now, this is what I'm using to detect wrapping within my draw paint call: int totalWidth = 0; int charWidth = 0; int lastIndex = 0; int spaceIndex = 0; int lineIndex = 0; String firstLine = ""; String secondLine = ""; boolean isSecondLine = false; for (int i = 0; i < longString.length(); i++){ charWidth = Font.getDefault().getAdvance(String.valueOf(longString.charAt(i))); //System.out.println("char width: " + charWidth); if(longString.charAt(i) == ' ') spaceIndex = i; if((charWidth + totalWidth) > (this.getWidth()-32)){ //g.drawText(longString.substring(lastIndex, spaceIndex), xpos, y +_padding, DrawStyle.LEFT, w - xpos); lineIndex++; System.out.println("current lines to draw: " + lineIndex); /*if (lineIndex = 2){ int idx = i; System.out.println("first line " + longString.substring(lastIndex, spaceIndex)); System.out.println("second line " + longString.substring(spaceIndex+1, longString.length())); }*/ //firstLine = longString.substring(lastIndex, spaceIndex); firstLine = longString.substring(0, spaceIndex); //System.out.println("first new line: " +firstLine); //isSecondLine=true; //xpos = 0; //y += Font.getDefault().getHeight(); i = spaceIndex + 1; lastIndex = i; System.out.println("Rest of string: " + longString.substring(lastIndex, longString.length())); charWidth = 0; totalWidth = 0; } totalWidth += charWidth; System.out.println("total width: " + totalWidth); //g.drawText(longString.substring(lastIndex, i+1), xpos, y + (_padding*3)+4, DrawStyle.ELLIPSIS, w - xpos); //secondLine = longString.substring(lastIndex, i+1); secondLine = longString.substring(lastIndex, longString.length()); //isSecondLine = true; } Now this does a great job of actually wrapping any given string (assuming the y values were properly offsetted and it only drew the text after the string width exceeded the screen width, as well as the remaining string afterwards), however, every time I try to get the first two lines, it always ends up returning the last two lines of the string if it goes beyond two lines. Is there a better way to do this sort of thing, since I am fresh out of ideas?

    Read the article

  • 2d int array Drawing Canvas

    - by Andy
    How do you print out the contents of a 2d int array Ive code written in java for a sudoku game and im trying to create a game on the android using the same code My code in java reads in a text file(sudoku grid) i see canvas.drawText will read in a string, but how do you do it for a 2d int array, so it prints out in a grid?

    Read the article

  • How to retain canvas state and use it in onDraw() method

    - by marqss
    I want to make a measure tape component for my app. It should look something like this with values from 0cm to 1000cm: Initially I created long bitmap image with repeated tape background. I drew that image to canvas in onDraw() method of my TapeView (extended ImageView). Then I drew a set of numbers with drawText() on top of the canvas. public TapeView(Context context, AttributeSet attrs){ ImageView imageView = new ImageView(mContext); LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT); imageView.setLayoutParams(params); mBitmap = createTapeBitmap(); imageView.setImageBitmap(mBitmap); this.addView(imageView); } private Bitmap createTapeBitmap(){ Bitmap mBitmap = Bitmap.createBitmap(5000, 100, Config.ARGB_8888); //size of the tape Bitmap tape = BitmapFactory.decodeResource(getResources(),R.drawable.tape);//the image size is 100x100px Bitmap scaledTape = Bitmap.createScaledBitmap(tape, 100, 100, false); Canvas c = new Canvas(mBitmap); Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setFakeBoldText(true); paint.setAntiAlias(true); paint.setTextSize(30); for(int i=0; i<=500; i++){ //draw background image c.drawBitmap(scaledTape,(i * 200), 0, null); //draw number in the middle of that background String text = String.valueOf(i); int textWidth = (int) paint.measureText(text); int position = (i * 100) + 100 - (textWidth / 2); c.drawText(text, position, 20, paint); } return mBitmap; } Finally I added this view to HorizontalScrollView. At the beginning everything worked beautifully but I realised that the app uses a Lot of memory and sometimes crashed with OutOfMemory exception. It was obvious because a size of the bitmap image was ~4mb! In order to increase the performance, instead of creating the bitmap I use Drawable (with the yellow tape strip) and set the tile mode to REPEAT: setTileModeX(TileMode.REPEAT); The view now is very light but I cannot figure out how to add numbers. There are too many of them to redraw them each time the onDraw method is called. Is there any way that I can draw these numbers on canvas and then save that canvas so it can be reused in onDraw() method?

    Read the article

  • C# .NET Why does my inherited listview keep drawing in LargeIcon View ?? Because Microsoft is Evil!!

    - by Bugz R us
    I have a inherited Listview which standard has to be in Tile Mode. When using this control, the DrawItem gives e.bounds which are clearly bounds of largeIcon view ?? When debugging to check the view it is actually set to, it says it's in Tile view ?? Yet e.DrawText draws LargeIcon view ?? ......... Edit: ................. This seems only to happen when the control is placed upon another usercontrol? ......... Edit 2: ................. It gets stranger ... When i add buttons next to the list to change the view at runtime, "Tile" is the same as "LargeIcon", and "List" view is the same as "SmallIcons" ??? I've also completely removed the ownerdraw ... .......... Edit 3: ................. MSDN Documentation: Tile view Each item appears as a full-sized icon with the item label and subitem information to the right of it. The subitem information that appears is specified by the application. This view is available only on Windows XP and the Windows Server 2003 family. On earlier operating systems, this value is ignored and the ListView control displays in the LargeIcon view. Well I am on XP ya damn liars ?!? Apparently if the control is within a usercontrol, this value is ignored too ... pff I'm getting enough of this Microsoft crap .... you just keep on hitting bugs ... another day down the drain ... public class InheritedListView : ListView { //Hiding members ... mwuahahahahaha //yeah i was still laughing then [BrowsableAttribute(false)] public new View View { get { return base.View; } } public InheritedListView() { base.View = View.Tile; this.OwnerDraw = true; base.DrawItem += new DrawListViewItemEventHandler(DualLineGrid_DrawItem); } void DualLineGrid_DrawItem(object sender, DrawListViewItemEventArgs e) { View v = this.View; //**when debugging, v is Tile, however e.DrawText() draws in LargeIcon mode, // e.Bounds also reflects LargeIcon mode ???? ** }

    Read the article

  • Update View at runtime in Android

    - by seretur
    The example is pretty straightforward: i want to let the user know about what the app is doing by just showing a text (canvas.drawText()). Then, my first message appears, but not the other ones. I mean, i have a "setText" method but it doesn't updates. onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(splash); // splash is the view class loadResources(); splash.setText("this"); boundWebService(); splash.setText("that"): etc(); splash.setText("so on"); } The view's text drawing works by doing just a drawText in onDraw();, so setText changes the text but doesn't show it. Someone recommended me replacing the view with a SurfaceView, but it would be alot of trouble for just a couple of updates, SO... how the heck can i update the view dinamically at runtime? It should be quite simple, just showing a text for say 2 seconds and then the main thread doing his stuff and then updating the text... Thanks! Update: I tried implementing handler.onPost(), but is the same story all over again. Let me put you the code: package coda.tvt; import android.app.Activity; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class ThreadViewTestActivity extends Activity { Thread t; Splash splash; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); splash = new Splash(this); t = new Thread(splash); t.start(); splash.setTextow("OA"); try { Thread.sleep(4000); } catch (InterruptedException e) { } splash.setTextow("LALA"); } } And: public class Splash implements Runnable { Activity activity; final Handler myHandler = new Handler(); public Splash(Activity activity) { this.activity=activity; } @Override public void run() { // TODO Auto-generated method stub } public synchronized void setTextow(final String textow) { // Wrap DownloadTask into another Runnable to track the statistics myHandler.post(new Runnable() { @Override public void run() { TextView t = (TextView)activity.findViewById(R.id.testo); t.setText(textow); t.invalidate(); } }); } } Although splash is in other thread, i put a sleep on the main thread, i use the handler to manage UI and everything, it doesn't changes a thing, it only shows the last update.

    Read the article

  • Android: canvas.drawBitmap with Orientation(MagnetField)Sensor

    - by user368374
    hallo, i am developing Android app with orientation sensor. now i got problem. What i want to do is, change scale and position of bitmap which read from sd card. The scale and position depend on value from orientation sensor. i use canvas.drawBitmap(), then it cause problem. the app is just shut down. other drawXXX()methods have no problem..any suggestion? public class AnMagImgtestActivity extends Activity implements SensorEventListener { private SensorManager sensorManager; private MySurfaceView view; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sensorManager = (SensorManager)getSystemService(SENSOR_SERVICE); view = new MySurfaceView(this); ///make it fullscreen getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE); ///give screen a hiropon getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(view); } @Override protected void onResume() { super.onResume(); List sensors = sensorManager.getSensorList(Sensor.TYPE_ORIENTATION); if (sensors.size() 0) { Sensor sensor = sensors.get(0); sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_GAME); } } @Override protected void onPause() { super.onPause(); sensorManager.unregisterListener(this); } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } @Override public void onSensorChanged(SensorEvent event) { view.onValueChanged(event.values); } class MySurfaceView extends SurfaceView implements SurfaceHolder.Callback{ public MySurfaceView(Context context) { super(context); getHolder().addCallback(this); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { onValueChanged(new float[3]); } @Override public void surfaceCreated(SurfaceHolder holder) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { } void onValueChanged(float[] values) { Canvas canvas = getHolder().lockCanvas(); //String imgfn = "/sdcard/seekcamera"+"/"+regcode+"/to"+"/"+tempnum+".jpg"; String imgfn = "/sdcard/seekcamera"+"/de"+"/to"+"1.jpg"; //String imgfn = "/sdcard/seekcamera"+"/00"+"/00"+"/"+"42.jpg"; File mf = new File(imgfn); Bitmap bitmap0 = BitmapFactory.decodeFile(mf.getPath()); if (canvas != null) { Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(Color.GREEN); paint.setTextSize(12); canvas.drawColor(Color.BLACK); paint.setAlpha(200); for (int i = 0; i < values.length; i++) { canvas.drawText("values[" + i + "]: " + values[i], 0, paint.getTextSize() * (i + 1), paint); } paint.setColor(Color.WHITE); paint.setTextSize(100+values[2]); paint.setAlpha( (int) (255-values[2])); canvas.drawText("Germany", values[0]*1+20, paint.getTextSize() * 1+values[2]-80, paint); ///here is the problem.. canvas.drawBitmap(bitmap0, values[0],values[1], paint); getHolder().unlockCanvasAndPost(canvas); } } } }

    Read the article

  • C# ListView Detail, Highlight a single cell

    - by Mike Christiansen
    Hello, I'm using a ListView in C# to make a grid. I would like to find out a way to be able to highlight a specific cell, programatically. I only need to highlight one cell. I've experimented with Owner Drawn subitems, but using the below code, I get highlighted cells, but no text! Are there any ideas on how to get this working? Thanks for your help. //m_PC.Location is the X,Y coordinates of the highlighted cell. void listView1_DrawSubItem(object sender, DrawListViewSubItemEventArgs e) { if ((e.ItemIndex == m_PC.Location.Y) && (e.Item.SubItems.IndexOf(e.SubItem) == m_PC.Location.X)) e.SubItem.BackColor = Color.Blue; else e.SubItem.BackColor = Color.White; e.DrawBackground(); e.DrawText(); }

    Read the article

  • BlackBerry Horizontal Scrolling in TreeField or ListField

    - by sethxian
    I am working on an application that requires text larger than the viewable screen size in both a TreeField and a ListField. As you know, the TreeField and ListField callbacks support only graphics.drawText() methods, so I cannot add an instance of a Field per row. Does anyone have a method of Scrolling horizontally past the viewable text size? Is there maybe a scrollable panel that would work? I know of the NullField(Field.Focusable) trick but this won't work on the list field. Lastly, I am aware that the type of screen makes a different as FullScreen and MainScreen use VerticalFieldMangers. So am using a PopupScreen at the moment for my testing. Thank you in advance for your time.

    Read the article

  • Rendering formatted text in a direct3d application

    - by Fire Lancer
    I need to render some formatted text (colours, different font sizes, underlines, bold, etc) however I'm not sure how to go about doing it. D3DXFont only allows text of a single font/size/weight/colour/etc to be rendered at once, and I cant see a practical way to "combine" multiple calls to ID3DXFont::DrawText to do such things... I looked around and there doesn't seem to be any existing libraries that do these things, but I have no idea how to implement such a text renderer, and I couldn't even find any documentation on how such a text render would work, only rendering simple fixed width, ASCII bitmap fonts which looking at it is probably an entirely different approach that is only suitable for rendering simple blocks of text where Unicode is not important. If there's no direct3d font renders capable of doing this, is there any other renderers (eg for use in rendering rich text in a normal window), and would rendering those to a texture in RAM, then uploading that to the video card to render onto the back buffer yield reasonable performance?

    Read the article

  • Blackberry custom OVERLAY horizontal menu

    - by Dachmt
    Thanks to Max in this post, I made an horizontal menu. But now I'm trying to make an overlay menu, i I don't find how to do that... Let's see what i got first. So, I have a class MapScreen which display my map: public class MapScreen extends MenuScreen Then, I have in the same file the MenuScreen class like this that allows to display the horizontal menu when I press the MENU key: abstract class MenuScreen extends MainScreen { boolean mMenuEnabled = false; CyclicHFManager mMenuManager = null; public MenuScreen() { mMenuManager = new CyclicHFManager(); mMenuManager.setBorder(BorderFactory.createBevelBorder(new XYEdges(4, 0, 0, 0), new XYEdges(Color.DARKBLUE, 0, 0, 0), new XYEdges( Color.WHITE, 0, 0, 0))); mMenuManager.setBackground(BackgroundFactory .createLinearGradientBackground(Color.DARKBLUE, Color.DARKBLUE, Color.LIGHTBLUE, Color.LIGHTBLUE)); for (int i = 0; i < 10; i++) { Bitmap nBitmap = new Bitmap(60, 60); Graphics g = new Graphics(nBitmap); g.setColor(Color.DARKBLUE); g.fillRect(0, 0, 60, 60); g.setColor(Color.WHITE); g.drawRect(0, 0, 60, 60); Font f = g.getFont().derive(Font.BOLD, 40); g.setFont(f); String text = String.valueOf(i); g.drawText(text, (60 - f.getAdvance(text)) >> 1, (60 - f .getHeight()) >> 1); Bitmap fBitmap = new Bitmap(60, 60); g = new Graphics(fBitmap); g.setColor(Color.DARKBLUE); g.fillRect(0, 0, 60, 60); g.setColor(Color.GOLD); g.drawRect(0, 0, 60, 60); g.setFont(f); g.drawText(text, (60 - f.getAdvance(text)) >> 1, (60 - f .getHeight()) >> 1); BitmapButtonField button = new BitmapButtonField(nBitmap, fBitmap); button.setCookie(String.valueOf(i)); button.setPadding(new XYEdges(0, 18, 0, 18)); button.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field, int context) { Dialog.inform("Button # " + (String) field.getCookie()); } }); mMenuManager.add(button); } } protected boolean keyDown(int keycode, int time) { if (Keypad.KEY_MENU == Keypad.key(keycode)) { if (mMenuManager.getManager() != null) { delete(mMenuManager); mMenuManager.mCyclicTurnedOn = false; } else { add(mMenuManager); mMenuManager.getField(2).setFocus(); mMenuManager.mCyclicTurnedOn = true; } return true; } else { return super.keyDown(keycode, time); } }} And finally my menu manager: public class CyclicHFManager extends HorizontalFieldManager { int mFocusedFieldIndex = 0; public boolean mCyclicTurnedOn = false; public void focusChangeNotify(int arg0) { super.focusChangeNotify(arg0); if (mCyclicTurnedOn) { int focusedFieldIndexNew = getFieldWithFocusIndex(); if (focusedFieldIndexNew != mFocusedFieldIndex) { if (focusedFieldIndexNew - mFocusedFieldIndex > 0) switchField(0, getFieldCount() - 1); else switchField(getFieldCount() - 1, 0); } } else { mFocusedFieldIndex = getFieldWithFocusIndex(); } } private void switchField(int prevIndex, int newIndex) { Field field = getField(prevIndex); delete(field); insert(field, newIndex); }} So as it is like this, it is working: when I press the MENU key, the menu appears, i can navigate between buttons, and it disappear when I press again the same key. The only problem is my menu isn't overlaying my map, it pushes the content up. I tried with the menu manager like in your first response, resizing the content manager but it is the same result. Max gave me the link http://stackoverflow.com/questions/1497073/blackberry-fields-layout-animation to do so, but I really don't know how to use it to make it work in my project... Thank you for your help! UPDATE This works great, it's what I wanted. However, I still have a problem because I'm under 4.5. So first in the MenuHostManager constructor, I deleted the USE_ALL_HEIGHT and change setPositionChild(mMenuManager, 0, Display.getHeight() - mMenuManager.getPreferredHeight()); like this to have the menu at the bottom of the screen. It worked. Then, instead of drawing my bitmaps, I did this: Bitmap nBitmap = EncodedImage.getEncodedImageResource("menu" + i + ".png").getBitmap(); BitmapButtonField button = new BitmapButtonField(nBitmap, nBitmap); And it worked too (no rollover for now, later). So it is great! I also overwrite the Paint method of my CyclicHFManager to have a background color, because I can't use the BorderFactory and BackgroundFactory... My menu bar has a color for now so it's ok. Then, because of these 2 classes missing, in my BitmapButtonField I had to delete the 2 setBorder functions that change the borders. And now i have my buttons pretty big like normal buttons with borders... How can I make the same effect as the setBorder functions under 4.5? (BTW, setBorder is not working under 4.5 too...). Thank you!

    Read the article

  • Can I draw Qt objects directly to Win32 DC (Device Context)?

    - by Kevin
    I can draw Qt objects to an QImage and then draw the image to HDC or CDC. This may hurt our application's performance. It would be great if I can draw Qt objects directly to Win32 HDC or MFC CDC. I expect that there is a class, say QWin32Image for clear, then I can use it in this way: QWin32Image image(hdc, 100, 100, Format_ARGB32_Premultiplied); QPainter painter(&image); painter.drawText(....); Is it possible for my thought? Or is there a better way to do that?

    Read the article

  • Android programming - How to acces [to draw on] XML view in main.xml layout, using code

    - by user556248
    Ok I'm a newbie at Android programming, have a hard time with the graphics part. Understand the beauty of creating layout in XML file, but lost how to access various elements, especially a View element to draw on it. See example of my layout main.xml here; <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Title" android:text="App title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#000000" android:background="#A0A0FF"/> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/PaperLayout" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" android:focusable="true"> <View android:id="@+id/Paper" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:id="@+id/File" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="34dp" android:layout_alignParentTop="true" android:layout_centerInParent="true" android:clickable="true" android:textSize="10sp" android:text="File" /> <Button android:id="@+id/Edit" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="34dp" android:clickable="true" android:textSize="10sp" android:text="Edit" /> </LinearLayout> </LinearLayout> As you can see I have a custom app title bar, then a View filling middle, and finally two buttons in bottom. Catching button events and responding to, for example changing title bar text and changing View background color works fine, but how the heck do I access and more importantly draw on the view defined in main.xml UPDATE: That for your suggestion, however besides that I need a View, not ImageView and you are missing a parameter on canvas.drawText and an ending bracket, it does not work. Now this is most likely because you missed the fact that I am a newbie and assuming I can fill in any blanks. Now first of all I do NOT understand why in my main.xml layout file I can create a View or even a SurfaceView element, which is what I need, but according to your solution I don't even specify the View like Anyways I edited my main.xml according to your solution, and slimmed it down a bit for simplicity; <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Title" android:text="App title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#000000" android:background="#A0A0FF"/> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/PaperLayout" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" android:focusable="true"> <com.example.MyApp.CustomView android:id="@+id/Paper" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <com.example.colorbook.CustomView/> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:id="@+id/File" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="34dp" android:layout_alignParentTop="true" android:layout_centerInParent="true" android:clickable="true" android:textSize="10sp" android:text="File" /> </LinearLayout> </LinearLayout> In my main java file, MyApp.java, I added this after OnCreate; public class CustomView extends ImageView { @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawText("Your Text", 1, 1, null); } } But I get error on the "CustomView" part; "Implicit super constructor ImageView() is undefined for default constructor.Must define an explicit constructor" Eclipse suggests 3 quick fixes about adding constructor, but none helps, well it removes error but gives error on app when running. I hope somebody can break this down for me and provide a solution, and perhaps explain why I can't just create a View element in my main.xml layotu file and draw on it in code.

    Read the article

  • problems with zend_pdf and right to left language and unicode?

    - by user1400
    hi all, i am using zend_pdf to create pdf files for Ritgh to left language as arabic or east asia langauges i use of this code $pdfDoc = new Zend_Pdf(); $pdfPage = $pdfDoc->newPage(Zend_Pdf_Page::SIZE_A4); $font = Zend_Pdf_Font::fontWithPath(APPLICATION_PATH.'/Fonts/arial.ttf'); $pdfPage->setFont($font, 36); $pdfDoc->pages[] = $pdfPage; $unicodeString = '????'; $pdfPage->drawText($unicodeString, 72, 720, 'UTF-8'); $pdfDoc->save('utf8.pdf'); but there are two problem 1- how can i change document's direction to right to left ? 2- characters are separated one by one. but in some laguages characters of a word are joint together. any idea? or i may use tcpdf? thanks

    Read the article

  • Custom view in ListView disappears while scrolling in Android

    - by troorl
    Hi. I wrote a simple custom view for rows in ListView. It works fine, but when I try to scroll the list, I see only white rows without content. And when scrolling is over, rows continue to show again. This is how I draw a custom view: @Override protected void onDraw(Canvas canvas) { if(poster != null) { canvas.drawBitmap(poster, padding, padding, paint); } canvas.drawText(title, 55 + padding, 16 + padding, paint); } Maybe I missed something? P.S. This is short screencast (400kb) http://dl.dropbox.com/u/190203/test.mpeg

    Read the article

  • Using a FormattedText object, how do I find out how much of my text was actually displayed?

    - by Robert
    If I have code like this: FormattedText text = new FormattedText(sTheBook, System.Globalization.CultureInfo.CurrentUICulture, System.Windows.FlowDirection.LeftToRight, new Typeface("Times New Roman"), 13, Brushes.Black); text.MaxTextWidth = 300; text.MaxTextHeight = 600; text.TextAlignment = TextAlignment.Justify; dc.DrawText(text, new Point(10, 0)); ...then, if it is long, only some of the text that I passed in (via sTheBook) will be displayed on the screen. I need to know how much was displayed so I can display the rest later! I can easily measure an amount of text, but it seems silly to do a search by rendering and re-rendering my text over and over until I find the piece that fits exactly. Thanks!

    Read the article

  • How to draw RTL text (Arabic) onto a Bitmap and have it ordered properly?

    - by Casey
    I'm trying to draw Arabic text onto a Bitmap for display: Bitmap img = Bitmap.createBitmap( (int) f+100, 300, Config.RGB_565); Canvas c = new Canvas(); c.setBitmap( img ); mFace = Typeface.createFromAsset(getAssets(),"DejaVuSansCondensed.ttf"); mPaint.setTypeface(mFace); content = "????"; content = ArabicUtilities.reshape( content ); System.out.println("Drawing text: " + content); c.drawText(content, 30, 30, mPaint); The ArabicUtilities class is a tool to reshape the unicode text so the letters are connected. see: http://github.com/agawish/Better-Arabic-Reshaper/ However, the bitmap that is generated looks like this: When it should look like ???? I believe the issue is because, unlike a TextView, the Bitmap class is not BiDi aware, so it draws the letters from left to write. Try as I might, I can't figure out how to draw the text in the correct order.

    Read the article

  • iPhone app crashed: Assertion failed function evict_glyph_entry_from_strike, file Fonts/CGFontCache.

    - by Ross
    this happened quite randomly. I didn't delete any tableview cell, the backtrace information: Assertion failed: (d->entry[identifier.glyph] == g), function evict_glyph_entry_from_strike, file Fonts/CGFontCache.c, line 810. Program received signal: “SIGABRT”. (gdb) bt #0 0x97da5972 in __kill () #1 0x97da5964 in kill$UNIX2003 () #2 0x97e38ba5 in raise () #3 0x97e4ec5c in abort () #4 0x97e3b804 in __assert_rtn () #5 0x0037fe0e in evict_glyph_entry_from_cache () #6 0x003226aa in expire_glyphs_nl () #7 0x00322645 in CGFontCacheUnlock () #8 0x00321fef in CGGlyphLockUnlock () #9 0x0240f9b7 in ripc_DrawGlyphs () #10 0x0031b0d4 in draw_glyphs () #11 0x0031a91f in CGContextShowGlyphsWithAdvances () #12 0x35814178 in WebCore::Font::drawGlyphs () #13 0x35813da5 in WebCore::Font::drawGlyphBuffer () #14 0x35813aca in WebCore::Font::drawSimpleText () #15 0x35813760 in drawAtPoint () #16 0x3581307e in -[NSString(WebStringDrawing) _web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:] () #17 0x3090d2e9 in -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:letterSpacing:includeEmoji:] () #18 0x3090cfe3 in -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:] () #19 0x3093d853 in -[UINavigationItemView drawText:inRect:] () #20 0x3093a96b in -[UINavigationItemButtonView drawRect:] () #21 0x3091ff61 in -[UIView(CALayerDelegate) drawLayer:inContext:] () #22 0x0060daeb in -[CALayer drawInContext:] () #23 0x0060d8f9 in backing_callback () #24 0x0060d1b4 in CABackingStoreUpdate () #25 0x0060c3cc in -[CALayer _display] () #26 0x0060bf56 in CALayerDisplayIfNeeded () #27 0x0060b3bd in CA::Context::commit_transaction () #28 0x0060b022 in CA::Transaction::commit () #29 0x006132e0 in CA::Transaction::observer_callback () #30 0x30245c32 in __CFRunLoopDoObservers () #31 0x3024503f in CFRunLoopRunSpecific () #32 0x30244628 in CFRunLoopRunInMode () #33 0x32044c31 in GSEventRunModal () #34 0x32044cf6 in GSEventRun () #35 0x309021ee in UIApplicationMain ()

    Read the article

  • Alignment of Hebrew Vowel points in Android

    - by Aharon Manne
    I want to display Hebrew text with vowel points (nikkud) using the Canvas.drawText interface. The vowel points come out misaligned, as in the following image taken using a Motorola Defy+ device: The hiriq is between the resh and the yod, the holam between the vav and nun. I have added the rtl code (\u200F) to the string at both ends, no joy. I know that there are applications that have solved this problem, such as the Smart Siddur. Is there a difference between text-based applications and graphics based? I would think that the same engine renders the text in both cases. I suppose I could split up the string and place the vowels separately, but that seems pretty painful and not extensible. TIA for any clues.

    Read the article

  • To make the drawn text clear

    - by user1758835
    I have written the code to draw text on the image and to save the image,But the text which I am drawing is looking blur on the image.What modifications need to do to make it clear,Or if there is any other way to draw text on image in android Canvas canvas = new Canvas(photo); Typeface tf = Typeface.create(topaste, Typeface.BOLD); Paint paint = new Paint(); paint.setStyle(Style.FILL); paint.setTypeface(tf); paint.setColor(Color.WHITE); paint.setStrokeWidth(12); canvas.drawBitmap(photo, 0, 0, paint); canvas.drawText(topaste, 15, 120, paint); image.setImageBitmap(photo);

    Read the article

< Previous Page | 1 2 3 4  | Next Page >