Ejemplo n.º 1
0
		public DrawableHolder(android.graphics.drawable.BitmapDrawable drawable, float x, 
			float y)
		{
			mDrawable = drawable;
			mX = x;
			mY = y;
			mDrawable.getPaint().setAntiAlias(true);
			// Force AA
			mDrawable.setBounds(0, 0, mDrawable.getIntrinsicWidth(), mDrawable.getIntrinsicHeight
				());
		}
Ejemplo n.º 2
0
 public DrawableHolder(android.graphics.drawable.BitmapDrawable drawable, float x,
                       float y)
 {
     mDrawable = drawable;
     mX        = x;
     mY        = y;
     mDrawable.getPaint().setAntiAlias(true);
     // Force AA
     mDrawable.setBounds(0, 0, mDrawable.getIntrinsicWidth(), mDrawable.getIntrinsicHeight
                             ());
 }
Ejemplo n.º 3
0
        private void printSample1()
        {
            MainActivity.mBixolonPrinter.setPageMode();
            MainActivity.mBixolonPrinter.PrintDirection = BixolonPrinter.DIRECTION_180_DEGREE_ROTATION;
            MainActivity.mBixolonPrinter.AbsoluteVerticalPrintPosition = 0;
            MainActivity.mBixolonPrinter.AbsolutePrintPosition         = 0;
            MainActivity.mBixolonPrinter.printText("Page mode\nsample", BixolonPrinter.ALIGNMENT_LEFT, BixolonPrinter.TEXT_ATTRIBUTE_FONT_A, BixolonPrinter.TEXT_SIZE_HORIZONTAL1 | BixolonPrinter.TEXT_SIZE_VERTICAL1, false);
            MainActivity.mBixolonPrinter.AbsoluteVerticalPrintPosition = 0;
            MainActivity.mBixolonPrinter.AbsolutePrintPosition         = 128;

            BitmapDrawable drawable = (BitmapDrawable)Resources.getDrawable(R.drawable.bixolon);
            Bitmap         bitmap   = drawable.Bitmap;

            MainActivity.mBixolonPrinter.printBitmap(bitmap, BixolonPrinter.ALIGNMENT_LEFT, 128, 70, false);
            MainActivity.mBixolonPrinter.AbsoluteVerticalPrintPosition = 0;
            MainActivity.mBixolonPrinter.AbsolutePrintPosition         = 256;
            MainActivity.mBixolonPrinter.printQrCode("www.bixolon.com", BixolonPrinter.ALIGNMENT_LEFT, BixolonPrinter.QR_CODE_MODEL2, 4, false);
            MainActivity.mBixolonPrinter.formFeed(true);
        }
Ejemplo n.º 4
0
		/// <summary>Create from inside an XML document.</summary>
		/// <remarks>
		/// Create from inside an XML document.  Called on a parser positioned at
		/// a tag in an XML document, tries to create a Drawable from that tag.
		/// Returns null if the tag is not a valid drawable.
		/// </remarks>
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public static android.graphics.drawable.Drawable createFromXmlInner(android.content.res.Resources
			 r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs)
		{
			android.graphics.drawable.Drawable drawable;
			string name = parser.getName();
			if (name.Equals("selector"))
			{
				drawable = new android.graphics.drawable.StateListDrawable();
			}
			else
			{
				if (name.Equals("level-list"))
				{
					drawable = new android.graphics.drawable.LevelListDrawable();
				}
				else
				{
					if (name.Equals("layer-list"))
					{
						drawable = new android.graphics.drawable.LayerDrawable();
					}
					else
					{
						if (name.Equals("transition"))
						{
							drawable = new android.graphics.drawable.TransitionDrawable();
						}
						else
						{
							if (name.Equals("color"))
							{
								drawable = new android.graphics.drawable.ColorDrawable();
							}
							else
							{
								if (name.Equals("shape"))
								{
									drawable = new android.graphics.drawable.GradientDrawable();
								}
								else
								{
									if (name.Equals("scale"))
									{
										drawable = new android.graphics.drawable.ScaleDrawable();
									}
									else
									{
										if (name.Equals("clip"))
										{
											drawable = new android.graphics.drawable.ClipDrawable();
										}
										else
										{
											if (name.Equals("rotate"))
											{
												drawable = new android.graphics.drawable.RotateDrawable();
											}
											else
											{
												if (name.Equals("animated-rotate"))
												{
													drawable = new android.graphics.drawable.AnimatedRotateDrawable();
												}
												else
												{
													if (name.Equals("animation-list"))
													{
														drawable = new android.graphics.drawable.AnimationDrawable();
													}
													else
													{
														if (name.Equals("inset"))
														{
															drawable = new android.graphics.drawable.InsetDrawable();
														}
														else
														{
															if (name.Equals("bitmap"))
															{
																drawable = new android.graphics.drawable.BitmapDrawable(r);
																if (r != null)
																{
																	((android.graphics.drawable.BitmapDrawable)drawable).setTargetDensity(r.getDisplayMetrics
																		());
																}
															}
															else
															{
																if (name.Equals("nine-patch"))
																{
																	drawable = new android.graphics.drawable.NinePatchDrawable();
																	if (r != null)
																	{
																		((android.graphics.drawable.NinePatchDrawable)drawable).setTargetDensity(r.getDisplayMetrics
																			());
																	}
																}
																else
																{
																	throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
																		 ": invalid drawable tag " + name);
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			drawable.inflate(r, parser, attrs);
			return drawable;
		}
Ejemplo n.º 5
0
        private void printBitmap()
        {
            string pathName = mTextView.Text.ToString();

            mAlignment = BixolonPrinter.ALIGNMENT_CENTER;
            RadioGroup radioGroup = (RadioGroup)findViewById(R.id.radioGroup1);

            switch (radioGroup.CheckedRadioButtonId)
            {
            case R.id.radio0:
                mAlignment = BixolonPrinter.ALIGNMENT_LEFT;
                break;

            case R.id.radio1:
                mAlignment = BixolonPrinter.ALIGNMENT_CENTER;
                break;

            case R.id.radio2:
                mAlignment = BixolonPrinter.ALIGNMENT_RIGHT;
                break;
            }

            int width = 0;

            radioGroup = (RadioGroup)findViewById(R.id.radioGroup2);
            switch (radioGroup.CheckedRadioButtonId)
            {
            case R.id.radio3:
                width = BixolonPrinter.BITMAP_WIDTH_NONE;
                break;

            case R.id.radio4:
                width = BixolonPrinter.BITMAP_WIDTH_FULL;
                break;

            case R.id.radio5:
                string @string = mWidthEdit.Text.ToString();
                if (@string.Length == 0)
                {
                    Toast.makeText(ApplicationContext, "Please enter the width", Toast.LENGTH_SHORT).show();
                }
                else
                {
                    width = int.Parse(@string);
                }
                break;
            }

            EditText editText = (EditText)findViewById(R.id.editText1);
            int      level    = int.Parse(editText.Text.ToString());

            CheckBox checkBox = (CheckBox)findViewById(R.id.checkBox1);

            mFormFeed = checkBox.Checked;

            checkBox = (CheckBox)findViewById(R.id.checkBox2);

            bool dither   = ((CheckBox)findViewById(R.id.checkBox3)).Checked;
            bool compress = ((CheckBox)findViewById(R.id.checkBox4)).Checked;

            if (checkBox.Checked)
            {
                if (pathName != null && pathName.Length > 0)
                {
                    MainActivity.mBixolonPrinter.printDotMatrixBitmap(pathName, mAlignment, width, level, false);
                }
                else
                {
                    BitmapDrawable drawable = (BitmapDrawable)Resources.getDrawable(R.drawable.bixolon);
                    Bitmap         bitmap   = drawable.Bitmap;

                    MainActivity.mBixolonPrinter.printDotMatrixBitmap(bitmap, mAlignment, width, level, false);
                }
            }
            else
            {
                if (pathName != null && pathName.Length > 0)
                {
                    MainActivity.mBixolonPrinter.printBitmap(pathName, mAlignment, width, level, dither, compress, true);

                    /*
                     * You can choose the method. Please reference attached document.
                     * MainActivity.mBixolonPrinter.getMonoPixels(pathName, width, level);
                     */
                }
                else
                {
                    BitmapDrawable drawable = (BitmapDrawable)Resources.getDrawable(R.drawable.bixolon);
                    Bitmap         bitmap   = drawable.Bitmap;

                    MainActivity.mBixolonPrinter.printBitmap(bitmap, mAlignment, width, level, dither, compress, true);

                    /*
                     * You can choose the method. Please reference attached document.
                     * MainActivity.mBixolonPrinter.getMonoPixels(bitmap, width, level);
                     */
                }
            }
        }
Ejemplo n.º 6
0
 public DrawableHolder(android.graphics.drawable.BitmapDrawable drawable) : this(drawable
                                                                                 , 0.0f, 0.0f)
 {
 }